If I understand correctly, you are trying to write a USB mass storage *device* that runs on the 51JM128?
I have source code for my USB host and device driver here if it helps: http://www.cpustick.com/downloads/skeleton.zip (Please note that there is a bug in the 51JM128 *host* driver in that archive that I have fixed; I attached my latest usb.c to this post if you need that, but in general it is safest to use files from the zip as they have been more fully tested.)
The only really 51JM128 specific code I needed was related to pull-up management and peripheral reset/power-on (the zip archive has a power-on bug in host mode). Oh, and I renamed all of the 51JM128 register names to match those of the CFV2.
Are you receiving a USB "reset" interrupt when the host tries to enumerate you? Is your BDT properly 512 byte aligned? Are you communicating with the SIE in "little endian" (i.e., byte swapped) mode?
-- Rich
rich@testardi.com