Commit 787f51f2 authored by Linus Walleij's avatar Linus Walleij Committed by Greg Kroah-Hartman
Browse files

USB/ARM: Switch S3C2410 UDC to GPIO descriptors



This converts the S3C2410 UDC USB device controller to use
GPIO descriptor tables and modern GPIO.

Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Alim Akhtar <alim.akhtar@samsung.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-samsung-soc@vger.kernel.org
Acked-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20220901081649.564348-1-linus.walleij@linaro.org


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a8113da5
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -421,7 +421,14 @@ static struct s3c2410_platform_nand __initdata gta02_nand_info = {
/* Get PMU to set USB current limit accordingly. */
static struct s3c2410_udc_mach_info gta02_udc_cfg __initdata = {
	.vbus_draw	= gta02_udc_vbus_draw,
	.pullup_pin = GTA02_GPIO_USB_PULLUP,
};

static struct gpiod_lookup_table gta02_udc_gpio_table = {
	.dev_id = "s3c2410-usbgadget",
	.table = {
		GPIO_LOOKUP("GPIOB", 9, "pullup", GPIO_ACTIVE_HIGH),
		{ },
	},
};

/* USB */
@@ -555,6 +562,7 @@ static void __init gta02_machine_init(void)
	s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
			      S3C_GPIO_PULL_NONE);

	gpiod_add_lookup_table(&gta02_udc_gpio_table);
	gpiod_add_lookup_table(&gta02_audio_gpio_table);
	gpiod_add_lookup_table(&gta02_mmc_gpio_table);
	platform_add_devices(gta02_devices, ARRAY_SIZE(gta02_devices));
+10 −3
Original line number Diff line number Diff line
@@ -167,9 +167,15 @@ static struct gpio_chip h1940_latch_gpiochip = {
};

static struct s3c2410_udc_mach_info h1940_udc_cfg __initdata = {
	.vbus_pin		= S3C2410_GPG(5),
	.vbus_pin_inverted	= 1,
	.pullup_pin		= H1940_LATCH_USB_DP,
};

static struct gpiod_lookup_table h1940_udc_gpio_table = {
	.dev_id = "s3c2410-usbgadget",
	.table = {
		GPIO_LOOKUP("GPIOG", 5, "vbus", GPIO_ACTIVE_LOW),
		GPIO_LOOKUP("H1940_LATCH", 7, "pullup", GPIO_ACTIVE_HIGH),
		{ },
	},
};

static struct s3c2410_ts_mach_info h1940_ts_cfg __initdata = {
@@ -725,6 +731,7 @@ static void __init h1940_init(void)
	u32 tmp;

	s3c24xx_fb_set_platdata(&h1940_fb_info);
	gpiod_add_lookup_table(&h1940_udc_gpio_table);
	gpiod_add_lookup_table(&h1940_mmc_gpio_table);
	gpiod_add_lookup_table(&h1940_audio_gpio_table);
	gpiod_add_lookup_table(&h1940_bat_gpio_table);
+9 −1
Original line number Diff line number Diff line
@@ -493,7 +493,14 @@ static struct platform_device *jive_devices[] __initdata = {
};

static struct s3c2410_udc_mach_info jive_udc_cfg __initdata = {
	.vbus_pin	= S3C2410_GPG(1),		/* detect is on GPG1 */
};

static struct gpiod_lookup_table jive_udc_gpio_table = {
	.dev_id = "s3c2410-usbgadget",
	.table = {
		GPIO_LOOKUP("GPIOG", 1, "vbus", GPIO_ACTIVE_HIGH),
		{ },
	},
};

/* Jive power management device */
@@ -669,6 +676,7 @@ static void __init jive_machine_init(void)

	pm_power_off = jive_power_off;

	gpiod_add_lookup_table(&jive_udc_gpio_table);
	gpiod_add_lookup_table(&jive_lcdspi_gpiod_table);
	gpiod_add_lookup_table(&jive_wm8750_gpiod_table);
	platform_add_devices(jive_devices, ARRAY_SIZE(jive_devices));
+8 −1
Original line number Diff line number Diff line
@@ -93,9 +93,15 @@ static struct s3c2410_uartcfg mini2440_uartcfgs[] __initdata = {
/* USB device UDC support */

static struct s3c2410_udc_mach_info mini2440_udc_cfg __initdata = {
	.pullup_pin = S3C2410_GPC(5),
};

static struct gpiod_lookup_table mini2440_udc_gpio_table = {
	.dev_id = "s3c2410-usbgadget",
	.table = {
		GPIO_LOOKUP("GPIOC", 5, "pullup", GPIO_ACTIVE_HIGH),
		{ },
	},
};

/* LCD timing and setup */

@@ -755,6 +761,7 @@ static void __init mini2440_init(void)
		s3c24xx_fb_set_platdata(&mini2440_fb_info);
	}

	gpiod_add_lookup_table(&mini2440_udc_gpio_table);
	s3c24xx_udc_set_platdata(&mini2440_udc_cfg);
	gpiod_add_lookup_table(&mini2440_mmc_gpio_table);
	s3c24xx_mci_set_platdata(&mini2440_mmc_cfg);
+10 −3
Original line number Diff line number Diff line
@@ -84,9 +84,15 @@ static struct s3c2410_uartcfg n30_uartcfgs[] = {
};

static struct s3c2410_udc_mach_info n30_udc_cfg __initdata = {
	.vbus_pin		= S3C2410_GPG(1),
	.vbus_pin_inverted	= 0,
	.pullup_pin		= S3C2410_GPB(3),
};

static struct gpiod_lookup_table n30_udc_gpio_table = {
	.dev_id = "s3c2410-usbgadget",
	.table = {
		GPIO_LOOKUP("GPIOG", 1, "vbus", GPIO_ACTIVE_HIGH),
		GPIO_LOOKUP("GPIOB", 3, "pullup", GPIO_ACTIVE_HIGH),
		{ },
	},
};

static struct gpio_keys_button n30_buttons[] = {
@@ -595,6 +601,7 @@ static void __init n30_init(void)
	WARN_ON(gpio_request(S3C2410_GPG(4), "mmc power"));

	s3c24xx_fb_set_platdata(&n30_fb_info);
	gpiod_add_lookup_table(&n30_udc_gpio_table);
	s3c24xx_udc_set_platdata(&n30_udc_cfg);
	gpiod_add_lookup_table(&n30_mci_gpio_table);
	s3c24xx_mci_set_platdata(&n30_mci_cfg);
Loading