Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 541e00ae authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Greg Kroah-Hartman
Browse files

ARM: pxa: zeus: Replace OHCI init/exit functions with a regulator

parent cecabe5c
Loading
Loading
Loading
Loading
+48 −41
Original line number Original line Diff line number Diff line
@@ -413,7 +413,7 @@ static struct fixed_voltage_config can_regulator_pdata = {


static struct platform_device can_regulator_device = {
static struct platform_device can_regulator_device = {
	.name	= "reg-fixed-volage",
	.name	= "reg-fixed-volage",
	.id	= -1,
	.id	= 0,
	.dev	= {
	.dev	= {
		.platform_data	= &can_regulator_pdata,
		.platform_data	= &can_regulator_pdata,
	},
	},
@@ -510,18 +510,6 @@ struct platform_device zeus_max6369_device = {
	.num_resources	= 1,
	.num_resources	= 1,
};
};


static struct platform_device *zeus_devices[] __initdata = {
	&zeus_serial_device,
	&zeus_mtd_devices[0],
	&zeus_dm9k0_device,
	&zeus_dm9k1_device,
	&zeus_sram_device,
	&zeus_leds_device,
	&zeus_pcmcia_device,
	&zeus_max6369_device,
	&can_regulator_device,
};

/* AC'97 */
/* AC'97 */
static pxa2xx_audio_ops_t zeus_ac97_info = {
static pxa2xx_audio_ops_t zeus_ac97_info = {
	.reset_gpio = 95,
	.reset_gpio = 95,
@@ -532,44 +520,50 @@ static pxa2xx_audio_ops_t zeus_ac97_info = {
 * USB host
 * USB host
 */
 */


static int zeus_ohci_init(struct device *dev)
static struct regulator_consumer_supply zeus_ohci_regulator_supplies[] = {
{
	REGULATOR_SUPPLY("vbus2", "pxa27x-ohci"),
	int err;
};

	/* Switch on port 2. */
	if ((err = gpio_request(ZEUS_USB2_PWREN_GPIO, "USB2_PWREN"))) {
		dev_err(dev, "Can't request USB2_PWREN\n");
		return err;
	}

	if ((err = gpio_direction_output(ZEUS_USB2_PWREN_GPIO, 1))) {
		gpio_free(ZEUS_USB2_PWREN_GPIO);
		dev_err(dev, "Can't enable USB2_PWREN\n");
		return err;
	}


	/* Port 2 is shared between host and client interface. */
static struct regulator_init_data zeus_ohci_regulator_data = {
	UP2OCR = UP2OCR_HXOE | UP2OCR_HXS | UP2OCR_DMPDE | UP2OCR_DPPDE;
	.constraints = {
		.valid_ops_mask		= REGULATOR_CHANGE_STATUS,
	},
	.num_consumer_supplies	= ARRAY_SIZE(zeus_ohci_regulator_supplies),
	.consumer_supplies	= zeus_ohci_regulator_supplies,
};


	return 0;
static struct fixed_voltage_config zeus_ohci_regulator_config = {
}
	.supply_name		= "vbus2",
	.microvolts		= 5000000, /* 5.0V */
	.gpio			= ZEUS_USB2_PWREN_GPIO,
	.enable_high		= 1,
	.startup_delay		= 0,
	.init_data		= &zeus_ohci_regulator_data,
};


static void zeus_ohci_exit(struct device *dev)
static struct platform_device zeus_ohci_regulator_device = {
{
	.name		= "reg-fixed-voltage",
	/* Power-off port 2 */
	.id		= 1,
	gpio_direction_output(ZEUS_USB2_PWREN_GPIO, 0);
	.dev = {
	gpio_free(ZEUS_USB2_PWREN_GPIO);
		.platform_data = &zeus_ohci_regulator_config,
}
	},
};


static struct pxaohci_platform_data zeus_ohci_platform_data = {
static struct pxaohci_platform_data zeus_ohci_platform_data = {
	.port_mode	= PMM_NPS_MODE,
	.port_mode	= PMM_NPS_MODE,
	/* Clear Power Control Polarity Low and set Power Sense
	/* Clear Power Control Polarity Low and set Power Sense
	 * Polarity Low. Supply power to USB ports. */
	 * Polarity Low. Supply power to USB ports. */
	.flags		= ENABLE_PORT_ALL | POWER_SENSE_LOW,
	.flags		= ENABLE_PORT_ALL | POWER_SENSE_LOW,
	.init		= zeus_ohci_init,
	.exit		= zeus_ohci_exit,
};
};


static void zeus_register_ohci(void)
{
	/* Port 2 is shared between host and client interface. */
	UP2OCR = UP2OCR_HXOE | UP2OCR_HXS | UP2OCR_DMPDE | UP2OCR_DPPDE;

	pxa_set_ohci_info(&zeus_ohci_platform_data);
}

/*
/*
 * Flat Panel
 * Flat Panel
 */
 */
@@ -677,6 +671,19 @@ static struct pxa2xx_udc_mach_info zeus_udc_info = {
	.udc_command = zeus_udc_command,
	.udc_command = zeus_udc_command,
};
};


static struct platform_device *zeus_devices[] __initdata = {
	&zeus_serial_device,
	&zeus_mtd_devices[0],
	&zeus_dm9k0_device,
	&zeus_dm9k1_device,
	&zeus_sram_device,
	&zeus_leds_device,
	&zeus_pcmcia_device,
	&zeus_max6369_device,
	&can_regulator_device,
	&zeus_ohci_regulator_device,
};

#ifdef CONFIG_PM
#ifdef CONFIG_PM
static void zeus_power_off(void)
static void zeus_power_off(void)
{
{
@@ -847,7 +854,7 @@ static void __init zeus_init(void)


	platform_add_devices(zeus_devices, ARRAY_SIZE(zeus_devices));
	platform_add_devices(zeus_devices, ARRAY_SIZE(zeus_devices));


	pxa_set_ohci_info(&zeus_ohci_platform_data);
	zeus_register_ohci();


	if (zeus_setup_fb_gpios())
	if (zeus_setup_fb_gpios())
		pr_err("Failed to setup fb gpios\n");
		pr_err("Failed to setup fb gpios\n");