From owner-svn-src-head@freebsd.org Thu Aug 27 13:08:46 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8849F9C4581; Thu, 27 Aug 2015 13:08:46 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (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 591C1973; Thu, 27 Aug 2015 13:08:46 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t7RD8kHP049586; Thu, 27 Aug 2015 13:08:46 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t7RD8k1q049585; Thu, 27 Aug 2015 13:08:46 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201508271308.t7RD8k1q049585@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 27 Aug 2015 13:08:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287202 - head/sys/dev/mmc/host X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2015 13:08:46 -0000 Author: andrew Date: Thu Aug 27 13:08:45 2015 New Revision: 287202 URL: https://svnweb.freebsd.org/changeset/base/287202 Log: Allow us to select the transfer count. This allows us to work with hardware that seems to only work with a single block at a time. Sponsored by: ABT Systems Ltd Modified: head/sys/dev/mmc/host/dwmmc.c Modified: head/sys/dev/mmc/host/dwmmc.c ============================================================================== --- head/sys/dev/mmc/host/dwmmc.c Thu Aug 27 11:21:34 2015 (r287201) +++ head/sys/dev/mmc/host/dwmmc.c Thu Aug 27 13:08:45 2015 (r287202) @@ -111,8 +111,8 @@ struct idmac_desc { uint32_t des3; /* buf2 phys addr or next descr */ }; -#define DESC_COUNT 256 -#define DESC_SIZE (sizeof(struct idmac_desc) * DESC_COUNT) +#define DESC_MAX 256 +#define DESC_SIZE (sizeof(struct idmac_desc) * DESC_MAX) #define DEF_MSIZE 0x2 /* Burst size of multiple transaction */ struct dwmmc_softc { @@ -130,6 +130,7 @@ struct dwmmc_softc { uint32_t use_auto_stop; uint32_t use_pio; uint32_t pwren_inverted; + u_int desc_count; bus_dma_tag_t desc_tag; bus_dmamap_t desc_map; @@ -283,10 +284,10 @@ dma_setup(struct dwmmc_softc *sc) return (1); } - for (idx = 0; idx < DESC_COUNT; idx++) { + for (idx = 0; idx < sc->desc_count; idx++) { sc->desc_ring[idx].des0 = DES0_CH; sc->desc_ring[idx].des1 = 0; - nidx = (idx + 1) % DESC_COUNT; + nidx = (idx + 1) % sc->desc_count; sc->desc_ring[idx].des3 = sc->desc_ring_paddr + \ (nidx * sizeof(struct idmac_desc)); } @@ -297,8 +298,8 @@ dma_setup(struct dwmmc_softc *sc) BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - DESC_COUNT*MMC_SECTOR_SIZE, /* maxsize */ - DESC_COUNT, /* nsegments */ + sc->desc_count * MMC_SECTOR_SIZE, /* maxsize */ + sc->desc_count, /* nsegments */ MMC_SECTOR_SIZE, /* maxsegsize */ 0, /* flags */ NULL, NULL, /* lockfunc, lockarg */ @@ -578,6 +579,7 @@ dwmmc_attach(device_t dev) sc->use_pio = 0; sc->pwren_inverted = 0; + sc->desc_count = DESC_MAX; if ((sc->hwtype & HWTYPE_MASK) == HWTYPE_ROCKCHIP) { sc->use_pio = 1; @@ -1131,7 +1133,7 @@ dwmmc_read_ivar(device_t bus, device_t c *(int *)result = sc->host.caps; break; case MMCBR_IVAR_MAX_DATA: - *(int *)result = DESC_COUNT; + *(int *)result = sc->desc_count; } return (0); }