Hi Fabio,
On Tuesday, October 29, 2013 05:32 PM, Fabio Estevam wrote:
Hi Chris,
On Tue, Oct 29, 2013 at 5:15 AM, Chris Ruehl <chris.ruehl@xxxxxxxxxxxx> wrote:
Fabio was right, the imx27 uses the ChipIdea for its USB my dts config was
wrong.
More accurate settings for the OTG and H2 are:
usbotg: usb@10024000 {
compatible = "fsl,imx27-usb";
reg = <0x10024000 0x200>;
interrupts = <56>;
clocks = <&clks 75>, <&clks 62>;
clock-names = "ipg", "ahb";
dr_mode = "host";
phy_type = "ulpi";
status = "disabled";
};
usbh1: usb@10024200 {
compatible = "fsl,imx27-usb";
reg = <0x10024200 0x200>;
interrupts = <54>;
clocks = <&clks 75>, <&clks 62>;
clock-names = "ipg", "ahb";
dr_mode = "host";
phy_type = "serial";
status = "disabled";
};
usbh2: usb@10024400 {
compatible = "fsl,imx27-usb";
reg = <0x10024400 0x200>;
interrupts = <55>;
clocks = <&clks 75>, <&clks 62>;
clock-names = "ipg", "ahb";
dr_mode = "host";
phy_type = "ulpi";
status = "disabled";
};
Where do you configure the pins as USB functionality?
I would expect a 'pinctrl-0' into your board dts file that configure
the USB pins.
pinctrl-0 ... ahhh , OK
I have a static function from the non-fdt version where I init all gpios
and set board specific
resets and user-space gpios (exports) which not yet supported in the fdt.
static void __init mx27gtsir_init_board(void)
{
int reg;
mxc_gpio_setup_multiple_pins(mx27gtsir_pins,
ARRAY_SIZE(mx27gtsir_pins),"mx27gtsir");
mx27gtsir_init_userspace_gpios();
gpio_set_value(GPIO_1504_RST2,0); /* Reset */
msleep(1);
gpio_set_value(GPIO_1504_RST2,1);
gpio_set_value(GPIO_1504_CSN,1); /* CS_N low active */
msleep(1);
gpio_set_value(GPIO_1504_CSN,0);
msleep(1);
gpio_set_value(GPIO_1504_RST,0); /* Reset */
msleep(1);
gpio_set_value(GPIO_1504_RST,1);
/* 22k pull up for sd1 pins SD1_D3_CSPI3_SS */
reg = __raw_readw(MX27_IO_ADDRESS(MX27_SYSCTRL_BASE_ADDR +
MX27_SYS_PSCR));
reg |= 0x0c;
__raw_writew(reg,MX27_IO_ADDRESS(MX27_SYSCTRL_BASE_ADDR +
MX27_SYS_PSCR));
/* 22k pull up for sd2 pins */
reg = __raw_readw(MX27_IO_ADDRESS(MX27_SYSCTRL_BASE_ADDR +
MX27_SYS_PSCR));
reg &= ~0xfff0;
reg |= 0xfff0;
__raw_writew(reg, MX27_IO_ADDRESS(MX27_SYSCTRL_BASE_ADDR +
MX27_SYS_PSCR));
}
called in the machine_init function.
and add to usbmisc_imx.c
--- linux-3.12-rc7/drivers/usb/chipidea/usbmisc_imx.c 2013-10-28
07:12:03.000000000 +0800
+++ linux-3.12-rc7-gtsys/drivers/usb/chipidea/usbmisc_imx.c 2013-10-29
13:31:45.523288470 +0800
@@ -21,6 +21,11 @@
#define MX25_USB_PHY_CTRL_OFFSET 0x08
#define MX25_BM_EXTERNAL_VBUS_DIVIDER BIT(23)
+#define MX27_USB_PHY_CTRL_OFFSET 0x600 /* MCIMX27RM Reference Manual v0.4
*/
+#define MX27_BM_OVER_CUR_DIS_H1 BIT(8) /* 30.5.1.1 USBCONTROL—USB Control
Register (USB_CTRL) */
+#define MX27_BM_OVER_CUR_DIS_H2 BIT(16)
+#define MX27_BM_OVER_CUR_DIS_OTG BIT(24)
+
#define MX53_USB_OTG_PHY_CTRL_0_OFFSET 0x08
#define MX53_USB_UH2_CTRL_OFFSET 0x14
#define MX53_USB_UH3_CTRL_OFFSET 0x18
@@ -68,6 +73,37 @@
return 0;
}
+static int usbmisc_imx27_init(struct imx_usbmisc_data *data)
+{
+ void __iomem *reg = NULL;
+ unsigned long flags;
+ u32 val = 0;
+
+ if (data->index > 3)
+ return -EINVAL;
+
+ if (data->disable_oc) {
+ spin_lock_irqsave(&usbmisc->lock, flags);
+ reg = usbmisc->base + MX27_USB_PHY_CTRL_OFFSET;
+ switch (data->index) {
+ case 0:
+ val = readl(reg) | MX27_BM_OVER_CUR_DIS_OTG;
+ break;
+ case 1:
+ val = readl(reg) | MX27_BM_OVER_CUR_DIS_H1;
+ break;
+ case 2:
+ val = readl(reg) | MX27_BM_OVER_CUR_DIS_H2;
+ break;
+ }
+ if (reg && val)
+ writel(val, reg);
+ spin_unlock_irqrestore(&usbmisc->lock, flags);
+ }
+
+ return 0;
+}
+
static int usbmisc_imx53_init(struct imx_usbmisc_data *data)
{
void __iomem *reg = NULL;
@@ -128,6 +164,10 @@
.post = usbmisc_imx25_post,
};
+static const struct usbmisc_ops imx27_usbmisc_ops = {
+ .init = usbmisc_imx27_init,
+};
+
static const struct usbmisc_ops imx53_usbmisc_ops = {
.init = usbmisc_imx53_init,
};
@@ -162,6 +202,10 @@
.data = &imx25_usbmisc_ops,
},
{
+ .compatible = "fsl,imx27-usbmisc",
+ .data = &imx27_usbmisc_ops,
+ },
+ {
.compatible = "fsl,imx53-usbmisc",
.data = &imx53_usbmisc_ops,
},
[ 1.104173] ci_hdrc ci_hdrc.0: ChipIdea HDRC found, lpm: 0; cap: f4424100
op: f4424140
[ 1.104243] ci_hdrc ci_hdrc.0: It is OTG capable controller
[ 1.104732] ci_hdrc ci_hdrc.0: EHCI Host Controller
[ 1.109861] ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 1
[ 1.128447] ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00
[ 1.134640] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[ 1.141599] usb usb1: New USB device strings: Mfr=3, Product=2,
SerialNumber=1
[ 1.148958] usb usb1: Product: EHCI Host Controller
[ 1.153963] usb usb1: Manufacturer: Linux 3.12.0-rc7 ehci_hcd
[ 1.159831] usb usb1: SerialNumber: ci_hdrc.0
[ 1.167399] hub 1-0:1.0: USB hub found
[ 1.171457] hub 1-0:1.0: 1 port detected
[ 1.177957] ci_hdrc ci_hdrc.1: ChipIdea HDRC found, lpm: 0; cap: f4424500
op: f4424540
[ 1.178071] ci_hdrc ci_hdrc.1: EHCI Host Controller
[ 1.183226] ci_hdrc ci_hdrc.1: new USB bus registered, assigned bus number 2
[ 1.200450] ci_hdrc ci_hdrc.1: USB 2.0 started, EHCI 1.00
[ 1.206643] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
[ 1.213601] usb usb2: New USB device strings: Mfr=3, Product=2,
SerialNumber=1
[ 1.220962] usb usb2: Product: EHCI Host Controller
[ 1.225968] usb usb2: Manufacturer: Linux 3.12.0-rc7 ehci_hcd
[ 1.231835] usb usb2: SerialNumber: ci_hdrc.1
[ 1.239414] hub 2-0:1.0: USB hub found
[ 1.243500] hub 2-0:1.0: 1 port detected
A problem persists the ULPI 1504 not get detected
any help here?
Looks like you are in the right track.
Yeap I see some light at the end of my tunnel.. lets hope is not a train!
Have you selected the USB_ULPI in your .config?
Yes , and the non fdt version can detect the 1504.
Also, please read this thread:
http://www.spinics.net/lists/linux-usb/msg94584.html
It talks about the non-dt mxc ehci driver, but could help you to fix
the initialization order to get the 1504 detected.
Regards,
Fabio Estevam\
Thank you for all this infos I will go further and let you know..
Regards
Chris Ruehl
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html