/* init for the Master*/ void misc_init_r_dec_win(void) { #if defined(MV_INCLUDE_USB) { char *env; env = getenv("usb0Mode"); if((!env) || (strcmp(env,"device") == 0) || (strcmp(env,"Device") == 0) ) { printf("USB 0: Device Mode\n"); mvSysUsbInit(0, MV_FALSE); } else { printf("USB 0: Host Mode\n"); mvSysUsbInit(0, MV_TRUE); } } #endif/* #if defined(MV_INCLUDE_USB) */ #if defined(MV_INCLUDE_XOR) mvSysXorInit(); #endif #if defined(MV_INCLUDE_CLK_PWR_CNTRL) mv_set_power_scheme(); #endif return; }
void misc_init_r_dec_win(void) { char *env; #if defined(MV_INCLUDE_USB) mvSysUsbInit(); /* initialize USB2.0 / USB3.0 */ #endif #if defined(MV_INCLUDE_XOR) mvSysXorInit(); #endif #if defined(MV_INCLUDE_CLK_PWR_CNTRL) env = getenv("enaClockGating"); if ((strcmp(env, "yes") == 0) || (strcmp(env, "Yes") == 0)) mv_set_power_scheme(); #endif }
int mv_usb_resume(int dev) { int status, isHost; char *name_ptr; if (MV_FALSE == mvCtrlPwrClckGet(USB_UNIT_ID, dev)) { printk(KERN_DEBUG "\nWarning Integrated USB %d is Powered Off\n", dev); return -EINVAL; } /* Check if this USB is mapped to this AMP group - YY */ if(MV_FALSE == mvUnitMapIsMine(USB0 + dev)) return -EINVAL; isHost = mvIsUsbHost & (1 << dev); name_ptr = isHost ? usb_host_name : usb_dev_name; printk(KERN_DEBUG "registered dev#%d as a %s\n", dev, name_ptr); status = mvSysUsbInit(dev, isHost); return status; }
static int __init mv_usb_init(void) { int status, dev, num, isHost; char* name_ptr; struct platform_device* mv_usb_dev_ptr; int irq_num[3] = { IRQ_AURORA_USB0, IRQ_AURORA_USB1, IRQ_AURORA_USB2}; num = mvCtrlUsbMaxGet(); if (num > MAX_USB_PORTS) { printk("WARNING: Limited USB ports number to %d\n", MAX_USB_PORTS); num = MAX_USB_PORTS; } for(dev=0; dev<num; dev++) { if (MV_FALSE == mvCtrlPwrClckGet(USB_UNIT_ID, dev)) { printk("\nWarning Integrated USB %d is Powered Off\n",dev); continue; } /* Check if this USB is mapped to this AMP group - YY */ if(MV_FALSE == mvUnitMapIsMine(USB0 + dev)) { continue; } isHost = mvIsUsbHost & (1 << dev); if(isHost) name_ptr = usb_host_name; else name_ptr = usb_dev_name; printk("registered dev#%d asa %s\n",dev,name_ptr); status = mvSysUsbInit(dev, isHost); mv_usb_dev_ptr = kmalloc(sizeof(struct platform_device), GFP_KERNEL); if(mv_usb_dev_ptr == NULL) { printk("Can't allocate platform_device structure - %d bytes\n", sizeof(struct platform_device) ); return 1; } memset(mv_usb_dev_ptr, 0, sizeof(struct platform_device) ); mv_usb_dev_ptr->name = name_ptr; mv_usb_dev_ptr->id = dev; mv_usb_dev_ptr->num_resources = 2; mv_usb_dev_ptr->resource = (struct resource*)kmalloc(2*sizeof(struct resource), GFP_KERNEL); if(mv_usb_dev_ptr->resource == NULL) { printk("Can't allocate 2 resource structure - %d bytes\n", 2*sizeof(struct resource) ); kfree(mv_usb_dev_ptr); return 1; } memset(mv_usb_dev_ptr->resource, 0, 2*sizeof(struct resource)); mv_usb_dev_ptr->resource[0].start = ( INTER_REGS_BASE | MV_USB_CORE_CAP_LENGTH_REG(dev)); mv_usb_dev_ptr->resource[0].end = ((INTER_REGS_BASE | MV_USB_CORE_CAP_LENGTH_REG(dev)) + 4096); mv_usb_dev_ptr->resource[0].flags = IORESOURCE_DMA; mv_usb_dev_ptr->resource[1].start = irq_num[dev]; mv_usb_dev_ptr->resource[1].flags = IORESOURCE_IRQ; mv_usb_dev_ptr->dev.dma_mask = kmalloc(sizeof(u64), GFP_KERNEL); *mv_usb_dev_ptr->dev.dma_mask = MV_USB_DMA_MASK; mv_usb_dev_ptr->dev.coherent_dma_mask = ~0; mv_usb_dev_ptr->dev.release = mv_usb_release; dev_set_name(&mv_usb_dev_ptr->dev, "%s", usb_bus_name); printk("Marvell USB %s controller #%d: %p\n", isHost ? "EHCI Host" : "Gadget", dev, mv_usb_dev_ptr); status = platform_device_register(mv_usb_dev_ptr); if (status) { printk("Can't register Marvell USB EHCI controller #%d, status=%d\n", dev, status); return status; } } return 0; }