int __init archos_tvout_extdac_init(struct omap_dss_platform_data *disp_data)
{
	const struct archos_display_config *disp_cfg;
	int ret = -ENODEV;
	
	disp_cfg = omap_get_config(ARCHOS_TAG_DISPLAY, struct archos_display_config);
	if (disp_cfg == NULL)
		return ret;

	if (hardware_rev >= disp_cfg->nrev) {
		printk(KERN_DEBUG "archos_tvout_extdac_init: hardware_rev (%i) >= nrev (%i)",
				hardware_rev, disp_cfg->nrev);
		return ret;
	}
	
	extdac_platform_data.cpld_aux = disp_cfg->rev[hardware_rev].cpld_aux;
	extdac_platform_data.hdmi_dac = disp_cfg->rev[hardware_rev].hdmi_dac;
	extdac_platform_data.disp_sel = disp_cfg->rev[hardware_rev].disp_select;
	
	GPIO_INIT_OUTPUT(extdac_platform_data.hdmi_dac);
	GPIO_INIT_OUTPUT(extdac_platform_data.disp_sel);
	GPIO_INIT_OUTPUT(extdac_platform_data.cpld_aux);
	
	ret = i2c_register_board_info(3, adv734x_i2c_board_info, 
			ARRAY_SIZE(adv734x_i2c_board_info));
	if (ret < 0)
		pr_err("archos_tvout_extdac_init: unable to register adv743x board info\n");

	disp_data->displays[disp_data->num_displays] = &extdac_panel;
	disp_data->num_displays++;

	return 0;
}
static int panel_init(struct omap_display_data *ddata)
{
	pr_debug("panel_init [%s]\n", ddata->panel_name);

	GPIO_INIT_OUTPUT(display_gpio.lcd_pwon);
	GPIO_INIT_OUTPUT(display_gpio.lcd_rst);
	GPIO_INIT_OUTPUT(display_gpio.lcd_pci);
	GPIO_INIT_OUTPUT(display_gpio.disp_select);
	GPIO_INIT_OUTPUT(display_gpio.cpldreset);

#if !defined(CONFIG_FB_OMAP_BOOTLOADER_INIT)
	if (GPIO_EXISTS(display_gpio.lcd_pwon))
		omap_set_gpio_dataout( GPIO_PIN(display_gpio.lcd_pwon), 0);
	if (GPIO_EXISTS(display_gpio.lcd_rst))
		omap_set_gpio_dataout( GPIO_PIN(display_gpio.lcd_rst), 0);
	if (GPIO_EXISTS(display_gpio.lcd_pci))
		omap_set_gpio_dataout( GPIO_PIN(display_gpio.lcd_pci), 0);

	/* reset and enable the CPLD */
	if (GPIO_EXISTS(display_gpio.cpldreset))
		omap_set_gpio_dataout( GPIO_PIN(display_gpio.cpldreset), 0);
	mdelay(2);
	if (GPIO_EXISTS(display_gpio.cpldreset))
		omap_set_gpio_dataout( GPIO_PIN(display_gpio.cpldreset), 1);
#endif
	return 0;
}
int __init  archos_usb2sata_init(void) {
	int ret;
	const struct archos_sata_config *sata_cfg;
	sata_cfg = omap_get_config( ARCHOS_TAG_SATA, struct archos_sata_config );
	if (sata_cfg == NULL) {
		printk(KERN_DEBUG "archos_sata_init: no board configuration found\n");
		return -ENODEV;
	}
	if (hardware_rev >= sata_cfg->nrev) {
		printk(KERN_DEBUG "archos_sata_init: hardware_rev (%i) >= nrev (%i)\n",
				hardware_rev, sata_cfg->nrev);
		return -ENODEV;
	}

	printk(KERN_DEBUG "archos_usb2sata_init\n");

	clkout1 = clk_get(NULL, "sys_clkout1");
	if (IS_ERR(clkout1)) {
		printk(KERN_ERR "clk_get(sys_clkout1) failed\n");
		return PTR_ERR(clkout1);
	}

	/* sysfs setup */
	ret = platform_device_register(&usb2sata_device);
	if (ret)
		return ret;

	/* SATA bridge */
	gpio_sata_pwron = sata_cfg->rev[hardware_rev].sata_power;
	
	ret = device_create_file(&usb2sata_device.dev, &dev_attr_satavcc);
	if (ret == 0) {
		printk(KERN_DEBUG "archos_usb2sata_init: sata_pwron on GPIO%i\n",
				GPIO_PIN(gpio_sata_pwron));
		GPIO_INIT_OUTPUT(gpio_sata_pwron);
		omap_set_gpio_dataout(GPIO_PIN(gpio_sata_pwron), 0);
	}

	/* HDD power switch */
	gpio_hdd_pwron = sata_cfg->rev[hardware_rev].hdd_power;
	printk(KERN_DEBUG "archos_usb2sata_init: sata_pwron on GPIO%i\n",
			GPIO_PIN(gpio_hdd_pwron));
	GPIO_INIT_OUTPUT(gpio_hdd_pwron);
	omap_set_gpio_dataout(GPIO_PIN(gpio_hdd_pwron), 0);

	/* SATA_RDY signal */
	gpio_sata_rdy = sata_cfg->rev[hardware_rev].sata_ready;
	ret = device_create_file(&usb2sata_device.dev, &dev_attr_satardy);
	if (ret == 0) {
		printk(KERN_DEBUG "archos_usb2sata_init: sata_ready on GPIO%i\n",
				GPIO_PIN(gpio_sata_rdy));
		GPIO_INIT_INPUT(gpio_sata_rdy);
	}

	clk_enable(clkout1);
	usbsata_power(0);

	return 0;
}
Пример #4
0
int __init archos_compass_init(void)
{
	const struct archos_compass_config *compass_config;
	int ret = 0;
	
	compass_config = omap_get_config( ARCHOS_TAG_COMPASS, struct archos_compass_config );

	if (compass_config == NULL) {
		printk(KERN_DEBUG "%s: no board configuration found\n",__FUNCTION__);
		return -ENODEV;
	}

	if ( hardware_rev >= compass_config->nrev ) {
		printk(KERN_DEBUG "%s: hardware_rev (%i) >= nrev (%i)\n", __FUNCTION__, hardware_rev, compass_config->nrev);
		return -ENODEV;
	}

	printk(KERN_DEBUG "%s\n",__FUNCTION__);

        gpio_compass_reset = compass_config->rev[hardware_rev].reset;
        GPIO_INIT_OUTPUT(gpio_compass_reset);

        gpio_set_value(GPIO_PIN(gpio_compass_reset), 1);

	if (( ret = platform_device_register(&compass_device)))
		return ret;

        if (( ret = device_create_file(&compass_device.dev, &dev_attr_reset)))
                return ret;

	return ret;
}
Пример #5
0
int __init archosg7_init(void)
{
 	GPIO_INIT_OUTPUT(wake_up_omap);
 	omap_set_gpio_dataout( GPIO_PIN( wake_up_omap ), 0 );

	return 0;
}
static int nl5550_probe(struct platform_device *pdev)
{
	int ret;
	struct nl5550_struct *nl5550 = pdev->dev.platform_data;
	struct archos_gps_conf *conf = &nl5550->gps_conf;
	
	GPIO_INIT_OUTPUT(conf->gps_enable);
	GPIO_INIT_INPUT(conf->gps_int);
	
	omap_cfg_reg(AD25_34XX_UART2_RX);
	omap_cfg_reg(AA25_34XX_UART2_TX);

	INIT_WORK(&nl5550->work, nl5550_irq_worker);

	ret = request_irq(OMAP_GPIO_IRQ(GPIO_PIN(conf->gps_int)), 
			nl5550_isr, IRQF_TRIGGER_RISING, "nl5550", nl5550);
	if (ret < 0) {
		dev_err(&pdev->dev, "nl5550_probe: cannot register irq %d\n", 
				OMAP_GPIO_IRQ(GPIO_PIN(conf->gps_int)));
		return ret;
	}

	ret = device_create_file(&pdev->dev, &dev_attr_enable);
	if (ret < 0)
		dev_dbg(&pdev->dev, "cannot add enable attr\n");
	ret = device_create_file(&pdev->dev, &dev_attr_intr);
	if (ret < 0)
		dev_dbg(&pdev->dev, "cannot add intr attr\n");
	
	wake_lock_init(&nl5550->wake_lock, WAKE_LOCK_SUSPEND, "nl5550");

	nl5550->pdev = pdev;
	return 0;
}
Пример #7
0
static int __init omap_battery_init_devicefs(void)
{
	const struct archos_charge_config *charge_cfg;
	int ret;

	sysdev_class_register(&omap_battery_sysclass);
	
	ret = sysdev_register(&omap_battery0_device);
	if (ret < 0)
		return ret;

#ifdef CONFIG_POWER_SUPPLY
	ret = platform_device_register(&archos_battery_device);
	if (ret < 0) {
		printk(KERN_INFO "omap_battery_init_devicefs: failed to register battery device\n");
		return ret;
	}
#endif

	sysdev_create_file(&omap_battery0_device, &attr_battery0_charge_state);
	sysdev_create_file(&omap_battery0_device, &attr_battery0_charge_level);
	sysdev_create_file(&omap_battery0_device, &attr_battery0_charge_usblevel);

	/* charge pin */
	charge_cfg = omap_get_config( ARCHOS_TAG_CHARGE, struct archos_charge_config );
	if (charge_cfg && (hardware_rev < charge_cfg->nrev)) {
		charge_gpio = charge_cfg->rev[hardware_rev];
		GPIO_INIT_OUTPUT( charge_gpio );
		omap_set_gpio_dataout( GPIO_PIN( charge_gpio ), 1);	
	} else
		printk(KERN_DEBUG "omap_battery_init_devicefs: no board configuration found\n");
	
	return 0;
}
void __init usb_musb_init(void)
{
#ifdef CONFIG_USB_MUSB_SOC
	const struct archos_usb_config *usb_cfg;
	usb_cfg = omap_get_config( ARCHOS_TAG_USB, struct archos_usb_config );
	if (usb_cfg == NULL) {
		printk(KERN_DEBUG "archos_usb_init: no board configuration found\n");
		return;
	}
	if ( hardware_rev >= usb_cfg->nrev ) {
		printk(KERN_DEBUG "archos_usb_init: hardware_rev (%i) >= nrev (%i)\n",
			hardware_rev, usb_cfg->nrev);
		return;
	}

	/* ground USB ID pin */
	gpio_usb_id = usb_cfg->rev[hardware_rev].usb_id;
	if (GPIO_EXISTS(gpio_usb_id)) {
		GPIO_INIT_OUTPUT( gpio_usb_id );
		omap_set_gpio_dataout( GPIO_PIN( gpio_usb_id ), 0 );
	}

	/* keep PHY in reset to save power... */	
	gpio_phy_enable = usb_cfg->rev[hardware_rev].enable_usb_musb;
	if (GPIO_EXISTS(gpio_phy_enable)) {
		GPIO_INIT_OUTPUT( gpio_phy_enable );
		omap_set_gpio_dataout( GPIO_PIN ( gpio_phy_enable ), 0);
	}

	/* sys_clkout1 is needed by the phy */
	phy_clk = clk_get(NULL, "sys_clkout1");
	if (IS_ERR(phy_clk)) {
		/* No need to proceed, PHY will not work without clock */
		pr_err("usb_musb_init: cannot get PHY external clock\n");
		return;
	}

	if (platform_device_register(&musb_device) < 0) {
		printk(KERN_ERR "Unable to register HS-USB (MUSB) device\n");
		return;
	}
	
	otg_set_transceiver(&musb_xceiv);
#endif
}
int __init panel_cpt_wvga_48_init(struct omap_dss_platform_data *disp_data)
{
	const struct archos_display_config *disp_cfg;
	int ret = -ENODEV;

	disp_cfg = omap_get_config( ARCHOS_TAG_DISPLAY, struct archos_display_config );
	if (disp_cfg == NULL)
		return ret;

	if ( hardware_rev >= disp_cfg->nrev ) {
		printk(KERN_DEBUG "archos_display_init: hardware_rev (%i) >= nrev (%i)\n",
			hardware_rev, disp_cfg->nrev);
		return ret;
	}

	display_gpio = disp_cfg->rev[hardware_rev];

	/*
	 * Backlight configuration,
	 * TODO: retrieve GPT id and mux through omap_get_config()
	 */
	GPIO_INIT_OUTPUT(display_gpio.bkl_pwon);
	bkl_pwm = omap_dm_timer_request_specific(display_gpio.bkl_pwm.timer);
	if (bkl_pwm) {
		omap_dm_timer_set_source(bkl_pwm, OMAP_TIMER_SRC_SYS_CLK);
		omap_cfg_reg(display_gpio.bkl_pwm.mux_cfg);
	} else
		pr_err("panel_cpt_wvga_48_init: no backlight PWM\n");

	/*
	 * Vcom configuration,
	 */
	vcom_pwm = omap_dm_timer_request_specific(display_gpio.vcom_pwm.timer);
	if (vcom_pwm) {
		omap_dm_timer_set_source(vcom_pwm, OMAP_TIMER_SRC_SYS_CLK);
		omap_cfg_reg(display_gpio.vcom_pwm.mux_cfg);
	} else
		pr_err("panel_cpt_wvga_48_init: no vcom PWM\n");

	panel_init(&cpt_wvga_48_panel);
#if defined(CONFIG_FB_OMAP_BOOTLOADER_INIT)
	panel_set_backlight_level(NULL, 255);
#endif

	disp_data->displays[disp_data->num_displays] = &cpt_wvga_48_panel;
	disp_data->num_displays++;

	return 0;
}
static int archos_mmc1_setup_gpios(struct twl4030_hsmmc_info *c, struct regulator_init_data *reg_init_data)
{
 	const struct archos_sd_config *hsmmc_cfg;
	struct archos_gpio gpio_hsmmc_power, gpio_hsmmc_cd,gpio_hsmmc_cpd;
	
	/* sd */
	hsmmc_cfg = omap_get_config( ARCHOS_TAG_SD, struct archos_sd_config );
	if (hsmmc_cfg == NULL) {
		printk(KERN_DEBUG "%s: no board configuration found\n", __FUNCTION__);
		return -ENODEV;
	}
	if ( hardware_rev >= hsmmc_cfg->nrev ) {
		printk(KERN_DEBUG "%s: hardware_rev (%i) >= nrev (%i)\n",
			__FUNCTION__, hardware_rev, hsmmc_cfg->nrev);
		return -ENODEV;
	}
	
	printk(KERN_DEBUG "%s\n", __FUNCTION__);

	gpio_hsmmc_power = hsmmc_cfg->rev[hardware_rev].sd_power;
	GPIO_INIT_OUTPUT( gpio_hsmmc_power );

	reg_init_data->driver_data = (void*)GPIO_PIN( gpio_hsmmc_power );
	
	gpio_hsmmc_cd = hsmmc_cfg->rev[hardware_rev].sd_detect;
	gpio_hsmmc_cpd = hsmmc_cfg->rev[hardware_rev].sd_prewarn;
	
	/* card detect */
	c->gpio_cd = GPIO_PIN(gpio_hsmmc_cd);	

	/* Need to be here, before omap2_init_mmc which will correctly set the IRQ stuff */
	GPIO_INIT_INPUT(gpio_hsmmc_cd);	
	gpio_free(c->gpio_cd);
	
	return 0;
}
Пример #11
0
void __init usb_ehci_init(void)
{
	const struct archos_usb_config *usb_cfg;
	usb_cfg = omap_get_config( ARCHOS_TAG_USB, struct archos_usb_config );
	if (usb_cfg == NULL) {
		printk(KERN_DEBUG "archos_usb_init: no board configuration found\n");
		return;
	}
	if ( hardware_rev >= usb_cfg->nrev ) {
		printk(KERN_DEBUG "archos_usb_init: hardware_rev (%i) >= nrev (%i)\n",
			hardware_rev, usb_cfg->nrev);
		return;
	}

	if ( GPIO_PIN (usb_cfg->rev[hardware_rev].enable_usb_ehci) != 0 ) {

		gio_ehci_enable = usb_cfg->rev[hardware_rev].enable_usb_ehci;

		GPIO_INIT_OUTPUT( gio_ehci_enable );

#if     defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_EHCI_HCD_MODULE)
		ehci_plat.usb_enable_pin = GPIO_PIN( gio_ehci_enable );
		ehci_plat.usb_enable_delay = 10;
#endif
		/* reset the PHY */
		archos_enable_ehci( 0 );
//		udelay(2);
//		archos_enable_ehci( 1 );

		if ( machine_is_archos_a5h() || machine_is_archos_a5s() ||
		   machine_is_archos_a5hg() || machine_is_archos_a5sg() ||
		   machine_is_archos_a5hgw() || machine_is_archos_a5sgw() ||
		   machine_is_archos_a5sc() || machine_is_archos_a5st() ||
		   machine_is_archos_a5gcam()	) {
			/* pin mux for EHCI Port 1 */
			omap_cfg_reg(AE10_3430_USB1HS_PHY_CLK);
			omap_cfg_reg(AF10_3430_USB1HS_PHY_STP);
			omap_cfg_reg(AF9_3430_USB1HS_PHY_DIR);
			omap_cfg_reg(AG9_3430_USB1HS_PHY_NXT);
			omap_cfg_reg(AF11_3430_USB1HS_PHY_DATA0);
			omap_cfg_reg(AG12_3430_USB1HS_PHY_DATA1);
			omap_cfg_reg(AH12_3430_USB1HS_PHY_DATA2);
			omap_cfg_reg(AH14_3430_USB1HS_PHY_DATA3);
			omap_cfg_reg(AE11_3430_USB1HS_PHY_DATA4);
			omap_cfg_reg(AH9_3430_USB1HS_PHY_DATA5);
			omap_cfg_reg(AF13_3430_USB1HS_PHY_DATA6);
			omap_cfg_reg(AE13_3430_USB1HS_PHY_DATA7);
		} else {
			// gen6
			/* pin mux for EHCI Port 2 */
			omap_cfg_reg(AE7_3430_USB2HS_PHY_CLK);
			omap_cfg_reg(AF7_3430_USB2HS_PHY_STP);
			omap_cfg_reg(AG7_3430_USB2HS_PHY_DIR);
			omap_cfg_reg(AH7_3430_USB2HS_PHY_NXT);
			omap_cfg_reg(AG8_3430_USB2HS_PHY_DATA0);
			omap_cfg_reg(AH8_3430_USB2HS_PHY_DATA1);
			omap_cfg_reg(AB2_3430_USB2HS_PHY_DATA2);
			omap_cfg_reg(V3_3430_USB2HS_PHY_DATA3);
			omap_cfg_reg(Y2_3430_USB2HS_PHY_DATA4);
			omap_cfg_reg(Y3_3430_USB2HS_PHY_DATA5);
			omap_cfg_reg(Y4_3430_USB2HS_PHY_DATA6);
			omap_cfg_reg(AA3_3430_USB2HS_PHY_DATA7);
		}
	}

#if     defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_EHCI_HCD_MODULE)
	if (platform_device_register(&ehci_device) < 0) {
		printk(KERN_ERR "Unable to register HS-USB (EHCI) device\n");
		return;
	}
#endif

	if (platform_device_register(&archos_ehci_device) < 0)
		printk(KERN_ERR "Unable to register Archos EHCI device\n");
	
	platform_driver_register(&archos_ehci_driver);

}
static int __init archos_accessory_init(void)
{
	unsigned long aux;
	int ret;
	/* USB0 PHY VBUS */
	const struct archos_vbus_config *vbus_cfg;
	const struct archos_irremote_config *irremote_cfg;
	const struct archos_irblaster_config *irblaster_cfg;
	const struct archos_uart3_config *uart3_cfg;

	/* Get VBUS config */
	vbus_cfg = omap_get_config( ARCHOS_TAG_VBUS0, struct archos_vbus_config );
	if (vbus_cfg == NULL)
		printk(KERN_ERR "archos_accessory_init: no board configuration found (VBUS)\n");
	else if ( hardware_rev >= vbus_cfg->nrev ) {
		printk(KERN_ERR "archos_accessory_init: hardware_rev (%i) >= nrev (%i) (VBUS)\n",
			hardware_rev, vbus_cfg->nrev);
		vbus_cfg = NULL;
	}

	/* Get IR-Blaster config */
	irblaster_cfg = omap_get_config( ARCHOS_TAG_IRBLASTER, struct archos_irblaster_config );
	if (irblaster_cfg == NULL)
		printk(KERN_ERR "archos_accessory_init: no board configuration found (IR-Blaster)\n");
	else if ( hardware_rev >= irblaster_cfg->nrev ) {
		printk(KERN_ERR "archos_accessory_init: hardware_rev (%i) >= nrev (%i) (IR-Blaster)\n",
			hardware_rev, irblaster_cfg->nrev);
		irblaster_cfg = NULL;
	}


	/* Get IR-Remote config */
	irremote_cfg = omap_get_config( ARCHOS_TAG_IRREMOTE, struct archos_irremote_config );
	if (irremote_cfg == NULL)
		printk(KERN_ERR "archos_accessory_init: no board configuration found (IR-Remote)\n");
	else if ( hardware_rev >= irremote_cfg->nrev ) {
		printk(KERN_ERR "archos_accessory_init: hardware_rev (%i) >= nrev (%i) (IR-Remote)\n",
			hardware_rev, irremote_cfg->nrev);
		irremote_cfg = NULL;
	}

	
	/* Get UART-3 config */
	uart3_cfg = omap_get_config( ARCHOS_TAG_UART3, struct archos_uart3_config );
	if (uart3_cfg == NULL)
		printk(KERN_ERR "archos_accessory_init: no board configuration found (UART-3)\n");
	else if ( hardware_rev >= uart3_cfg->nrev ) {
		printk(KERN_ERR "archos_accessory_init: hardware_rev (%i) >= nrev (%i) (UART-3)\n",
			hardware_rev, uart3_cfg->nrev);
		uart3_cfg = NULL;
	}

	ret = platform_device_register(&accessory_device);
	if (ret) {
		printk(KERN_ERR "archos_accessory_init: register device failed\n");
		return -ENODEV;
	}
	
	if (irblaster_cfg && irremote_cfg && uart3_cfg) {

		irblaster_pwm = irblaster_cfg->rev[hardware_rev].irblaster_pwm;
		irblaster_pwm_disable = irblaster_cfg->rev[hardware_rev].irblaster_pwm_disable;

		irremote_timer = irremote_cfg->rev[hardware_rev].irremote_timer;
		irremote_timer_disable = irremote_cfg->rev[hardware_rev].irremote_timer_disable;

		uart3_rx_mux = uart3_cfg->rev[hardware_rev].uart3_rx_mux;
		uart3_tx_mux = uart3_cfg->rev[hardware_rev].uart3_tx_mux;

		gpio_uart3_rx = uart3_cfg->rev[hardware_rev].gpio_uart3_rx;
		gpio_uart3_tx = uart3_cfg->rev[hardware_rev].gpio_uart3_tx;
	
		/* Default mode is UART-3 */
		archos_accessory_set_irmode("default");

		ret = device_create_file(&accessory_device.dev, &dev_attr_ir_mode);
	}
	
	if (vbus_cfg) {
		gpio_5Vusb = vbus_cfg->rev[hardware_rev];
		printk(KERN_DEBUG "archos_accessory_init: gpio %i\n", GPIO_PIN(gpio_5Vusb));

		GPIO_INIT_OUTPUT( gpio_5Vusb );
		omap_set_gpio_dataout( GPIO_PIN( gpio_5Vusb ), 0);
		
		ret = device_create_file(&accessory_device.dev, &dev_attr_5vusb);	
	}

	/* if nothing initialized */
	if (!(irblaster_cfg && irremote_cfg && uart3_cfg) && vbus_cfg == NULL) {
		platform_device_unregister(&accessory_device);
		return -ENODEV;
	}
	
	return 0;
}