How to fix tensorflow protobuf compilation errors on OSX? - macos

I'm trying to compile TensorFlow after checking out the repo.
I've reached a point where I'm stuck with google protobuf errors:
INFO: From Compiling tensorflow/core/kernels/histogram_op_gpu.cu.cc:
./tensorflow/core/lib/core/status.h(32): warning: attribute "warn_unused_result" does not apply here
external/protobuf_archive/src/google/protobuf/arena.h(719): error: more than one instance of overloaded function "google::protobuf::Arena::CreateMessageInternal" matches the argument list:
function template "T *google::protobuf::Arena::CreateMessageInternal<T>(google::protobuf::Arena *)"
function template "T *google::protobuf::Arena::CreateMessageInternal<T,Args...>(Args &&...)"
argument types are: (google::protobuf::Arena *)
detected during:
instantiation of "Msg *google::protobuf::Arena::CreateMaybeMessage<Msg>(google::protobuf::Arena *, google::protobuf::internal::true_type) [with Msg=tensorflow::TensorShapeProto_Dim]"
(729): here
instantiation of "T *google::protobuf::Arena::CreateMaybeMessage<T>(google::protobuf::Arena *) [with T=tensorflow::TensorShapeProto_Dim]"
external/protobuf_archive/src/google/protobuf/repeated_field.h(648): here
instantiation of "GenericType *google::protobuf::internal::GenericTypeHandler<GenericType>::New(google::protobuf::Arena *) [with GenericType=tensorflow::TensorShapeProto_Dim]"
external/protobuf_archive/src/google/protobuf/repeated_field.h(675): here
instantiation of "GenericType *google::protobuf::internal::GenericTypeHandler<GenericType>::NewFromPrototype(const GenericType *, google::protobuf::Arena *) [with GenericType=tensorflow::TensorShapeProto_Dim]"
external/protobuf_archive/src/google/protobuf/repeated_field.h(1554): here
instantiation of "TypeHandler::Type *google::protobuf::internal::RepeatedPtrFieldBase::Add<TypeHandler>(TypeHandler::Type *) [with TypeHandler=google::protobuf::RepeatedPtrField<tensorflow::TensorShapeProto_Dim>::TypeHandler]"
external/protobuf_archive/src/google/protobuf/repeated_field.h(2001): here
instantiation of "Element *google::protobuf::RepeatedPtrField<Element>::Add() [with Element=tensorflow::TensorShapeProto_Dim]"
bazel-out/local_darwin-opt/genfiles/tensorflow/core/framework/tensor_shape.pb.h(471): here
....
Has anyone bumped into this issue ? Any ideas on how to tackle this issue ?
(I'm using Python 2.7 in a virtual environment on OSX 10.11.5)

Luckily someone else already no only had the same issue, but also found a fix and shared it. Thanks to Daniel Trebbien's comments on protobuf and eigen I could compile tensorflow with GPU support on OSX:
>>> import tensorflow as tf
>>> tf.__version__
'1.6.0-rc0'
>>> sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
2018-02-19 22:22:12.194516: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:859] OS X does not support NUMA - returning NUMA node zero
2018-02-19 22:22:12.195011: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1331] Found device 0 with properties:
name: GeForce GT 750M major: 3 minor: 0 memoryClockRate(GHz): 0.9255
pciBusID: 0000:01:00.0
totalMemory: 2.00GiB freeMemory: 12.58MiB
2018-02-19 22:22:12.195038: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1410] Adding visible gpu devices: 0
2018-02-19 22:22:14.563665: I tensorflow/core/common_runtime/gpu/gpu_device.cc:911] Device interconnect StreamExecutor with strength 1 edge matrix:
2018-02-19 22:22:14.563700: I tensorflow/core/common_runtime/gpu/gpu_device.cc:917] 0
2018-02-19 22:22:14.563707: I tensorflow/core/common_runtime/gpu/gpu_device.cc:930] 0: N
2018-02-19 22:22:14.563798: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1021] Creating TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 65 MB memory) -> physical GPU (device: 0, name: GeForce GT 750M, pci bus id: 0000:01:00.0, compute capability: 3.0)
Device mapping:
/job:localhost/replica:0/task:0/device:GPU:0 -> device: 0, name: GeForce GT 750M, pci bus id: 0000:01:00.0, compute capability: 3.0
2018-02-19 22:22:14.697626: I tensorflow/core/common_runtime/direct_session.cc:297] Device mapping:
/job:localhost/replica:0/task:0/device:GPU:0 -> device: 0, name: GeForce GT 750M, pci bus id: 0000:01:00.0, compute capability: 3.0
For reference, here are the patches proposed in the comments:
--- a/tensorflow/workspace.bzl
+++ b/tensorflow/workspace.bzl
## -353,11 +353,11 ## def tf_workspace(path_prefix="", tf_repo_name=""):
tf_http_archive(
name = "protobuf_archive",
urls = [
- "https://mirror.bazel.build/github.com/google/protobuf/archive/396336eb961b75f03b25824fe86cf6490fb75e3a.tar.gz",
- "https://github.com/google/protobuf/archive/396336eb961b75f03b25824fe86cf6490fb75e3a.tar.gz",
+ "https://mirror.bazel.build/github.com/dtrebbien/protobuf/archive/50f552646ba1de79e07562b41f3999fe036b4fd0.tar.gz",
+ "https://github.com/dtrebbien/protobuf/archive/50f552646ba1de79e07562b41f3999fe036b4fd0.tar.gz",
],
- sha256 = "846d907acf472ae233ec0882ef3a2d24edbbe834b80c305e867ac65a1f2c59e3",
- strip_prefix = "protobuf-396336eb961b75f03b25824fe86cf6490fb75e3a",
+ sha256 = "eb16b33431b91fe8cee479575cee8de202f3626aaf00d9bf1783c6e62b4ffbc7",
+ strip_prefix = "protobuf-50f552646ba1de79e07562b41f3999fe036b4fd0",
)
--- a/tensorflow/workspace.bzl
+++ b/tensorflow/workspace.bzl
## -120,11 +120,11 ## def tf_workspace(path_prefix="", tf_repo_name=""):
tf_http_archive(
name = "eigen_archive",
urls = [
- "https://mirror.bazel.build/bitbucket.org/eigen/eigen/get/2355b229ea4c.tar.gz",
- "https://bitbucket.org/eigen/eigen/get/2355b229ea4c.tar.gz",
+ "https://mirror.bazel.build/bitbucket.org/dtrebbien/eigen/get/374842a18727.tar.gz",
+ "https://bitbucket.org/dtrebbien/eigen/get/374842a18727.tar.gz",
],
- sha256 = "0cadb31a35b514bf2dfd6b5d38205da94ef326ec6908fc3fd7c269948467214f",
- strip_prefix = "eigen-eigen-2355b229ea4c",
+ sha256 = "fa26e9b9ff3a2692b092d154685ec88d6cb84d4e1e895006541aff8603f15c16",
+ strip_prefix = "dtrebbien-eigen-374842a18727",
build_file = str(Label("//third_party:eigen.BUILD")),
)

Related

Derive qsv hwdevice from D3D11VA hwdevice using FFMPEG

I'm trying to derive a QSV hwcontext from D3D11VA device in order to encode d3d11 frames but I'm getting an error when calling av_hwdevice_ctx_create_derived.
buffer_t ctx_buf { av_hwdevice_ctx_alloc(AV_HWDEVICE_TYPE_D3D11VA) };
auto ctx = (AVD3D11VADeviceContext *)((AVHWDeviceContext *)ctx_buf->data)->hwctx;
std::fill_n((std::uint8_t *)ctx, sizeof(AVD3D11VADeviceContext), 0);
auto device = (ID3D11Device *)hwdevice_ctx->data;
device->AddRef();
ctx->device = device;
ctx->lock_ctx = (void *)1;
ctx->lock = do_nothing;
ctx->unlock = do_nothing;
auto err = av_hwdevice_ctx_init(ctx_buf.get());
and then I call
av_hwdevice_ctx_create_derived(&derive_hw_device_ctx, AV_HWDEVICE_TYPE_QSV, ctx_buf.get(), 0);
I'm seeing this in the log:
[AVHWDeviceContext # 000001de119a9b80] Initialize MFX session: API version is 1.35, implementation version is 1.30
[AVHWDeviceContext # 000001de119a9b80] Error setting child device handle: -16
Please let me know if you have any idea how to fix it or a different approach to encode d3d11 frames on QSV encoder.
Thank you.
OS: windows 10 64bits
CPU: Intel i5-8400
Graphics card: Nvidia GT1030 (has no hw encoder)
Adding this to d3d11 device solved the issue:
ID3D10Multithread *pMultithread;
status = device->QueryInterface(IID_ID3D10Multithread, (void **)&pMultithread);
if(SUCCEEDED(status)) {
pMultithread->SetMultithreadProtected(TRUE);
Release(pMultithread);
}

Composite RNDIS HID with MS OS 2.0 Descriptors

I'm developing a USB RNDIS and HID composite device. For the RNDIS device, I'm using MS OS 2.0 Descriptors described in the Microsoft document "Microsoft OS 2.0 Descriptors Specification" dated April, 2017 (linked at the bottom of https://learn.microsoft.com/en-us/windows-hardware/drivers/usbcon/microsoft-defined-usb-descriptors). I'm working with a Windows 10 host.
Both devices are recognized but only the HID device is recognized correctly; windows assigns the RNDIS device to be a serial port.
Here's some of the pertinents.
Device descriptor:
.bLength = 18
.bDescriptorType = 1
.bcdUSB = 0x0201
.bDeviceClass = 0xef
.bDeviceSubClass = 2
.bDeviceProtocol = 1
.bMaxPacketSize0 = 64
.idVendor = USB_DEVICE_VENDOR_ID,
.idProduct = USB_DEVICE_PRODUCT_ID,
.bcdDevice = (USB_DEVICE_MAJOR_VERSION << 8) | USB_DEVICE_MINOR_VERSION,
.iManufacturer = 1
.iProduct = 2
.iSerialNumber = 3
.bNumConfigurations = 1
Configuration descriptor
Configuration Header:
.bLength = 9
.bDescriptorType = 2
.wTotalLength = 100
.bNumInterfaces = 3
.bConfigurationValue = 1
.iConfiguration = 0,
.bmAttributes = 0xc0
.bMaxPower = 0xfa
Interface Association Descritpor
.bLength = 8
.bDescriptorType = 11
.bFirstInterface = 0
.bInterfaceCount = 2
.bFunctionClass = 2
.bFunctionSubClass = 2
.bFunctionProtocol = 0xff,
.iFunction = 0
RNDIS Descriptor
CDC IF Descriptor
.bLength = 9
.bDescriptorType = 4
.bInterfaceNumber = 0
.bAlternateSetting = 0,
.bNumEndpoints = 1
.bInterfaceClass = 2
.bInterfaceSubClass = 2
.bInterfaceProtocol = 0xff,
.iInterface = 0
[Remainder of RNDIS Control & Data interface]
HID Descriptor
[HID Descriptor details]
BOS Descriptor
Header
.bLength = 5
.bDescriptorType = 15
.wTotalLength = 33
.bNumDeviceCaps = 1
Platform Capabilities Descriptor
.bLength = 28
.bDescriptorType = 16
.bDevCapability = 5
.bReserved = 0,
.capabilityId = {0xdf, 0x60, 0xdd, 0xd8, 0x89, 0x45, 0xc7, 0x4c, 0x9c, 0xd2, 0x65, 0x9d, 0x9e, 0x64, 0x8a, 0x9f}
Windows Descriptor Set
.dwWindowsVersion = 0x06030000
.wLength = 46
.bMsVendorCode = 1
.bAltEnumCode = 0
MS Compatibility Descriptor:
Header
.wLength = 10
.wDescriptorType = 0
.dwWindowsVersion = 0x06030000
.wTotalLength = 46
Configuration Subset Header
.wLength = 8
.wDescriptorType = 1
.bConfigurationValue = 1
.bReserved = 0,
.wTotalLength = 36
Function Subset Header
.wLength = 8
.wDescriptorType = 2
.bFirstInterface = 0
.bReserved = 0,
.wSubsetLength = 28
Compatibility ID
.wLength = 20
.wDescriptorType = 3
.compatibleId = {'R', 'N', 'D', 'I', 'S', 0, 0, 0},
.subCompatibleId = {'5', '1', '6', '2', '0', '0', '1', 0}
If I build my device to be a strictly RNDIS device then all works as expected - the device is recognized by Windows as an RNDIS device; I do not install any drivers. Here's a summary of the modifications I make for an RNDIS-only device (needed size changes were also made):
Change the Device Descriptor device class fields
Remove the IAD & HID sections of the Configuration Descriptor
Reduce the Configuration Descriptor bNumInterfaces count to 2
Remove the Configuration Subset Header & Function Subset Header from the MS Compatibility Descriptor
Note that if I leave the Configuration Subset Header & Function Subset Header in the MS Compatibility Descriptor, Windows responds as above - assigns the RNDIS device to be a serial port.
I've tried various permutations but can't seem to get beyond this point. I have not yet tried creating an INF for a custom device, but that is something I want to avoid.
Any help or suggestions?
Thanks.
Try changing the bConfigurationValue in your Microsoft OS 2.0 Descriptors (specifically the Configuration Subset Header) from 1 to 0. It is actually an index in the array of configurations; it is not the same as the thing that is named bConfigurationValue in the USB 2.0 specification.
I had the same problem, as described here:
https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/ae64282c-3bc3-49af-8391-4d174479d9e7/microsoft-os-20-descriptors-not-working-on-an-interface-of-a-composite-usb-device?forum=wdk
I did not check the rest of your descriptors so there very well might be other issues.

What "deleted" means in /proc/$pid/maps?

I downloaded libhugetlbfs.so and have a simple test source :
int glbarr[1024*1024]={0} ;
int main()
{
char * ptr ;
ptr = (char *) malloc( 1024 * 1024 * 1 ) ;
printf(" press any key to go on \n");
getchar() ;
for(int idx=0;idx<100;idx++){
char strtmp[64] = {0} ;
sprintf(strtmp,"%020d",idx) ;
strcpy( ptr+1024*idx , strtmp ) ;
} //for
for(int idx=0;idx<100;idx++){
glbarr[idx] = idx ;
}
printf(" press any key to go on \n");
getchar() ;
} // main
then set the env :
export LD_PRELOAD=libhugetlbfs.so
export HUGETLB_MORECORE=yes
export HUGETLB_DEBUG=1
At last , execute test_malloc.exe :
INFO: Found pagesize 2048 kB
INFO: Detected page sizes:
INFO: Size: 2048 kB (default) Mount: /mnt/SharedMem_2M
INFO: Parsed kernel version: [3] . [10] . [0]
INFO: Feature private_reservations is present in this kernel
INFO: Feature noreserve_safe is present in this kernel
INFO: Feature map_hugetlb is present in this kernel
INFO: Kernel has MAP_PRIVATE reservations. Disabling heap prefaulting.
INFO: Kernel supports MAP_HUGETLB
INFO: HUGETLB_SHARE=0, sharing disabled
INFO: HUGETLB_NO_RESERVE=no, reservations enabled
INFO: Segment 0 (phdr 2): 0x400000-0x400a04 (filesz=0xa04) (prot = 0x5)
INFO: Segment 1 (phdr 3): 0x600de0-0xa01080 (filesz=0x274) (prot = 0x3)
DEBUG: symbol to copy at 0x601060: stdin
DEBUG: Total memsz = 0x400ca4, memsz of largest segment = 0x4002a0
INFO: libhugetlbfs version: 2.20
INFO: Mapped hugeseg at 0x2aaaaac00000. Copying 0xa04 bytes and 0 extra bytes from 0x400000...done
INFO: Prepare succeeded
INFO: Mapped hugeseg at 0x2aaaaac00000. Copying 0x274 bytes and 0x14 extra bytes from 0x600de0...done
INFO: Prepare succeeded
INFO: setup_morecore(): heapaddr = 0x1c00000
INFO: hugetlbfs_morecore(2101248) = ...
INFO: heapbase = 0x1c00000, heaptop = 0x1c00000, mapsize = 0, delta=2101248
INFO: Attempting to map 4194304 bytes
INFO: ... = 0x1c00000
INFO: hugetlbfs_morecore(0) = ...
INFO: heapbase = 0x1c00000, heaptop = 0x1e01000, mapsize = 400000, delta=-2093056
INFO: ... = 0x1e01000
and the /proc/pidof test_malloc.exe/maps :
00400000-00600000 r-xp 00000000 00:2b 6019488 /mnt/SharedMem_2M/libhugetlbfs.tmp.uI55WD (deleted)
00600000-00c00000 rw-p 00000000 00:2b 6123885 /mnt/SharedMem_2M/libhugetlbfs.tmp.VUALYM (deleted)
01c00000-02000000 rw-p 00000000 00:0d 6123886 /anon_hugepage (deleted)
numastat -m showes hugepage really in use for 8M ,
What bother me is what do "deleted" means in maps output ?!
either in /mnt/SharedMem_2M or /anon_hugepage
Edit :
and the debug information :
INFO: Found pagesize 2048 kB
INFO: Detected page sizes:
INFO: Size: 2048 kB (default) Mount: /mnt/SharedMem_2M
INFO: Parsed kernel version: [3] . [10] . [0]
INFO: Feature private_reservations is present in this kernel
INFO: Feature noreserve_safe is present in this kernel
INFO: Feature map_hugetlb is present in this kernel
INFO: Kernel has MAP_PRIVATE reservations. Disabling heap prefaulting.
INFO: Kernel supports MAP_HUGETLB
INFO: HUGETLB_SHARE=0, sharing disabled
INFO: HUGETLB_NO_RESERVE=no, reservations enabled
INFO: Segment 0 (phdr 3): 0x600de0-0xa01080 (filesz=0x274) (prot = 0x3)
DEBUG: symbol to copy at 0x601060: stdin
DEBUG: Total memsz = 0x4002a0, memsz of largest segment = 0x4002a0
INFO: libhugetlbfs version: 2.20
INFO: Mapped hugeseg at 0x2aaaaac00000. Copying 0x274 bytes and 0x14 extra bytes from 0x600de0...done
INFO: Prepare succeeded
INFO: setup_morecore(): heapaddr = 0x2200000
INFO: hugetlbfs_morecore(2101248) = ...
INFO: heapbase = 0x2200000, heaptop = 0x2200000, mapsize = 0, delta=2101248
INFO: Attempting to map 4194304 bytes
INFO: ... = 0x2200000
INFO: hugetlbfs_morecore(0) = ...
INFO: heapbase = 0x2200000, heaptop = 0x2401000, mapsize = 400000, delta=-2093056
INFO: ... = 0x2401000
and the maps :
00400000 default file=/home/marschen/test/posix-memalign/test_malloc.exe mapped=1 N0=1 kernelpagesize_kB=4
00600000 default file=/mnt/SharedMem_2M/libhugetlbfs.tmp.85Y41e\040(deleted) huge anon=1 dirty=1 N0=1 kernelpagesize_kB=2048
02200000 default file=/anon_hugepage\040(deleted) huge anon=1 dirty=1 N0=1 kernelpagesize_kB=2048
Temporary file deletion (unlinking) is normal for libhugetlbfs when it uses hugetlb fs pseudo filesystem (grep hugetlbfs /proc/filesystems) for getting mmaps backed with hugetlb pages.
For example, there is hugetlbfs_unlinked_fd function of libhugetlbfs/hugeutils.c
https://github.com/libhugetlbfs/libhugetlbfs/blob/e44180072b796c0e28e53c4d01ef6279caaa2a99/hugeutils.c#L1033
int hugetlbfs_unlinked_fd_for_size(long page_size)
{
const char *path;
char name[PATH_MAX+1];
int fd;
path = hugetlbfs_find_path_for_size(page_size);
..
name[sizeof(name)-1] = '\0';
strcpy(name, path);
strncat(name, "/libhugetlbfs.tmp.XXXXXX", sizeof(name)-1);
/* FIXME: deal with overflows */
fd = mkstemp64(name);
....
unlink(name);
return fd;
}
Temporary file name is randomly generated in mkstemp function; it also creates the file and opens it. Then this file is unlinked (man 2 unlink) from the filesystem (file name is marked as deleted in the directory, there is still inode and file data, but other programs can't access this file by name).
While unlinked fd is opened, it can be used to work with hugetlb mmap and to store data. Only when this fd is closed, file data will be actually deleted by fs.
Early unlinking of mktemp files is often used: When a file created with mkstemp() is deleted?
Some useful information can be also listed in HOWTO of libhugetlbfs project
https://github.com/libhugetlbfs/libhugetlbfs/blob/master/HOWTO

OpenCL command queue creation on OSX

I'm surprised by the behaviour of clCreateCommandQueue() on my macbook pro running OpenCL1.2.
I can supply a CL_QUEUE_PROFILING_ENABLE queue property without a problem.
But if I try to set the CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE property, the queue fails to be created.
I could understand if it were to fail with CL_INVALID_QUEUE_PROPERTIES, according to the API documentation. Yet, it fails with CL_INVALID_VALUE which makes on sense. It claims the property is invalid, instead of just merely being unsupported by device.
This happens on both the Iris GPU device, and the Intel CPU device.
The code:
context = clCreateContext( 0, 1, &device_id, opencl_notify, NULL, &err );
CHECK_CL
if ( !context )
{
LOGE( "Failed to create CL context. err=0x%x", err );
return 0;
}
cl_command_queue_properties queue_properties =
CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE |
CL_QUEUE_PROFILING_ENABLE |
0;
commands = clCreateCommandQueue( context, device_id, queue_properties, &err );
CHECK_CL
The output:
Found 1 OpenCL platforms.
Platform FULL_PROFILE OpenCL 1.2 (Sep 20 2014 22:01:02) Apple Apple had 2 devices:
Intel(R) Core(TM) i5-4278U CPU # 2.60GHz Intel(R) Core(TM) i5-4278U CPU # 2.60GHz with [4 units]
Iris Iris with [40 units]
ERR OpenCL called back with error: [CL_INVALID_VALUE] : OpenCL Error : clCreateCommandQueue failed: Device failed to create queue (cld returned: -35).
ERR OpenCL called back with error: [CL_INVALID_VALUE] : OpenCL Error : clCreateCommandQueue failed: Device failed to create queue: -30
CL_INVALID_VALUE
ERR Failed to create a command queue. err=0xffffffe2
I believe clGetDeviceInfo with CL_DEVICE_QUEUE_PROPERTIES on OS
X will return CL_QUEUE_PROFILING_ENABLE, but not CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, so it is apparently not supported.
The confusing error message could be a bug.

USB udc is always inactive

I have encountered a problem with a USB UDC linux driver. I'd like to connect our PXA320 based board to PC using g_ether and USB UDC.
Our board uses PXA320 with Linux-2.6.32 kernel.
I have enabled pxa27x UDC and g_ether on menuconfig and built kernel successfully.
But after I run "ifup usb0" and plug in the USB cable, PC detects the USB device (since D+ pull-up resistor is enabled) and sends "GET DESCRIPTOR" to the device. But the USB device(our board) does NOT respond.
I dumped some register values and found that the UDCCR is 0x1 which means UDC is enabled but is inactive.
The following are the debug messages I got:
ifup usb0
+++ ether - init
++++ usb_composite_register
+++ usb_gadget_register_driver
+++ dplus_pullup, on = 1
++++ composite_bind
+++ pxa_ep_alloc_request
--- pxa_ep_alloc_request
+++ eth_bind
g_ether gadget: using random self ethernet address
g_ether gadget: using random host ethernet address
usb0: MAC d6:81:e9:fa:0c:66
usb0: HOST MAC 7a:58:58:9a:bb:be
+++ eth_bind - CDC Subset/SAFE
+++ eth_bind - RNDIS plus ECM-or-Subset
+++ eth_bind - manufacturer = Linux 2.6.32.9 with pxa27x_udc
adding config #2 'RNDIS'/bf0059c0
adding 'rndis'/c7fcdf00 to config 'RNDIS'/bf0059c0
++++ composite_uevent
+++ usb_interface_id
--- usb_interface_id - id = 0
+++ usb_interface_id
--- usb_interface_id - id = 1
+++ pxa_ep_alloc_request
--- pxa_ep_alloc_request
adding config #1 'CDC Subset/SAFE'/bf00594c
+++ eth_do_config
adding 'cdc_subset'/c7fcdd80 to config 'CDC Subset/SAFE'/bf00594c
++++ composite_uevent
+++ usb_interface_id
--- usb_interface_id - id = 0
g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
Memorial Day 2008, version:
g_ether gadget: g_ether ready
registered gadget driver 'g_ether'
+++ should_enable_udc
--- should_enable_udc, put_on = 1
+++ udc_enable
+++ udc_clear_mask_UDCCR - udccr = 0x0, mask = 0x1
--- udc_clear_mask_UDCCR - udccr = 0x0
clk_pxa3xx_cken_enable - clk->cken = 0x14
+++ ep0_idle
+++ set_ep0state
state=WAIT_FOR_SETUP->WAIT_FOR_SETUP, udccsr0=0x000, udcbcr=0
+++ udc_set_mask_UDCCR
+++ ep_write_UDCCSR
+++ pio_irq_enable, index = 0
--- udc_enable
UDCCR(0x0) = 0x1
UDCICR0(0x4) = 0x3
UDCICR1(0x8) = 0xb8000000
UDCISR0(0xc) = 0x0
UDCISR1(0x10) = 0x0
UDCFNR(0x14) = 0x0
UDCOTGICR(0x18) = 0x0
UP2OCR(0x20) = 0xa0
UP3OCR(0x24) = 0x0
(0x100) = 0x200
(0x200) = 0x0
(0x300) = 0x43881454
(0x400) = 0x0
ICPR = 0x0
ICPR2 = 0x0
ICIP = 0x0
ICIP2 = 0x0
ICFP = 0x0
ICFP2 = 0x0
ICMR = 0x6b24c08
ICMR2 = 0x2000
ICLR = 0x0
ICLR2 = 0x0
ICCR = 0x1
ACCR = 0x0000321f
ACSR = 0x3003321f
AICSR = 0x0
CKEN_A = 0xffbfffff
CKEN_B = 0xffffffff
From the debug message, I can see that UDC clock is enabled (CKEN_A bit20), UDC interrupt is enabled (ICMR bit11) nad UDC is enabled (UDCCR bit0). But UDC is inactive(UDCCR bit1).
I have verified hardware by running Windows CE OS on the board and I could connect to PC via activesync.
I compared UDC registers between CE OS and Linux OS. CE version shows UDCCR is 0x3 which means UDC is active.
I don't understand why UDC is inactive in Linux. That bit in UDCCR is read only.
Could anyone give me some hints on how to solve this issue?
Thanks in advance

Resources