From owner-svn-soc-all@FreeBSD.ORG Sun Jun 7 14:26:27 2015 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6125C2E4 for ; Sun, 7 Jun 2015 14:26:27 +0000 (UTC) (envelope-from pratiksinghal@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4ECAD16C7 for ; Sun, 7 Jun 2015 14:26:27 +0000 (UTC) (envelope-from pratiksinghal@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.9/8.14.9) with ESMTP id t57EQR4r032625 for ; Sun, 7 Jun 2015 14:26:27 GMT (envelope-from pratiksinghal@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.9/8.14.9/Submit) id t57EQQKd032623 for svn-soc-all@FreeBSD.org; Sun, 7 Jun 2015 14:26:26 GMT (envelope-from pratiksinghal@FreeBSD.org) Date: Sun, 7 Jun 2015 14:26:26 GMT Message-Id: <201506071426.t57EQQKd032623@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to pratiksinghal@FreeBSD.org using -f From: pratiksinghal@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r286783 - soc2015/pratiksinghal/cubie-head/sys/arm/allwinner MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jun 2015 14:26:27 -0000 Author: pratiksinghal Date: Sun Jun 7 14:26:26 2015 New Revision: 286783 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=286783 Log: Removed the kernel panic and locking problem Modified: soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_mmc.c Modified: soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_mmc.c ============================================================================== --- soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_mmc.c Sun Jun 7 13:59:02 2015 (r286782) +++ soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_mmc.c Sun Jun 7 14:26:26 2015 (r286783) @@ -211,6 +211,8 @@ sc->a10_use_dma = 0 ; } } + //sc->a10_use_dma = 0 ; /* Remove this after testing */ + device_printf(sc->a10_dev, "Setting up dma finished %d\n", sc->a10_use_dma) ; return (0); fail: @@ -258,16 +260,21 @@ static int a10_mmc_prepare_dma(struct a10_mmc_softc* sc) { + device_printf(sc->a10_dev, "In the start of prepare dma\n") ; struct a10_mmc_dma_desc* dma = sc->a10_dma_desc ; struct mmc_command* cmd = sc->a10_req->cmd ; + device_printf(sc->a10_dev, "After the cmd part\n") ; int read = (sc->a10_req->cmd->data->flags & MMC_DATA_WRITE) ? 0 : 1 ; + device_printf(sc->a10_dev, "After the read part\n") ; bus_addr_t desc_paddr = (sc->a10_dma_cb_arg).addr ; + device_printf(sc->a10_dev, "After the block before the for loop\n") ; bus_size_t off = 0 ; int desc, rem,seg ; uint32_t val ; desc = 0 ; + device_printf(sc->a10_dev, "Before the starting of for loop\n") ; /* Pick a segment and program all the descriptors in the segment. */ for(seg = 0; seg < sc->a10_dma_cb_arg.nsegs ; seg++) { @@ -303,11 +310,13 @@ } } + device_printf(sc->a10_dev, "After the for loop in a10_prepare_dma\n") ; if(desc == sc->a10_dma_ndesc) { device_printf(sc->a10_dev, "Couldn't find enough descriptors for DMA transfer") ; return EIO ; } + device_printf(sc->a10_dev, "After the desc check\n") ; bus_dmamap_sync(sc->a10_dma_tag, sc->a10_dma_map, BUS_DMASYNC_PREWRITE) ; val = A10_MMC_READ_4(sc, A10_MMC_GCTRL) ; @@ -331,7 +340,8 @@ A10_MMC_WRITE_4(sc, A10_MMC_IDIE,val) ; A10_MMC_WRITE_4(sc, A10_MMC_DLBA,desc_paddr) ; A10_MMC_WRITE_4(sc, A10_MMC_FTRGL,A10_MMC_DMA_FTRGLEVEL_A20) ; - + + device_printf(sc->a10_dev, "Done preparing for DMA\n") ; return (0) ; } @@ -500,7 +510,7 @@ rint = A10_MMC_READ_4(sc, A10_MMC_RINTR); imask = A10_MMC_READ_4(sc, A10_MMC_IMASK); idst = A10_MMC_READ_4(sc, A10_MMC_IDST) ; - if (imask == 0 && rint == 0) { + if (imask == 0 && rint == 0 ) { A10_MMC_UNLOCK(sc); return; } @@ -539,6 +549,12 @@ else a10_mmc_req_ok(sc) ; } + else + a10_mmc_req_done(sc) ; + + A10_MMC_WRITE_4(sc, A10_MMC_IDST, idst) ; + A10_MMC_WRITE_4(sc, A10_MMC_RINTR, rint) ; + A10_MMC_UNLOCK(sc) ; return ; } @@ -575,6 +591,7 @@ uint32_t cmdreg; sc = device_get_softc(bus); + device_printf(sc->a10_dev, "a10_req = %p\n", sc->a10_req) ; A10_MMC_LOCK(sc); if (sc->a10_req) { A10_MMC_UNLOCK(sc); @@ -609,13 +626,12 @@ blksz = min(cmd->data->len, MMC_SECTOR_SIZE); A10_MMC_WRITE_4(sc, A10_MMC_BLKSZ, blksz); A10_MMC_WRITE_4(sc, A10_MMC_BCNTR, cmd->data->len); + if(sc->a10_use_dma == 1) + a10_mmc_prepare_dma(sc) ; } A10_MMC_WRITE_4(sc, A10_MMC_CARG, cmd->arg); - if(sc->a10_use_dma == 1) - a10_mmc_prepare_dma(sc) ; A10_MMC_WRITE_4(sc, A10_MMC_CMDR, cmdreg | cmd->opcode); - callout_reset(&sc->a10_timeoutc, sc->a10_timeout * hz, a10_mmc_timeout, sc); A10_MMC_UNLOCK(sc);