mmc: rtsx_pci: Enable MMC_CAP_ERASE to allow erase/discard/trim requests
[linux/fpc-iii.git] / drivers / usb / renesas_usbhs / rcar3.c
blob38b01f2aeeb0d408f6e41340355273536f0ab713
1 /*
2 * Renesas USB driver R-Car Gen. 3 initialization and power control
4 * Copyright (C) 2016 Renesas Electronics Corporation
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
12 #include <linux/io.h>
13 #include "common.h"
14 #include "rcar3.h"
16 #define LPSTS 0x102
17 #define UGCTRL2 0x184 /* 32-bit register */
19 /* Low Power Status register (LPSTS) */
20 #define LPSTS_SUSPM 0x4000
22 /* USB General control register 2 (UGCTRL2), bit[31:6] should be 0 */
23 #define UGCTRL2_RESERVED_3 0x00000001 /* bit[3:0] should be B'0001 */
24 #define UGCTRL2_USB0SEL_OTG 0x00000030
26 void usbhs_write32(struct usbhs_priv *priv, u32 reg, u32 data)
28 iowrite32(data, priv->base + reg);
31 static int usbhs_rcar3_power_ctrl(struct platform_device *pdev,
32 void __iomem *base, int enable)
34 struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev);
36 usbhs_write32(priv, UGCTRL2, UGCTRL2_RESERVED_3 | UGCTRL2_USB0SEL_OTG);
38 if (enable)
39 usbhs_bset(priv, LPSTS, LPSTS_SUSPM, LPSTS_SUSPM);
40 else
41 usbhs_bset(priv, LPSTS, LPSTS_SUSPM, 0);
43 return 0;
46 static int usbhs_rcar3_get_id(struct platform_device *pdev)
48 return USBHS_GADGET;
51 const struct renesas_usbhs_platform_callback usbhs_rcar3_ops = {
52 .power_ctrl = usbhs_rcar3_power_ctrl,
53 .get_id = usbhs_rcar3_get_id,