static int usbhs_hardware_init(struct platform_device *pdev) { struct usbhs_private *priv = usbhs_get_priv(pdev); struct usb_phy *phy; int ret; /* USB0 Function - use PWEN as GPIO input to detect DIP Switch SW5 * setting to avoid VBUS short circuit due to wrong cable. * PWEN should be pulled up high if USB Function is selected by SW5 */ gpio_request_one(RCAR_GP_PIN(5, 18), GPIOF_IN, NULL); /* USB0_PWEN */ if (!gpio_get_value(RCAR_GP_PIN(5, 18))) { pr_warn("Error: USB Function not selected - check SW5 + SW6\n"); ret = -ENOTSUPP; goto error; } phy = usb_get_phy_dev(&pdev->dev, 0); if (IS_ERR(phy)) { ret = PTR_ERR(phy); goto error; } priv->phy = phy; return 0; error: gpio_free(RCAR_GP_PIN(5, 18)); return ret; }
static int usbhs_hardware_exit(struct platform_device *pdev) { struct usbhs_private *priv = usbhs_get_priv(pdev); if (!priv->phy) return 0; usb_put_phy(priv->phy); priv->phy = NULL; gpio_free(RCAR_GP_PIN(5, 18)); return 0; }
static void __init lager_add_du_device(void) { struct platform_device_info info = { .name = "rcar-du-r8a7790", .id = -1, .res = du_resources, .num_res = ARRAY_SIZE(du_resources), .data = &lager_du_pdata, .size_data = sizeof(lager_du_pdata), .dma_mask = DMA_BIT_MASK(32), }; platform_device_register_full(&info); } /* LEDS */ static struct gpio_led lager_leds[] = { { .name = "led8", .gpio = RCAR_GP_PIN(5, 17), .default_state = LEDS_GPIO_DEFSTATE_ON, }, { .name = "led7",
.size_data = sizeof(lager_du_pdata), .dma_mask = DMA_BIT_MASK(32), }; platform_device_register_full(&info); } /* LEDS */ static struct gpio_led lager_leds[] = { { .name = "led8", .gpio = RCAR_GP_PIN(5, 17), .default_state = LEDS_GPIO_DEFSTATE_ON, }, { .name = "led7", .gpio = RCAR_GP_PIN(4, 23), .default_state = LEDS_GPIO_DEFSTATE_ON, }, { .name = "led6", .gpio = RCAR_GP_PIN(4, 22), .default_state = LEDS_GPIO_DEFSTATE_ON, }, }; static const struct gpio_led_platform_data lager_leds_pdata __initconst = { .leds = lager_leds, .num_leds = ARRAY_SIZE(lager_leds), }; /* GPIO KEY */ #define GPIO_KEY(c, g, d, ...) \
.size_data = sizeof(du_pdata), .dma_mask = DMA_BIT_MASK(32), }; platform_device_register_full(&info); } /* LEDS */ static struct gpio_led marzen_leds[] = { { .name = "led2", .gpio = RCAR_GP_PIN(4, 29), .default_state = LEDS_GPIO_DEFSTATE_ON, }, { .name = "led3", .gpio = RCAR_GP_PIN(4, 30), .default_state = LEDS_GPIO_DEFSTATE_ON, }, { .name = "led4", .gpio = RCAR_GP_PIN(4, 31), .default_state = LEDS_GPIO_DEFSTATE_ON, }, }; static struct gpio_led_platform_data marzen_leds_pdata = { .leds = marzen_leds, .num_leds = ARRAY_SIZE(marzen_leds), }; static struct platform_device leds_device = { .name = "leds-gpio",