From owner-svn-src-all@freebsd.org Thu Dec 3 11:15:50 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B5E6D4A3A32; Thu, 3 Dec 2020 11:15:50 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmtYf4mr5z3QYH; Thu, 3 Dec 2020 11:15:50 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9282B18A84; Thu, 3 Dec 2020 11:15:50 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B3BFosa091954; Thu, 3 Dec 2020 11:15:50 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B3BFon6091952; Thu, 3 Dec 2020 11:15:50 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202012031115.0B3BFon6091952@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Thu, 3 Dec 2020 11:15:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368299 - head/sys/dev/dwc X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/dev/dwc X-SVN-Commit-Revision: 368299 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 11:15:50 -0000 Author: manu Date: Thu Dec 3 11:15:49 2020 New Revision: 368299 URL: https://svnweb.freebsd.org/changeset/base/368299 Log: if_dwc: Honor snps,pbl property DTS node can have this property which configure the burst length for both TX and RX if it's the same. This unbreak if_dwc on Allwinner A20 and possibly other boards that uses this prop. Reported by: qroxana Modified: head/sys/dev/dwc/if_dwc.c head/sys/dev/dwc/if_dwc.h Modified: head/sys/dev/dwc/if_dwc.c ============================================================================== --- head/sys/dev/dwc/if_dwc.c Thu Dec 3 10:41:06 2020 (r368298) +++ head/sys/dev/dwc/if_dwc.c Thu Dec 3 11:15:49 2020 (r368299) @@ -1496,7 +1496,7 @@ dwc_attach(device_t dev) uint32_t reg; char *phy_mode; phandle_t node; - uint32_t txpbl, rxpbl; + uint32_t txpbl, rxpbl, pbl; bool nopblx8 = false; bool fixed_burst = false; @@ -1516,10 +1516,12 @@ dwc_attach(device_t dev) OF_prop_free(phy_mode); } + if (OF_getencprop(node, "snps,pbl", &pbl, sizeof(uint32_t)) <= 0) + pbl = BUS_MODE_DEFAULT_PBL; if (OF_getencprop(node, "snps,txpbl", &txpbl, sizeof(uint32_t)) <= 0) - txpbl = 8; + txpbl = pbl; if (OF_getencprop(node, "snps,rxpbl", &rxpbl, sizeof(uint32_t)) <= 0) - rxpbl = 8; + rxpbl = pbl; if (OF_hasprop(node, "snps,no-pbl-x8") == 1) nopblx8 = true; if (OF_hasprop(node, "snps,fixed-burst") == 1) @@ -1569,6 +1571,7 @@ dwc_attach(device_t dev) reg |= (rxpbl << BUS_MODE_RPBL_SHIFT); if (fixed_burst) reg |= BUS_MODE_FIXEDBURST; + WRITE4(sc, BUS_MODE, reg); /* Modified: head/sys/dev/dwc/if_dwc.h ============================================================================== --- head/sys/dev/dwc/if_dwc.h Thu Dec 3 10:41:06 2020 (r368298) +++ head/sys/dev/dwc/if_dwc.h Thu Dec 3 11:15:49 2020 (r368299) @@ -229,8 +229,8 @@ #define BUS_MODE_PRIORXTX_21 1 #define BUS_MODE_PRIORXTX_11 0 #define BUS_MODE_PBL_SHIFT 8 /* Single block transfer size */ -#define BUS_MODE_PBL_BEATS_8 8 #define BUS_MODE_SWR (1 << 0) /* Reset */ +#define BUS_MODE_DEFAULT_PBL 8 #define TRANSMIT_POLL_DEMAND 0x1004 #define RECEIVE_POLL_DEMAND 0x1008 #define RX_DESCR_LIST_ADDR 0x100C