ar71xx/mikrotik: disable unused MTD options
[openwrt.git] / target / linux / ar71xx / patches-3.10 / 490-usb-ehci-add-quirks-for-qca-socs.patch
1 --- a/drivers/usb/host/ehci-hcd.c
2 +++ b/drivers/usb/host/ehci-hcd.c
3 @@ -249,6 +249,37 @@ static int ehci_reset (struct ehci_hcd *
4         command |= CMD_RESET;
5         dbg_cmd (ehci, "reset", command);
6         ehci_writel(ehci, command, &ehci->regs->command);
7 +
8 +       if (ehci->qca_force_host_mode) {
9 +               u32 usbmode;
10 +
11 +               udelay(1000);
12 +
13 +               usbmode = ehci_readl(ehci, &ehci->regs->usbmode);
14 +               usbmode |= USBMODE_CM_HC | (1 << 4);
15 +               ehci_writel(ehci, usbmode, &ehci->regs->usbmode);
16 +
17 +               ehci_dbg(ehci, "forced host mode, usbmode: %08x\n",
18 +                        ehci_readl(ehci, &ehci->regs->usbmode));
19 +       }
20 +
21 +       if (ehci->qca_force_16bit_ptw) {
22 +               u32 port_status;
23 +
24 +               udelay(1000);
25 +
26 +               /* enable 16-bit UTMI interface */
27 +               port_status = ehci_readl(ehci, &ehci->regs->port_status[0]);
28 +               port_status |= BIT(28);
29 +               ehci_writel(ehci, port_status, &ehci->regs->port_status[0]);
30 +
31 +               ehci_dbg(ehci, "16-bit UTMI interface enabled, status: %08x\n",
32 +                        ehci_readl(ehci, &ehci->regs->port_status[0]));
33 +       }
34 +
35 +       if (ehci->reset_notifier)
36 +               ehci->reset_notifier(ehci_to_hcd(ehci));
37 +
38         ehci->rh_state = EHCI_RH_HALTED;
39         ehci->next_statechange = jiffies;
40         retval = handshake (ehci, &ehci->regs->command,
41 --- a/drivers/usb/host/ehci.h
42 +++ b/drivers/usb/host/ehci.h
43 @@ -201,6 +201,10 @@ struct ehci_hcd {                  /* one per controlle
44         unsigned                frame_index_bug:1; /* MosChip (AKA NetMos) */
45         unsigned                need_oc_pp_cycle:1; /* MPC834X port power */
46         unsigned                ignore_oc:1;
47 +       unsigned                qca_force_host_mode:1;
48 +       unsigned                qca_force_16bit_ptw:1; /* force 16 bit UTMI */
49 +
50 +       void (*reset_notifier)(struct usb_hcd *hcd);
51  
52         /* required for usb32 quirk */
53         #define OHCI_CTRL_HCFS          (3 << 6)
54 --- a/include/linux/usb/ehci_pdriver.h
55 +++ b/include/linux/usb/ehci_pdriver.h
56 @@ -43,6 +43,8 @@ struct usb_ehci_pdata {
57         unsigned        big_endian_mmio:1;
58         unsigned        no_io_watchdog:1;
59         unsigned        ignore_oc:1;
60 +       unsigned        qca_force_host_mode:1;
61 +       unsigned        qca_force_16bit_ptw:1;
62  
63         /* Turn on all power and clocks */
64         int (*power_on)(struct platform_device *pdev);
65 @@ -51,6 +53,7 @@ struct usb_ehci_pdata {
66         /* Turn on only VBUS suspend power and hotplug detection,
67          * turn off everything else */
68         void (*power_suspend)(struct platform_device *pdev);
69 +       void (*reset_notifier)(struct platform_device *pdev);
70  };
71  
72  #endif /* __USB_CORE_EHCI_PDRIVER_H */
73 --- a/drivers/usb/host/ehci-platform.c
74 +++ b/drivers/usb/host/ehci-platform.c
75 @@ -36,6 +36,14 @@
76  
77  static const char hcd_name[] = "ehci-platform";
78  
79 +static void ehci_platform_reset_notifier(struct usb_hcd *hcd)
80 +{
81 +       struct platform_device *pdev = to_platform_device(hcd->self.controller);
82 +       struct usb_ehci_pdata *pdata = pdev->dev.platform_data;
83 +
84 +       pdata->reset_notifier(pdev);
85 +}
86 +
87  static int ehci_platform_reset(struct usb_hcd *hcd)
88  {
89         struct platform_device *pdev = to_platform_device(hcd->self.controller);
90 @@ -48,6 +56,11 @@ static int ehci_platform_reset(struct us
91         ehci->big_endian_desc = pdata->big_endian_desc;
92         ehci->big_endian_mmio = pdata->big_endian_mmio;
93         ehci->ignore_oc = pdata->ignore_oc;
94 +       ehci->qca_force_host_mode = pdata->qca_force_host_mode;
95 +       ehci->qca_force_16bit_ptw = pdata->qca_force_16bit_ptw;
96 +
97 +       if (pdata->reset_notifier)
98 +               ehci->reset_notifier = ehci_platform_reset_notifier;
99  
100         ehci->caps = hcd->regs + pdata->caps_offset;
101         retval = ehci_setup(hcd);