From owner-freebsd-current@freebsd.org Thu Sep 6 22:41:11 2018 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7BECBFE7FE5 for ; Thu, 6 Sep 2018 22:41:11 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "alchemy.franken.de", Issuer "alchemy.franken.de" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 04C028FC71 for ; Thu, 6 Sep 2018 22:41:10 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.15.2/8.15.2/ALCHEMY.FRANKEN.DE) with ESMTPS id w86Mf8UX089986 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 7 Sep 2018 00:41:09 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.15.2/8.15.2/Submit) id w86Mf895089985; Fri, 7 Sep 2018 00:41:08 +0200 (CEST) (envelope-from marius) Date: Fri, 7 Sep 2018 00:41:08 +0200 From: Marius Strobl To: Jakob Alvermark Cc: FreeBSD Current Subject: Re: SD card reader only works after a suspend/resume Message-ID: <20180906224108.GA65506@alchemy.franken.de> References: <34659383-981f-e627-dfaa-d486685a11f5@alvermark.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <34659383-981f-e627-dfaa-d486685a11f5@alvermark.net> User-Agent: Mutt/1.9.2 (2017-12-15) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (alchemy.franken.de [0.0.0.0]); Fri, 07 Sep 2018 00:41:09 +0200 (CEST) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 22:41:11 -0000 On Thu, Sep 06, 2018 at 12:33:39PM +0200, Jakob Alvermark wrote: > Hi, > > > I discovered this by chance. > > The SD card reader in my laptop has never worked, but now I noticed it > does after suspending and resuming. > > The controller is probed and attached on boot: > > sdhci_acpi1: iomem > 0x90a00000-0x90a00fff irq 47 on acpi0 > > But nothing happens if I put a card in. Unless I suspend and resume: > > mmc1: on sdhci_acpi1 > mmcsd0: 32GB at mmc1 > 50.0MHz/4bit/65535-block > > Then I can remove and replug cards and it seems to work just fine. I believe that making SD card insertion/removal with the integrated SDHCI controlers of newer Intel SoCs work out-of-the-box requires support for ACPI GPE interrupts and ACPI GPIO events respectively to be added to FreeBSD. Otherwise insertion/removal interrutps/events aren't reported and polling the card present state doesn't generally work as a workaround with these controllers either, unfortunately. I'm not aware of anyone working on the former, though. Polling the card present state happens to work one time after SDHCI initialization with these controllers which is why a card will be attached when inserted as part of a suspend/resume cycle (resume of mmc(4) had some bugs until some months ago, which probably explains why that procedure hasn't worked as a workaround for you in the past). Inserting the card before boot, unloading/loading sdhci_acpi.ko or triggering detach/attach of sdhci_acpi(4) via devctl(8) should allow to attach a card, too. Marius