hi igorpadykov
i alter the dts as:
&usbotg1 {
dr_mode = "peripheral";
status = "okay";
};
and do it :
FSL-UT-USB-030-Connected-Test
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[cols=">s,6a",frame="topbot",options="header"]
|====================================================================
|Name | Description
| Summary |
USB Connected Test During Booting Up
| Automated |
No
| Kernel Config Option |
| Software Dependency |
N/A
| Non-default Hardware Configuration |
N/A
| Test Procedure |
NOTICE: please check clkcount often using dump-clocks.sh
1.1: With USB Disk connected at OTG Port
/unit_tests/dump-clocks.sh | grep usb
modprobe g_mass_storage file=/dev/mmcblk0p1 removable=1
modprobe -r g_mass_storage
/unit_tests/dump-clocks.sh | grep usb
1.2: With USB Disk connected at Host 1 Port
/unit_tests/dump-clocks.sh | grep usb
1.3: With USB Cable connected with PC, load gadget module
/unit_tests/dump-clocks.sh | grep usb
modprobe g_mass_storage file=/dev/mmcblk0p1 removable=1
/unit_tests/dump-clocks.sh | grep usb
disconnet PC
/unit_tests/dump-clocks.sh | grep usb
1.4: With USB Cable connected with USB Charger, load gadget module
modprobe g_mass_storage file=/dev/mmcblk0p1 removable=1
/unit_tests/dump-clocks.sh | grep usb
disconnect usb charger
connect to pc
1.5: With Micro B-To-A cable, but without anything connected
/unit_tests/dump-clocks.sh | grep usb
plug in usb disk
plug out Micro B-To-A cable
modprobe g_mass_storage file=/dev/mmcblk0p1 removable=1
connect to pc
disconnect with pc
/unit_tests/dump-clocks.sh | grep usb
| Expected Result |
Without kernel dump, without clock mismatch
|====================================================================
<<<
what's the mean of "modprobe g_mass_storage file=/dev/mmcblk0p1 removable=1" ?
why i have to do it 1.1~1.5?
i have refer Controller Operation Mode was peripheral,but the pc didn't find my board when i connect it.
the pc display nothing.
i saw the source .and add same debug infromation:
kernel-source\drivers\usb\chipidea\core.c
static irqreturn_t ci_irq(int irq, void *data)
{
printk("0000000000000000000000\n");
struct ci_hdrc *ci = data;
irqreturn_t ret = IRQ_NONE;
u32 otgsc = 0;
printk("ci->in_lpm:%x\n",ci->in_lpm);
if (ci->in_lpm) {
printk("irq:%x\n",irq);
disable_irq_nosync(irq);
ci->wakeup_int = true;
pm_runtime_get(ci->dev);
return IRQ_HANDLED;
}
printk("ci->is_otg:%x\n",ci->is_otg);
if (ci->is_otg) {
otgsc = hw_read_otgsc(ci, ~0);
if (ci_otg_is_fsm_mode(ci)) {
ret = ci_otg_fsm_irq(ci);
if (ret == IRQ_HANDLED)
return ret;
}
}
/*
* Handle id change interrupt, it indicates device/host function
* switch.
*/
if (ci->is_otg && (otgsc & OTGSC_IDIE) && (otgsc & OTGSC_IDIS)) {
printk("Handle id change interrupt\n");
ci->id_event = true;
/* Clear ID change irq status */
hw_write_otgsc(ci, OTGSC_IDIS, OTGSC_IDIS);
ci_otg_queue_work(ci);
return IRQ_HANDLED;
}
/*
* Handle vbus change interrupt, it indicates device connection
* and disconnection events.
*/
if (ci->is_otg && (otgsc & OTGSC_BSVIE) && (otgsc & OTGSC_BSVIS)) {
printk("Handle vbus change interrupt\n");
ci->vbus_glitch_check_event = true;
/* Clear BSV irq */
hw_write_otgsc(ci, OTGSC_BSVIS, OTGSC_BSVIS);
ci_otg_queue_work(ci);
return IRQ_HANDLED;
}
/* Handle device/host interrupt */
if (ci->role != CI_ROLE_END){
printk("Handle device/host interrupt\n");
ret = ci_role(ci)->irq(ci);
}
return ret;
}
when i connect the pc :

first irq:change the low power mode.
but i can't understand the second time,why the ci->is_otg is 1?
my dr_mode = "peripheral";
i know ret = ci_role(ci)->irq(ci); is enable the irq for peripheral
source in: static irqreturn_t udc_irq(struct ci_hdrc *ci) //kernel-source\drivers\usb\chipidea\udc.c
but it didn't happend.
my board:

i use the usb otg to connect the pc..
in my mind ,if i want to send and reveice the data with the pc :
1.alter the dts ,rebuilt the dtb,reboot the board.
2 .when i connect to the pc i can see the board information on pc device manager such as VENDOR_ID and PRODUCT_ID
3......
..
..
it's right?
i have altered the dts ,but the pc didn't identify it...
why?
if i have to alter the kernel?
it's my first time to learn usb ,thanks for all the help!