int load_image(unsigned device, unsigned start, unsigned count, void *data) { int (*rom_get_mem_driver)(struct mem_driver **io, u32 type); struct mem_driver *io = 0; struct mem_device local_md_device, *md = 0; struct read_desc rd; u16 options; u32 base; int z; if (get_omap_rev() >= OMAP_4460_ES1_DOT_0) base = PUBLIC_API_BASE_4460; else base = PUBLIC_API_BASE_4430; rom_get_mem_driver = API(base + PUBLIC_GET_DRIVER_MEM_OFFSET); z = rom_get_mem_driver(&io, device); if (z) return -1; md = &local_md_device; memset(md, 0, sizeof(struct mem_device)); options = 0; // 1 = init phoenix pmic? md->initialized = 0; md->device_type = device; md->xip_device = 0; md->search_size = 0; md->base_address = 0; md->hs_toc_mask = 0; md->gp_toc_mask = 0; md->boot_options = &options; md->device_data = (void*) 0x80000000; memset(md->device_data, 0, 2500); z = io->init(md); if (z) return -1; rd.sector_start = start; rd.sector_count = count; rd.destination = data; z = io->read(md, &rd); return 0; }
int usb_open(struct usb *usb) { int (*rom_get_per_driver)(struct per_driver **io, u32 device_type); int (*rom_get_per_device)(struct per_handle **rh); struct per_handle *boot; int n; u32 base; memset(usb, 0, sizeof(*usb)); if (get_omap_rev() >= OMAP_4460_ES1_DOT_0) base = PUBLIC_API_BASE_4460; else base = PUBLIC_API_BASE_4430; rom_get_per_driver = API(base + PUBLIC_GET_DRIVER_PER_OFFSET); rom_get_per_device = API(base + PUBLIC_GET_DEVICE_PER_OFFSET); n = rom_get_per_device(&boot); if (n) return n; if ((boot->device_type != DEVICE_USB) && (boot->device_type != DEVICE_USBEXT)) return -1; n = rom_get_per_driver(&usb->io, boot->device_type); if (n) return n; usb->dread.xfer_mode = boot->xfer_mode; usb->dread.options = boot->options; usb->dread.device_type = boot->device_type; usb->dwrite.xfer_mode = boot->xfer_mode; usb->dwrite.options = boot->options; usb->dwrite.device_type = boot->device_type; return 0; }