static int __init usb_android_init(void)
{
#if defined(CONFIG_USB_ANDROID) || defined(CONFIG_USB_ANDROID_MODULE)

	u32 prod_id[4];

	get_dieid(prod_id);

	if (machine_is_archos_a5s() || machine_is_archos_a5st()) {
		sprintf(android_usb_pdata.serial_number, "A5S-%08X-%08X-%08X-%08X", prod_id[0],prod_id[1],prod_id[2],prod_id[3]);
	} else if ( machine_is_archos_a5h() ) {
		sprintf(android_usb_pdata.serial_number, "A5H-%08X-%08X-%08X-%08X", prod_id[0],prod_id[1],prod_id[2],prod_id[3]);
	} else {
		sprintf(android_usb_pdata.serial_number, "A5x-%08X-%08X-%08X-%08X", prod_id[0],prod_id[1],prod_id[2],prod_id[3]);
	}

	printk(KERN_ERR "registering Android USB device (%s)\n", android_usb_pdata.serial_number);

	if (platform_device_register(&android_usb_device) < 0) {
		printk(KERN_ERR "Unable to register Android USB device\n");
		return -ENODEV;
	}
#endif

	return 0;
}
Exemplo n.º 2
0
static ssize_t show_dieid(struct sysdev_class* cls, 
		struct sysdev_class_attribute *attr, char* buf)
{
	u32 die_id[4];
	get_dieid(die_id);
	return sprintf(buf, "%08x%08x%08x%08x\n", 
			die_id[0],die_id[1],die_id[2],die_id[3]); 
}
Exemplo n.º 3
0
static int __init usb_android_init(void)
{
#if defined(CONFIG_USB_ANDROID) || defined(CONFIG_USB_ANDROID_MODULE)

	u32 prod_id[4];

	get_dieid(prod_id);

	if (machine_is_archos_a32()) {
		sprintf(android_usb_pdata.serial_number, "A32-%08X-%08X-%08X-%08X", prod_id[0],prod_id[1],prod_id[2],prod_id[3]);
		android_usb_pdata.product_id = 0x1416;
		android_usb_pdata.product_name = A32;
		android_usb_pdata.nluns = 1;
		usb_mass_storage_pdata.product = A32;
	} else if ( machine_is_archos_a28() ) {
		sprintf(android_usb_pdata.serial_number, "A28-%08X-%08X-%08X-%08X", prod_id[0],prod_id[1],prod_id[2],prod_id[3]);
		android_usb_pdata.product_id = 0x1415;
		android_usb_pdata.product_name = A28;
		android_usb_pdata.nluns = 1;
		usb_mass_storage_pdata.product = A28;
	} else if ( machine_is_archos_a35() ) {
		sprintf(android_usb_pdata.serial_number, "A35-%08X-%08X-%08X-%08X", prod_id[0],prod_id[1],prod_id[2],prod_id[3]);
		android_usb_pdata.product_id = 0x1424;
		android_usb_pdata.product_name = A35;
		android_usb_pdata.nluns = 2;
		usb_mass_storage_pdata.product = A35;
	} else if ( machine_is_archos_a35dm() ) {
		sprintf(android_usb_pdata.serial_number, "A35DM-%08X-%08X-%08X-%08X", prod_id[0],prod_id[1],prod_id[2],prod_id[3]);
		android_usb_pdata.product_id = 0x1425;
		android_usb_pdata.product_name = A35DM;
		android_usb_pdata.nluns = 2;
		usb_mass_storage_pdata.product = A35DM;
	} else if ( machine_is_archos_a43() ) {
		sprintf(android_usb_pdata.serial_number, "A43-%08X-%08X-%08X-%08X", prod_id[0],prod_id[1],prod_id[2],prod_id[3]);
		android_usb_pdata.product_id = 0x1417;
		android_usb_pdata.product_name = A43;
		android_usb_pdata.nluns = 2;
		usb_mass_storage_pdata.product = A43;
	} else if ( machine_is_archos_a101it() ) {
		sprintf(android_usb_pdata.serial_number, "A10-%08X-%08X-%08X-%08X", prod_id[0],prod_id[1],prod_id[2],prod_id[3]);
		android_usb_pdata.product_id = 0x1419;
		android_usb_pdata.product_name = A10;
		android_usb_pdata.nluns = 2;
		usb_mass_storage_pdata.product = A10;
	} else if ( machine_is_archos_a70s() ||  machine_is_archos_a70h() ) {
		sprintf(android_usb_pdata.serial_number, "A70-%08X-%08X-%08X-%08X", prod_id[0],prod_id[1],prod_id[2],prod_id[3]);
		android_usb_pdata.product_id = 0x1420;
		if( machine_is_archos_a70s()){
			android_usb_pdata.product_id = 0x1420;
			android_usb_pdata.product_name = A70S;
			android_usb_pdata.nluns = 2;
			usb_mass_storage_pdata.product = A70S;
		}else{
			android_usb_pdata.product_id = 0x1422;
			android_usb_pdata.product_name = A70H;
			android_usb_pdata.nluns = 1;
			usb_mass_storage_pdata.product = A70H;
		}
	} else if ( machine_is_archos_a32sd() ) {
		sprintf(android_usb_pdata.serial_number, "A32-%08X-%08X-%08X-%08X", prod_id[0],prod_id[1],prod_id[2],prod_id[3]);
		android_usb_pdata.product_id = 0x1423;
		android_usb_pdata.product_name = A32SD;
		android_usb_pdata.nluns = 2;
		usb_mass_storage_pdata.product = A32SD;
	} else {
		sprintf(android_usb_pdata.serial_number, "A5x-%08X-%08X-%08X-%08X", prod_id[0],prod_id[1],prod_id[2],prod_id[3]);
	}
	
	if ( machine_charges_from_USB() ) {
		android_usb_pdata.bmAttributes = USB_CONFIG_ATT_ONE;
		android_usb_pdata.bMaxPower = 250; /* 500mA */
	} else {
		android_usb_pdata.bmAttributes	= USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER,
		android_usb_pdata.bMaxPower	= CONFIG_USB_GADGET_VBUS_DRAW / 2;
	}
	
	printk(KERN_ERR "registering Android USB device (%s)\n", android_usb_pdata.serial_number);

	if (platform_device_register(&android_usb_device) < 0) {
		printk(KERN_ERR "Unable to register Android USB device\n");
		return -ENODEV;
	}
	printk(KERN_ERR "registering Android USB mass storage device  (%s)\n", android_usb_pdata.serial_number);
	if (platform_device_register(&android_usb_mass_storage) < 0) {
		printk(KERN_ERR "Unable to register Android USB mass storage device\n");
		return -ENODEV;
	}
#endif

	return 0;
}
Exemplo n.º 4
0
int misc_init_r(void)
{
	unsigned char keypad_matrix[64] = { 0 };
	char serial_string[17] = { 0 };
	char reboot_mode[2] = { 0 };
	u32 dieid[4] = { 0 };
	unsigned char keys[3];
	unsigned char data = 0;

	/* Power button reset init */

	twl4030_power_reset_init();

	/* Keypad */

	twl4030_keypad_scan((unsigned char *)&keypad_matrix);

	keys[0] = twl4030_keypad_key((unsigned char *)&keypad_matrix, 0, 0);
	keys[1] = twl4030_keypad_key((unsigned char *)&keypad_matrix, 0, 1);
	keys[2] = twl4030_keypad_key((unsigned char *)&keypad_matrix, 0, 2);

	/* Reboot mode */

	reboot_mode[0] = omap_reboot_mode();

	if (keys[0])
		reboot_mode[0] = 'r';
	else if (keys[1])
		reboot_mode[0] = 'b';

	if (reboot_mode[0] > 0 && isascii(reboot_mode[0])) {
		if (!getenv("reboot-mode"))
			setenv("reboot-mode", (char *)reboot_mode);

		omap_reboot_mode_clear();
	} else {
		/*
		 * When not rebooting, valid power on reasons are either the
		 * power button, charger plug or USB plug.
		 */

		data |= twl4030_input_power_button();
		data |= twl4030_input_charger();
		data |= twl4030_input_usb();

		if (!data)
			twl4030_power_off();
	}

	/* Serial number */

	get_dieid((u32 *)&dieid);

	if (!getenv("serial#")) {
		snprintf(serial_string, sizeof(serial_string),
			"%08x%08x", dieid[0], dieid[3]);

		setenv("serial#", serial_string);
	}

	/* MUSB */

	musb_register(&musb_platform_data, &musb_board_data, (void *)MUSB_BASE);

	return 0;
}
Exemplo n.º 5
0
/*
 * Routine: misc_init_r
 * Description: Configure board specific parts
 */
int misc_init_r(void)
{
	struct gpio *gpio5_base = (struct gpio *)OMAP34XX_GPIO5_BASE;
	struct gpio *gpio6_base = (struct gpio *)OMAP34XX_GPIO6_BASE;
	struct control_prog_io *prog_io_base = (struct control_prog_io *)OMAP34XX_CTRL_BASE;
	bool generate_fake_mac = false;
	u32 value;

	/* Enable i2c2 pullup resisters */
	value = readl(&prog_io_base->io1);
	value &= ~(PRG_I2C2_PULLUPRESX);
	writel(value, &prog_io_base->io1);

	printf("WINGZ energy \nIoT group \n CDAC Bangalore\n");
	setenv("musb", "musb_hdrc.fifo_mode=5");
	MUX_WINGZ_C();
	/* Set VAUX2 to 1.8V for EHCI PHY */
	twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
					TWL4030_PM_RECEIVER_VAUX2_VSEL_18,
					TWL4030_PM_RECEIVER_VAUX2_DEV_GRP,
					TWL4030_PM_RECEIVER_DEV_GRP_P1);
	

	
	if (expansion_config.content == 1)
		setenv(expansion_config.env_var, expansion_config.env_setting);

	twl4030_power_init();
	twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON);
	

	/* Set GPIO states before they are made outputs */
	writel(GPIO23 | GPIO10 | GPIO8 | GPIO2 | GPIO1,
		&gpio6_base->setdataout);
	writel(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 |
		GPIO15 | GPIO14 | GPIO13 | GPIO12, &gpio5_base->setdataout);

	/* Configure GPIOs to output */
	writel(~(GPIO23 | GPIO10 | GPIO8 | GPIO2 | GPIO1), &gpio6_base->oe);
	writel(~(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 |
		GPIO15 | GPIO14 | GPIO13 | GPIO12), &gpio5_base->oe);

	dieid_num_r();

#ifdef CONFIG_VIDEO_OMAP3
	gpio_request(170, "dvi");
	gpio_direction_output(170, 0);
	gpio_set_value(170, 1);

	//beagle_display_init();
	omap3_dss_venc_config(&venc_config_std_tv, VENC_HEIGHT, VENC_WIDTH);
	omap3_dss_panel_config(&dvid_cfg);


	omap3_dss_enable();
#endif

#ifdef CONFIG_USB_MUSB_OMAP2PLUS
	musb_register(&musb_plat, &musb_board_data, (void *)MUSB_BASE);
#endif

	if (generate_fake_mac) {
		u32 id[4];

		get_dieid(id);
		usb_fake_mac_from_die_id(id);
	}

	return 0;
}
Exemplo n.º 6
0
/*
 * Routine: misc_init_r
 * Description: Configure board specific parts
 */
int misc_init_r(void)
{
	struct gpio *gpio5_base = (struct gpio *)OMAP34XX_GPIO5_BASE;
	struct gpio *gpio6_base = (struct gpio *)OMAP34XX_GPIO6_BASE;
	struct control_prog_io *prog_io_base = (struct control_prog_io *)OMAP34XX_CTRL_BASE;
	bool generate_fake_mac = false;
	u32 value;

	/* Enable i2c2 pullup resisters */
	value = readl(&prog_io_base->io1);
	value &= ~(PRG_I2C2_PULLUPRESX);
	writel(value, &prog_io_base->io1);

	switch (get_board_revision()) {
	case REVISION_AXBX:
		printf("Beagle Rev Ax/Bx\n");
		setenv("beaglerev", "AxBx");
		break;
	case REVISION_CX:
		printf("Beagle Rev C1/C2/C3\n");
		setenv("beaglerev", "Cx");
		MUX_BEAGLE_C();
		break;
	case REVISION_C4:
		printf("Beagle Rev C4\n");
		setenv("beaglerev", "C4");
		MUX_BEAGLE_C();
		/* Set VAUX2 to 1.8V for EHCI PHY */
		twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
					TWL4030_PM_RECEIVER_VAUX2_VSEL_18,
					TWL4030_PM_RECEIVER_VAUX2_DEV_GRP,
					TWL4030_PM_RECEIVER_DEV_GRP_P1);
		break;
	case REVISION_XM_AB:
		printf("Beagle xM Rev A/B\n");
		setenv("beaglerev", "xMAB");
		MUX_BEAGLE_XM();
		/* Set VAUX2 to 1.8V for EHCI PHY */
		twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
					TWL4030_PM_RECEIVER_VAUX2_VSEL_18,
					TWL4030_PM_RECEIVER_VAUX2_DEV_GRP,
					TWL4030_PM_RECEIVER_DEV_GRP_P1);
		generate_fake_mac = true;
		break;
	case REVISION_XM_C:
		printf("Beagle xM Rev C\n");
		setenv("beaglerev", "xMC");
		MUX_BEAGLE_XM();
		/* Set VAUX2 to 1.8V for EHCI PHY */
		twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
					TWL4030_PM_RECEIVER_VAUX2_VSEL_18,
					TWL4030_PM_RECEIVER_VAUX2_DEV_GRP,
					TWL4030_PM_RECEIVER_DEV_GRP_P1);
		generate_fake_mac = true;
		break;
	default:
		printf("Beagle unknown 0x%02x\n", get_board_revision());
		MUX_BEAGLE_XM();
		/* Set VAUX2 to 1.8V for EHCI PHY */
		twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VAUX2_DEDICATED,
					TWL4030_PM_RECEIVER_VAUX2_VSEL_18,
					TWL4030_PM_RECEIVER_VAUX2_DEV_GRP,
					TWL4030_PM_RECEIVER_DEV_GRP_P1);
		generate_fake_mac = true;
	}

	switch (get_expansion_id()) {
	case TINCANTOOLS_ZIPPY:
		printf("Recognized Tincantools Zippy board (rev %d %s)\n",
			expansion_config.revision,
			expansion_config.fab_revision);
		MUX_TINCANTOOLS_ZIPPY();
		setenv("buddy", "zippy");
		break;
	case TINCANTOOLS_ZIPPY2:
		printf("Recognized Tincantools Zippy2 board (rev %d %s)\n",
			expansion_config.revision,
			expansion_config.fab_revision);
		MUX_TINCANTOOLS_ZIPPY();
		setenv("buddy", "zippy2");
		break;
	case TINCANTOOLS_TRAINER:
		printf("Recognized Tincantools Trainer board (rev %d %s)\n",
			expansion_config.revision,
			expansion_config.fab_revision);
		MUX_TINCANTOOLS_ZIPPY();
		MUX_TINCANTOOLS_TRAINER();
		setenv("buddy", "trainer");
		break;
	case TINCANTOOLS_SHOWDOG:
		printf("Recognized Tincantools Showdow board (rev %d %s)\n",
			expansion_config.revision,
			expansion_config.fab_revision);
		/* Place holder for DSS2 definition for showdog lcd */
		setenv("defaultdisplay", "showdoglcd");
		setenv("buddy", "showdog");
		break;
	case KBADC_BEAGLEFPGA:
		printf("Recognized KBADC Beagle FPGA board\n");
		MUX_KBADC_BEAGLEFPGA();
		setenv("buddy", "beaglefpga");
		break;
	case LW_BEAGLETOUCH:
		printf("Recognized Liquidware BeagleTouch board\n");
		setenv("buddy", "beagletouch");
		break;
	case BRAINMUX_LCDOG:
		printf("Recognized Brainmux LCDog board\n");
		setenv("buddy", "lcdog");
		break;
	case BRAINMUX_LCDOGTOUCH:
		printf("Recognized Brainmux LCDog Touch board\n");
		setenv("buddy", "lcdogtouch");
		break;
	case BBTOYS_WIFI:
		printf("Recognized BeagleBoardToys WiFi board\n");
		MUX_BBTOYS_WIFI()
		setenv("buddy", "bbtoys-wifi");
		break;;
	case BBTOYS_VGA:
		printf("Recognized BeagleBoardToys VGA board\n");
		break;;
	case BBTOYS_LCD:
		printf("Recognized BeagleBoardToys LCD board\n");
		break;;
	case BCT_BRETTL3:
		printf("Recognized bct electronic GmbH brettl3 board\n");
		break;
	case BCT_BRETTL4:
		printf("Recognized bct electronic GmbH brettl4 board\n");
		break;
	case LSR_COM6L_ADPT:
		printf("Recognized LSR COM6L Adapter Board\n");
		MUX_BBTOYS_WIFI()
		setenv("buddy", "lsr-com6l-adpt");
		break;
	case BEAGLE_NO_EEPROM:
		printf("No EEPROM on expansion board\n");
		setenv("buddy", "none");
		break;
	default:
		printf("Unrecognized expansion board: %x\n",
			expansion_config.device_vendor);
		setenv("buddy", "unknown");
	}

	if (expansion_config.content == 1)
		setenv(expansion_config.env_var, expansion_config.env_setting);

	twl4030_power_init();
	switch (get_board_revision()) {
	case REVISION_XM_AB:
		twl4030_led_init(TWL4030_LED_LEDEN_LEDBON);
		break;
	default:
		twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON);
		break;
	}

	/* Set GPIO states before they are made outputs */
	writel(GPIO23 | GPIO10 | GPIO8 | GPIO2 | GPIO1,
		&gpio6_base->setdataout);
	writel(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 |
		GPIO15 | GPIO14 | GPIO13 | GPIO12, &gpio5_base->setdataout);

	/* Configure GPIOs to output */
	writel(~(GPIO23 | GPIO10 | GPIO8 | GPIO2 | GPIO1), &gpio6_base->oe);
	writel(~(GPIO31 | GPIO30 | GPIO29 | GPIO28 | GPIO22 | GPIO21 |
		GPIO15 | GPIO14 | GPIO13 | GPIO12), &gpio5_base->oe);

	dieid_num_r();

#ifdef CONFIG_VIDEO_OMAP3
	beagle_dvi_pup();
	beagle_display_init();
	omap3_dss_enable();
#endif

#ifdef CONFIG_USB_MUSB_OMAP2PLUS
	musb_register(&musb_plat, &musb_board_data, (void *)MUSB_BASE);
#endif

	if (generate_fake_mac) {
		u32 id[4];

		get_dieid(id);
		usb_fake_mac_from_die_id(id);
	}

	return 0;
}