usb: ums: remove ci_udc special case
[oweals/u-boot.git] / drivers / usb / gadget / s3c_udc_otg.c
index f9d24e3dfdc02ab6a613a3a1a1ad964bf364aad6..63d4487a9bb15846d9cb7f8af4f9c0a0947dfa18 100644 (file)
  * Marek Szyprowski <m.szyprowski@samsung.com>
  * Lukasz Majewski <l.majewski@samsumg.com>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 #undef DEBUG
 #include <common.h>
@@ -180,8 +167,13 @@ void otg_phy_init(struct s3c_udc *dev)
                writel((readl(&phy->phypwr) &~(OTG_DISABLE_0 | ANALOG_PWRDOWN)
                        &~FORCE_SUSPEND_0), &phy->phypwr);
 
-       writel((readl(&phy->phyclk) &~(ID_PULLUP0 | COMMON_ON_N0)) |
-              CLK_SEL_24MHZ, &phy->phyclk); /* PLL 24Mhz */
+       if (s5p_cpu_id == 0x4412)
+               writel((readl(&phy->phyclk) & ~(EXYNOS4X12_ID_PULLUP0 |
+                       EXYNOS4X12_COMMON_ON_N0)) | EXYNOS4X12_CLK_SEL_24MHZ,
+                      &phy->phyclk); /* PLL 24Mhz */
+       else
+               writel((readl(&phy->phyclk) & ~(ID_PULLUP0 | COMMON_ON_N0)) |
+                      CLK_SEL_24MHZ, &phy->phyclk); /* PLL 24Mhz */
 
        writel((readl(&phy->rstcon) &~(LINK_SW_RST | PHYLNK_SW_RST))
               | PHY_SW_RST0, &phy->rstcon);
@@ -851,7 +843,7 @@ static struct s3c_udc memory = {
 int s3c_udc_probe(struct s3c_plat_otg_data *pdata)
 {
        struct s3c_udc *dev = &memory;
-       int retval = 0, i;
+       int retval = 0;
 
        debug("%s: %p\n", __func__, pdata);
 
@@ -872,16 +864,15 @@ int s3c_udc_probe(struct s3c_plat_otg_data *pdata)
 
        the_controller = dev;
 
-       for (i = 0; i < S3C_MAX_ENDPOINTS+1; i++) {
-               dev->dma_buf[i] = memalign(CONFIG_SYS_CACHELINE_SIZE,
-                                          DMA_BUFFER_SIZE);
-               dev->dma_addr[i] = (dma_addr_t) dev->dma_buf[i];
-               invalidate_dcache_range((unsigned long) dev->dma_buf[i],
-                                       (unsigned long) (dev->dma_buf[i]
-                                                        + DMA_BUFFER_SIZE));
+       usb_ctrl = memalign(CONFIG_SYS_CACHELINE_SIZE,
+                           ROUND(sizeof(struct usb_ctrlrequest),
+                                 CONFIG_SYS_CACHELINE_SIZE));
+       if (!usb_ctrl) {
+               error("No memory available for UDC!\n");
+               return -ENOMEM;
        }
-       usb_ctrl = dev->dma_buf[0];
-       usb_ctrl_dma_addr = dev->dma_addr[0];
+
+       usb_ctrl_dma_addr = (dma_addr_t) usb_ctrl;
 
        udc_reinit(dev);