瀏覽代碼

usb: gadget: omap_udc: Remove omap2 support

There are no active users of this code for omap2 as
the boards in use have either TUSB or MUSB controller.

While at it, also fix warnings related to uninitialized
dc_clk and hhc_clk.

Cc: linux-usb@vger.kernel.org
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Tony Lindgren 13 年之前
父節點
當前提交
ae3725716e
共有 1 個文件被更改,包括 23 次插入90 次删除
  1. 23 90
      drivers/usb/gadget/omap_udc.c

+ 23 - 90
drivers/usb/gadget/omap_udc.c

@@ -61,9 +61,6 @@
 
 
 #define	DMA_ADDR_INVALID	(~(dma_addr_t)0)
 #define	DMA_ADDR_INVALID	(~(dma_addr_t)0)
 
 
-#define OMAP2_DMA_CH(ch)	(((ch) - 1) << 1)
-#define OMAP24XX_DMA(name, ch)	(OMAP24XX_DMA_##name + OMAP2_DMA_CH(ch))
-
 /*
 /*
  * The OMAP UDC needs _very_ early endpoint setup:  before enabling the
  * The OMAP UDC needs _very_ early endpoint setup:  before enabling the
  * D+ pullup to allow enumeration.  That's too early for the gadget
  * D+ pullup to allow enumeration.  That's too early for the gadget
@@ -536,12 +533,8 @@ static void next_in_dma(struct omap_ep *ep, struct omap_req *req)
 				: OMAP_DMA_SYNC_ELEMENT;
 				: OMAP_DMA_SYNC_ELEMENT;
 	int		dma_trigger = 0;
 	int		dma_trigger = 0;
 
 
-	if (cpu_is_omap24xx())
-		dma_trigger = OMAP24XX_DMA(USB_W2FC_TX0, ep->dma_channel);
-
 	/* measure length in either bytes or packets */
 	/* measure length in either bytes or packets */
 	if ((cpu_is_omap16xx() && length <= UDC_TXN_TSC)
 	if ((cpu_is_omap16xx() && length <= UDC_TXN_TSC)
-			|| (cpu_is_omap24xx() && length < ep->maxpacket)
 			|| (cpu_is_omap15xx() && length < ep->maxpacket)) {
 			|| (cpu_is_omap15xx() && length < ep->maxpacket)) {
 		txdma_ctrl = UDC_TXN_EOT | length;
 		txdma_ctrl = UDC_TXN_EOT | length;
 		omap_set_dma_transfer_params(ep->lch, OMAP_DMA_DATA_TYPE_S8,
 		omap_set_dma_transfer_params(ep->lch, OMAP_DMA_DATA_TYPE_S8,
@@ -600,28 +593,14 @@ static void next_out_dma(struct omap_ep *ep, struct omap_req *req)
 	int dma_trigger = 0;
 	int dma_trigger = 0;
 	u16 w;
 	u16 w;
 
 
-	if (cpu_is_omap24xx())
-		dma_trigger = OMAP24XX_DMA(USB_W2FC_RX0, ep->dma_channel);
-
-	/* NOTE:  we filtered out "short reads" before, so we know
-	 * the buffer has only whole numbers of packets.
-	 * except MODE SELECT(6) sent the 24 bytes data in OMAP24XX DMA mode
-	 */
-	if (cpu_is_omap24xx() && packets < ep->maxpacket) {
-		omap_set_dma_transfer_params(ep->lch, OMAP_DMA_DATA_TYPE_S8,
-				packets, 1, OMAP_DMA_SYNC_ELEMENT,
-				dma_trigger, 0);
-		req->dma_bytes = packets;
-	} else {
-		/* set up this DMA transfer, enable the fifo, start */
-		packets /= ep->ep.maxpacket;
-		packets = min(packets, (unsigned)UDC_RXN_TC + 1);
-		req->dma_bytes = packets * ep->ep.maxpacket;
-		omap_set_dma_transfer_params(ep->lch, OMAP_DMA_DATA_TYPE_S16,
-				ep->ep.maxpacket >> 1, packets,
-				OMAP_DMA_SYNC_ELEMENT,
-				dma_trigger, 0);
-	}
+	/* set up this DMA transfer, enable the fifo, start */
+	packets /= ep->ep.maxpacket;
+	packets = min(packets, (unsigned)UDC_RXN_TC + 1);
+	req->dma_bytes = packets * ep->ep.maxpacket;
+	omap_set_dma_transfer_params(ep->lch, OMAP_DMA_DATA_TYPE_S16,
+			ep->ep.maxpacket >> 1, packets,
+			OMAP_DMA_SYNC_ELEMENT,
+			dma_trigger, 0);
 	omap_set_dma_dest_params(ep->lch, OMAP_DMA_PORT_EMIFF,
 	omap_set_dma_dest_params(ep->lch, OMAP_DMA_PORT_EMIFF,
 		OMAP_DMA_AMODE_POST_INC, req->req.dma + req->req.actual,
 		OMAP_DMA_AMODE_POST_INC, req->req.dma + req->req.actual,
 		0, 0);
 		0, 0);
@@ -760,10 +739,7 @@ static void dma_channel_claim(struct omap_ep *ep, unsigned channel)
 	ep->dma_channel = channel;
 	ep->dma_channel = channel;
 
 
 	if (is_in) {
 	if (is_in) {
-		if (cpu_is_omap24xx())
-			dma_channel = OMAP24XX_DMA(USB_W2FC_TX0, channel);
-		else
-			dma_channel = OMAP_DMA_USB_W2FC_TX0 - 1 + channel;
+		dma_channel = OMAP_DMA_USB_W2FC_TX0 - 1 + channel;
 		status = omap_request_dma(dma_channel,
 		status = omap_request_dma(dma_channel,
 			ep->ep.name, dma_error, ep, &ep->lch);
 			ep->ep.name, dma_error, ep, &ep->lch);
 		if (status == 0) {
 		if (status == 0) {
@@ -780,11 +756,7 @@ static void dma_channel_claim(struct omap_ep *ep, unsigned channel)
 				0, 0);
 				0, 0);
 		}
 		}
 	} else {
 	} else {
-		if (cpu_is_omap24xx())
-			dma_channel = OMAP24XX_DMA(USB_W2FC_RX0, channel);
-		else
-			dma_channel = OMAP_DMA_USB_W2FC_RX0 - 1 + channel;
-
+		dma_channel = OMAP_DMA_USB_W2FC_RX0 - 1 + channel;
 		status = omap_request_dma(dma_channel,
 		status = omap_request_dma(dma_channel,
 			ep->ep.name, dma_error, ep, &ep->lch);
 			ep->ep.name, dma_error, ep, &ep->lch);
 		if (status == 0) {
 		if (status == 0) {
@@ -808,7 +780,7 @@ static void dma_channel_claim(struct omap_ep *ep, unsigned channel)
 		omap_disable_dma_irq(ep->lch, OMAP_DMA_BLOCK_IRQ);
 		omap_disable_dma_irq(ep->lch, OMAP_DMA_BLOCK_IRQ);
 
 
 		/* channel type P: hw synch (fifo) */
 		/* channel type P: hw synch (fifo) */
-		if (cpu_class_is_omap1() && !cpu_is_omap15xx())
+		if (!cpu_is_omap15xx())
 			omap_set_dma_channel_mode(ep->lch, OMAP_DMA_LCH_P);
 			omap_set_dma_channel_mode(ep->lch, OMAP_DMA_LCH_P);
 	}
 	}
 
 
@@ -928,13 +900,11 @@ omap_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
 
 
 	/* this isn't bogus, but OMAP DMA isn't the only hardware to
 	/* this isn't bogus, but OMAP DMA isn't the only hardware to
 	 * have a hard time with partial packet reads...  reject it.
 	 * have a hard time with partial packet reads...  reject it.
-	 * Except OMAP2 can handle the small packets.
 	 */
 	 */
 	if (use_dma
 	if (use_dma
 			&& ep->has_dma
 			&& ep->has_dma
 			&& ep->bEndpointAddress != 0
 			&& ep->bEndpointAddress != 0
 			&& (ep->bEndpointAddress & USB_DIR_IN) == 0
 			&& (ep->bEndpointAddress & USB_DIR_IN) == 0
-			&& !cpu_class_is_omap2()
 			&& (req->req.length % ep->ep.maxpacket) != 0) {
 			&& (req->req.length % ep->ep.maxpacket) != 0) {
 		DBG("%s, no partial packet OUT reads\n", __func__);
 		DBG("%s, no partial packet OUT reads\n", __func__);
 		return -EMSGSIZE;
 		return -EMSGSIZE;
@@ -2090,10 +2060,6 @@ static inline int machine_without_vbus_sense(void)
 {
 {
 	return (machine_is_omap_innovator()
 	return (machine_is_omap_innovator()
 		|| machine_is_omap_osk()
 		|| machine_is_omap_osk()
-		|| machine_is_omap_apollon()
-#ifndef CONFIG_MACH_OMAP_H4_OTG
-		|| machine_is_omap_h4()
-#endif
 		|| machine_is_sx1()
 		|| machine_is_sx1()
 		|| cpu_is_omap7xx() /* No known omap7xx boards with vbus sense */
 		|| cpu_is_omap7xx() /* No known omap7xx boards with vbus sense */
 		);
 		);
@@ -2307,12 +2273,9 @@ static int proc_otg_show(struct seq_file *s)
 	u32		trans = 0;
 	u32		trans = 0;
 	char		*ctrl_name = "(UNKNOWN)";
 	char		*ctrl_name = "(UNKNOWN)";
 
 
-	/* XXX This needs major revision for OMAP2+ */
 	tmp = omap_readl(OTG_REV);
 	tmp = omap_readl(OTG_REV);
-	if (cpu_class_is_omap1()) {
-		ctrl_name = "tranceiver_ctrl";
-		trans = omap_readw(USB_TRANSCEIVER_CTRL);
-	}
+	ctrl_name = "tranceiver_ctrl";
+	trans = omap_readw(USB_TRANSCEIVER_CTRL);
 	seq_printf(s, "\nOTG rev %d.%d, %s %05x\n",
 	seq_printf(s, "\nOTG rev %d.%d, %s %05x\n",
 		tmp >> 4, tmp & 0xf, ctrl_name, trans);
 		tmp >> 4, tmp & 0xf, ctrl_name, trans);
 	tmp = omap_readw(OTG_SYSCON_1);
 	tmp = omap_readw(OTG_SYSCON_1);
@@ -2399,14 +2362,12 @@ static int proc_udc_show(struct seq_file *s, void *_)
 		HMC,
 		HMC,
 		udc->transceiver
 		udc->transceiver
 			? udc->transceiver->label
 			? udc->transceiver->label
-			: ((cpu_is_omap1710() || cpu_is_omap24xx())
+			: (cpu_is_omap1710()
 				? "external" : "(none)"));
 				? "external" : "(none)"));
-	if (cpu_class_is_omap1()) {
-		seq_printf(s, "ULPD control %04x req %04x status %04x\n",
-			omap_readw(ULPD_CLOCK_CTRL),
-			omap_readw(ULPD_SOFT_REQ),
-			omap_readw(ULPD_STATUS_REQ));
-	}
+	seq_printf(s, "ULPD control %04x req %04x status %04x\n",
+		omap_readw(ULPD_CLOCK_CTRL),
+		omap_readw(ULPD_SOFT_REQ),
+		omap_readw(ULPD_STATUS_REQ));
 
 
 	/* OTG controller registers */
 	/* OTG controller registers */
 	if (!cpu_is_omap15xx())
 	if (!cpu_is_omap15xx())
@@ -2591,7 +2552,7 @@ omap_ep_setup(char *name, u8 addr, u8 type,
 		 * and ignored for PIO-IN on newer chips
 		 * and ignored for PIO-IN on newer chips
 		 * (for more reliable behavior)
 		 * (for more reliable behavior)
 		 */
 		 */
-		if (!use_dma || cpu_is_omap15xx() || cpu_is_omap24xx())
+		if (!use_dma || cpu_is_omap15xx())
 			dbuf = 0;
 			dbuf = 0;
 
 
 		switch (maxp) {
 		switch (maxp) {
@@ -2795,8 +2756,8 @@ static int __init omap_udc_probe(struct platform_device *pdev)
 	struct usb_phy		*xceiv = NULL;
 	struct usb_phy		*xceiv = NULL;
 	const char		*type = NULL;
 	const char		*type = NULL;
 	struct omap_usb_config	*config = pdev->dev.platform_data;
 	struct omap_usb_config	*config = pdev->dev.platform_data;
-	struct clk		*dc_clk;
-	struct clk		*hhc_clk;
+	struct clk		*dc_clk = NULL;
+	struct clk		*hhc_clk = NULL;
 
 
 	/* NOTE:  "knows" the order of the resources! */
 	/* NOTE:  "knows" the order of the resources! */
 	if (!request_mem_region(pdev->resource[0].start,
 	if (!request_mem_region(pdev->resource[0].start,
@@ -2816,16 +2777,6 @@ static int __init omap_udc_probe(struct platform_device *pdev)
 		udelay(100);
 		udelay(100);
 	}
 	}
 
 
-	if (cpu_is_omap24xx()) {
-		dc_clk = clk_get(&pdev->dev, "usb_fck");
-		hhc_clk = clk_get(&pdev->dev, "usb_l4_ick");
-		BUG_ON(IS_ERR(dc_clk) || IS_ERR(hhc_clk));
-		/* can't use omap_udc_enable_clock yet */
-		clk_enable(dc_clk);
-		clk_enable(hhc_clk);
-		udelay(100);
-	}
-
 	if (cpu_is_omap7xx()) {
 	if (cpu_is_omap7xx()) {
 		dc_clk = clk_get(&pdev->dev, "usb_dc_ck");
 		dc_clk = clk_get(&pdev->dev, "usb_dc_ck");
 		hhc_clk = clk_get(&pdev->dev, "l3_ocpi_ck");
 		hhc_clk = clk_get(&pdev->dev, "l3_ocpi_ck");
@@ -2875,14 +2826,6 @@ static int __init omap_udc_probe(struct platform_device *pdev)
 
 
 		hmc = HMC_1610;
 		hmc = HMC_1610;
 
 
-		if (cpu_is_omap24xx()) {
-			/* this could be transceiverless in one of the
-			 * "we don't need to know" modes.
-			 */
-			type = "external";
-			goto known;
-		}
-
 		switch (hmc) {
 		switch (hmc) {
 		case 0:			/* POWERUP DEFAULT == 0 */
 		case 0:			/* POWERUP DEFAULT == 0 */
 		case 4:
 		case 4:
@@ -2921,7 +2864,7 @@ bad_on_1710:
 			goto cleanup0;
 			goto cleanup0;
 		}
 		}
 	}
 	}
-known:
+
 	INFO("hmc mode %d, %s transceiver\n", hmc, type);
 	INFO("hmc mode %d, %s transceiver\n", hmc, type);
 
 
 	/* a "gadget" abstracts/virtualizes the controller */
 	/* a "gadget" abstracts/virtualizes the controller */
@@ -2975,16 +2918,6 @@ known:
 		clk_disable(dc_clk);
 		clk_disable(dc_clk);
 	}
 	}
 
 
-	if (cpu_is_omap24xx()) {
-		udc->dc_clk = dc_clk;
-		udc->hhc_clk = hhc_clk;
-		/* FIXME OMAP2 don't release hhc & dc clock */
-#if 0
-		clk_disable(hhc_clk);
-		clk_disable(dc_clk);
-#endif
-	}
-
 	create_proc_file();
 	create_proc_file();
 	status = device_add(&udc->gadget.dev);
 	status = device_add(&udc->gadget.dev);
 	if (status)
 	if (status)
@@ -3013,7 +2946,7 @@ cleanup0:
 	if (xceiv)
 	if (xceiv)
 		usb_put_transceiver(xceiv);
 		usb_put_transceiver(xceiv);
 
 
-	if (cpu_is_omap16xx() || cpu_is_omap24xx() || cpu_is_omap7xx()) {
+	if (cpu_is_omap16xx() || cpu_is_omap7xx()) {
 		clk_disable(hhc_clk);
 		clk_disable(hhc_clk);
 		clk_disable(dc_clk);
 		clk_disable(dc_clk);
 		clk_put(hhc_clk);
 		clk_put(hhc_clk);