r3530 - developers/sameo/patches/ar6k-atheros

sameo at sita.openmoko.org sameo at sita.openmoko.org
Wed Nov 28 19:17:42 CET 2007


Author: sameo
Date: 2007-11-28 19:17:41 +0100 (Wed, 28 Nov 2007)
New Revision: 3530

Modified:
   developers/sameo/patches/ar6k-atheros/mach-gta02_wifi.patch
   developers/sameo/patches/ar6k-atheros/s3c24xx_hcd_atheros.patch
Log:
ar6k-atheros: More DMA work.
We know register our DMA channel, and prepare our DMA transfer.



Modified: developers/sameo/patches/ar6k-atheros/mach-gta02_wifi.patch
===================================================================
--- developers/sameo/patches/ar6k-atheros/mach-gta02_wifi.patch	2007-11-28 16:57:31 UTC (rev 3529)
+++ developers/sameo/patches/ar6k-atheros/mach-gta02_wifi.patch	2007-11-28 18:17:41 UTC (rev 3530)
@@ -1,12 +1,12 @@
 ---
- arch/arm/mach-s3c2440/mach-gta02.c |   45 +++++++++++++++++++++++++++++++++----
- 1 file changed, 41 insertions(+), 4 deletions(-)
+ arch/arm/mach-s3c2440/mach-gta02.c |   48 ++++++++++++++++++++++++++++++++++---
+ 1 file changed, 45 insertions(+), 3 deletions(-)
 
 Index: linux-2.6.22/arch/arm/mach-s3c2440/mach-gta02.c
 ===================================================================
---- linux-2.6.22.orig/arch/arm/mach-s3c2440/mach-gta02.c	2007-11-27 17:11:54.000000000 +0100
-+++ linux-2.6.22/arch/arm/mach-s3c2440/mach-gta02.c	2007-11-28 16:16:37.000000000 +0100
-@@ -305,12 +305,36 @@
+--- linux-2.6.22.orig/arch/arm/mach-s3c2440/mach-gta02.c	2007-11-28 16:37:29.000000000 +0100
++++ linux-2.6.22/arch/arm/mach-s3c2440/mach-gta02.c	2007-11-28 19:06:57.000000000 +0100
+@@ -305,6 +305,35 @@
  	},
  };
  
@@ -20,7 +20,12 @@
 +		.flags = IORESOURCE_MEM,
 +		.start = S3C2410_PA_SDI,
 +		.end   = S3C2410_PA_SDI + S3C24XX_SZ_SDI - 1,
-+	}
++	},
++	[2] = {
++		.flags = IORESOURCE_DMA,
++		.start = 0, /* Channel 0 for SDI */
++		.end = 0,
++	},
 +};
 +
 +
@@ -37,14 +42,7 @@
  static struct platform_device *gta02_devices[] __initdata = {
  	&s3c_device_usb,
  	&s3c_device_wdt,
- 	&s3c_device_i2c,
- 	&s3c_device_iis,
--	// &s3c_device_sdi, /* FIXME: temporary disable to avoid s3cmci bind */
-+//	&s3c_device_sdi, /* FIXME: temporary disable to avoid s3cmci bind */
- 	&s3c_device_usbgadget,
- 	&s3c_device_nand,
- 	&s3c_device_ts,
-@@ -651,14 +675,25 @@
+@@ -651,14 +680,25 @@
  	set_s3c2410ts_info(&gta02_ts_cfg);
  
  	/* FIXME: hardcoded WLAN module power-up */
@@ -73,7 +71,7 @@
  		s3c2410_gpio_setpin(GTA02_GPIO_nWLAN_RESET, 1);
  		break;
  	}
-@@ -674,6 +709,8 @@
+@@ -674,6 +714,8 @@
  	mangle_glamo_res_by_system_rev();
  	platform_device_register(&gta02_glamo_dev);
  

Modified: developers/sameo/patches/ar6k-atheros/s3c24xx_hcd_atheros.patch
===================================================================
--- developers/sameo/patches/ar6k-atheros/s3c24xx_hcd_atheros.patch	2007-11-28 16:57:31 UTC (rev 3529)
+++ developers/sameo/patches/ar6k-atheros/s3c24xx_hcd_atheros.patch	2007-11-28 18:17:41 UTC (rev 3530)
@@ -2,14 +2,14 @@
  drivers/sdio/hcd/Kconfig               |    8 
  drivers/sdio/hcd/Makefile              |    1 
  drivers/sdio/hcd/s3c24xx/Makefile      |    2 
- drivers/sdio/hcd/s3c24xx/s3c24xx_hcd.c | 1122 +++++++++++++++++++++++++++++++++
- drivers/sdio/hcd/s3c24xx/s3c24xx_hcd.h |   59 +
- 5 files changed, 1192 insertions(+)
+ drivers/sdio/hcd/s3c24xx/s3c24xx_hcd.c | 1207 +++++++++++++++++++++++++++++++++
+ drivers/sdio/hcd/s3c24xx/s3c24xx_hcd.h |   61 +
+ 5 files changed, 1279 insertions(+)
 
 Index: linux-2.6.22/drivers/sdio/hcd/Kconfig
 ===================================================================
---- linux-2.6.22.orig/drivers/sdio/hcd/Kconfig	2007-11-27 17:16:52.000000000 +0100
-+++ linux-2.6.22/drivers/sdio/hcd/Kconfig	2007-11-27 17:16:52.000000000 +0100
+--- linux-2.6.22.orig/drivers/sdio/hcd/Kconfig	2007-11-28 16:38:00.000000000 +0100
++++ linux-2.6.22/drivers/sdio/hcd/Kconfig	2007-11-28 16:38:00.000000000 +0100
 @@ -46,6 +46,14 @@
  	help
  	  good luck.
@@ -27,8 +27,8 @@
  	depends on SPI
 Index: linux-2.6.22/drivers/sdio/hcd/Makefile
 ===================================================================
---- linux-2.6.22.orig/drivers/sdio/hcd/Makefile	2007-11-27 17:16:52.000000000 +0100
-+++ linux-2.6.22/drivers/sdio/hcd/Makefile	2007-11-27 17:16:52.000000000 +0100
+--- linux-2.6.22.orig/drivers/sdio/hcd/Makefile	2007-11-28 16:38:00.000000000 +0100
++++ linux-2.6.22/drivers/sdio/hcd/Makefile	2007-11-28 16:38:00.000000000 +0100
 @@ -6,3 +6,4 @@
  obj-$(CONFIG_ARCH_OMAP24XX)		+= omap_2420/
  obj-$(CONFIG_PXA27x)			+= pxa270/
@@ -37,15 +37,15 @@
 Index: linux-2.6.22/drivers/sdio/hcd/s3c24xx/Makefile
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.22/drivers/sdio/hcd/s3c24xx/Makefile	2007-11-27 17:16:52.000000000 +0100
++++ linux-2.6.22/drivers/sdio/hcd/s3c24xx/Makefile	2007-11-28 16:38:00.000000000 +0100
 @@ -0,0 +1,2 @@
 +obj-$(CONFIG_PLAT_S3C24XX) += sdio_s3c24xx_hcd.o
 +sdio_s3c24xx_hcd-objs := s3c24xx_hcd.o
 Index: linux-2.6.22/drivers/sdio/hcd/s3c24xx/s3c24xx_hcd.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.22/drivers/sdio/hcd/s3c24xx/s3c24xx_hcd.c	2007-11-28 16:34:22.000000000 +0100
-@@ -0,0 +1,1122 @@
++++ linux-2.6.22/drivers/sdio/hcd/s3c24xx/s3c24xx_hcd.c	2007-11-28 19:03:16.000000000 +0100
+@@ -0,0 +1,1207 @@
 +/*
 + *  s3c24xx_hcd.c - Samsung S3C MCI driver
 + *
@@ -557,6 +557,60 @@
 +	SDIO_HandleHcdEvent(&context->hcd, EVENT_HCD_TRANSFER_DONE);
 +}
 +
++void s3c24xx_hcd_dma_done(struct s3c2410_dma_chan *dma_ch, void *buf_id,
++			  int size, enum s3c2410_dma_buffresult result)
++{
++}
++
++static int s3c24xx_hcd_prepare_dma(struct s3c24xx_hcd_context * context)
++{
++	PSDREQUEST req;
++	SDIO_STATUS status = SDIO_STATUS_SUCCESS;
++	int read = 0, hwcfg = S3C2410_DISRCC_INC | S3C2410_DISRCC_APB;
++	enum s3c2410_dmasrc source = S3C2410_DMASRC_MEM;
++
++	req = GET_CURRENT_REQUEST(&context->hcd);
++	if (req == NULL) {
++		DBG_PRINT(SDDBG_ERROR, ("%s(): No current request\n", __FUNCTION__));
++		status = SDIO_STATUS_ERROR;
++	}
++
++	if (!context->dma_en) {
++		DBG_PRINT(SDDBG_ERROR, ("%s(): DMA is disabled\n", __FUNCTION__));
++		status = SDIO_STATUS_ERROR;
++	}
++
++	if (!IS_SDREQ_DATA_TRANS(req->Flags)) {
++		DBG_PRINT(SDDBG_ERROR, ("%s(): No data to transfer\n", __FUNCTION__));
++		status = SDIO_STATUS_ERROR;
++	}
++
++	if(!IS_SDREQ_WRITE_DATA(req->Flags)) {
++		read = 1;
++		source = S3C2410_DMASRC_HW;
++		hwcfg = S3C2410_DISRCC_APB;
++	}
++
++	s3c2410_dma_devconfig(context->dma_channel, source, hwcfg,
++			      (unsigned long)context->base + S3C2440_SDIDATA);
++
++	s3c2410_dma_config(context->dma_channel, 1,
++			   (S3C2410_DCON_HWTRIG | S3C2410_DCON_CH0_SDI));
++
++	s3c2410_dma_set_buffdone_fn(context->dma_channel, s3c24xx_hcd_dma_done);
++
++	s3c2410_dma_setflags(context->dma_channel, S3C2410_DMAF_AUTOSTART);
++
++	s3c2410_dma_ctrl(context->dma_channel, S3C2410_DMAOP_FLUSH);
++
++	s3c2410_dma_enqueue(context->dma_channel, context,
++			    context->io_buffer_dma,
++			    req->DataRemaining);
++
++	return 0;
++}
++
++
 +static irqreturn_t s3c24xx_hcd_irq(int irq, void *dev_id)
 +{
 +	u32 cmdsta, dsta;
@@ -842,6 +896,11 @@
 +
 +		dcon |= S3C2440_SDIDCON_DATSTART;
 +
++		if (context->dma_en) {
++			dcon |= S3C2410_SDIDCON_DMAEN;
++			s3c24xx_hcd_prepare_dma(context);
++		}
++
 +		writel(dcon, context->base + S3C2410_SDIDCON);
 +
 +		imask |= S3C2410_SDIIMSK_RXFIFOHALF | S3C2410_SDIIMSK_RXFIFOLAST |
@@ -894,6 +953,9 @@
 +
 +		dcon |= S3C2440_SDIDCON_DATSTART;
 +
++		if (context->dma_en)
++			dcon |= S3C2410_SDIDCON_DMAEN;
++
 +		writel(dcon, context->base + S3C2410_SDIDCON);
 +
 +		imask |= S3C2410_SDIIMSK_TXFIFOHALF | S3C2410_SDIIMSK_TXFIFOEMPTY |
@@ -928,8 +990,6 @@
 +	SDIO_STATUS status = SDIO_STATUS_SUCCESS;
 +	u32 con, datacon;
 +
-+	printk("######## %s() ############\n", __FUNCTION__);
-+
 +	/* Clock */
 +	context->device.clock = clk_get(NULL, "sdi");
 +	if (IS_ERR(context->device.clock)) {
@@ -983,7 +1043,9 @@
 +		goto out_unmap_mem_region;
 +	}
 +
-+	context->io_buffer_size = 4 * 4024;
++
++	/* DMA */
++	context->io_buffer_size = 4 * 4096;
 +	context->io_buffer = dma_alloc_coherent(&context->pdev->dev,
 +						context->io_buffer_size,
 +						&context->io_buffer_dma,
@@ -996,7 +1058,13 @@
 +
 +	}
 +
++	if (s3c2410_dma_request(context->dma_channel, &s3c24xx_hcd_dma_client, NULL)) {
++		DBG_PRINT(SDDBG_ERROR, ("unable to get DMA channel.\n"));
++		status = -ENOENT;
++		goto out_free_dma;
++	}
 +
++
 +	/* Set multiplexing */
 +	s3c2410_gpio_cfgpin(S3C2410_GPE5, S3C2410_GPE5_SDCLK);
 +	s3c2410_gpio_cfgpin(S3C2410_GPE6, S3C2410_GPE6_SDCMD);
@@ -1013,11 +1081,16 @@
 +	datacon |= S3C2410_SDIDCON_WIDEBUS;
 +	writel(datacon, context->base + S3C2410_SDIDCON);
 +
-+	printk("S3c24xx SDIO: IRQ:%d Detect IRQ: %d base at 0x%p PCLK@%ld kHz\n",
-+	       context->io_irq, context->cd_irq, context->base, context->device.max_clock_rate/1000);
++	printk("S3c24xx SDIO: IRQ:%d Detect IRQ:%d DMA channel:%d base at 0x%p PCLK@%ld kHz\n",
++	       context->io_irq, context->cd_irq, context->dma_channel, context->base,
++	       context->device.max_clock_rate/1000);
 +
 +	return SDIOErrorToOSError(status);
 +
++ out_free_dma:
++	dma_free_coherent(&context->pdev->dev,context->io_buffer_size,
++			  context->io_buffer, context->io_buffer_dma);
++
 + out_free_irq:
 +	free_irq(context->io_irq, context);
 +
@@ -1039,6 +1112,8 @@
 +	free_irq(context->io_irq, context);
 +	iounmap(context->base);
 +	release_mem_region(context->mem->start, RESSIZE(context->mem));
++	dma_free_coherent(&context->pdev->dev,context->io_buffer_size,
++			  context->io_buffer, context->io_buffer_dma);
 +}
 +
 +static int s3c24xx_hcd_pnp_probe(struct pnp_dev *pBusDevice, const struct pnp_device_id *pId)
@@ -1095,6 +1170,7 @@
 +static int s3c24xx_hcd_probe(struct platform_device * pdev)
 +{
 +	SDIO_STATUS status = SDIO_STATUS_SUCCESS;
++	struct resource *r = NULL;
 +
 +	printk("S3c2440 SDIO Host controller\n");
 +
@@ -1109,11 +1185,20 @@
 +
 +	hcd_context.io_irq = platform_get_irq(pdev, 0);
 +	if (hcd_context.io_irq == 0) {
-+		DBG_PRINT(SDDBG_ERROR, ("No memory region\n"));
++		DBG_PRINT(SDDBG_ERROR, ("No IRQ\n"));
 +		status = SDIO_STATUS_NO_RESOURCES;
 +		goto out;
 +	}
 +
++	r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
++	if (r == NULL) {
++		DBG_PRINT(SDDBG_ERROR, ("No DMA channel\n"));
++		status = SDIO_STATUS_NO_RESOURCES;
++		goto out;
++	}
++	hcd_context.dma_channel = r->start;
++	hcd_context.dma_en = 0;
++
 +	hcd_context.int_sdio = 0;
 +	hcd_context.int_sdio_reported = 0;
 +	hcd_context.int_sdio_pending = 0;
@@ -1133,7 +1218,7 @@
 +
 +/*
 + * module cleanup
-+*/
++ */
 +static int s3c24xx_hcd_remove(struct platform_device * pdev) {
 +	printk("S3C2440 SDIO host controller unloaded\n");
 +	SDIO_BusRemoveOSDevice(&hcd_context.device.pnp_driver, &hcd_context.device.pnp_device);
@@ -1171,8 +1256,8 @@
 Index: linux-2.6.22/drivers/sdio/hcd/s3c24xx/s3c24xx_hcd.h
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.22/drivers/sdio/hcd/s3c24xx/s3c24xx_hcd.h	2007-11-28 16:05:12.000000000 +0100
-@@ -0,0 +1,59 @@
++++ linux-2.6.22/drivers/sdio/hcd/s3c24xx/s3c24xx_hcd.h	2007-11-28 18:23:58.000000000 +0100
+@@ -0,0 +1,61 @@
 +#ifndef __SDIO_S3C24XX_HCD_H___
 +#define __SDIO_S3C24XX_HCD_H___
 +
@@ -1213,6 +1298,8 @@
 +	void                      *io_buffer;         /* Kernel address */
 +	dma_addr_t                io_buffer_dma;      /* Bus address */
 +	UINT32                    io_buffer_size;
++	UINT32                    dma_channel;
++	UINT32                    dma_en;
 +
 +	UINT32		  	  int_mask;
 +	UINT32		  	  int_sdio;            /* Do we have SDIO interrupt on ? */





More information about the commitlog mailing list