From owner-freebsd-current@freebsd.org Mon Jun 13 09:39:11 2016 Return-Path: Delivered-To: freebsd-current@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 15BFAAF13B5 for ; Mon, 13 Jun 2016 09:39:11 +0000 (UTC) (envelope-from imre@vdsz.com) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.134]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mout.kundenserver.de", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 800EC22D8 for ; Mon, 13 Jun 2016 09:39:09 +0000 (UTC) (envelope-from imre@vdsz.com) Received: from vdsz.de ([46.38.233.25]) by mrelayeu.kundenserver.de (mreue004) with ESMTPSA (Nemesis) id 0MSVlI-1b2Nv72VOe-00RZMm for ; Mon, 13 Jun 2016 11:39:02 +0200 Received: from localhost (vdsz.de [local]) by vdsz.de (OpenSMTPD) with ESMTPA id 284328eb; Mon, 13 Jun 2016 11:38:58 +0200 (CEST) Date: Mon, 13 Jun 2016 11:38:57 +0200 From: Imre Vadasz To: freebsd-current@freebsd.org Cc: Lundberg@polaris.intra.vdsz.de, Johannes Subject: Re: GPIO driver for Intel Atom SoC Message-ID: <20160613093857.GA157051@polaris.intra.vdsz.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.5.24 (2015-08-30) X-Provags-ID: V03:K0:xFMYeZVQzsPqu2psvVeMIstc6PvWgnumAjz7F0Mn2/zUsgIVtg2 tWwzpOk6sv7Fhwt8Z96YunSZzrQTfb0Cmxo0Fo+X6B2SNwgOvvBu2IticJpqU232gJ/scrh +MJw3didMolNr1A3UvzxaHVdvbFGgRC6k0dj9Ce7kw/dVXPMRJCyZPPzHR63JzZgN4K7C1W 1S+WaRwe93W+3xomVnNUg== X-UI-Out-Filterresults: notjunk:1;V01:K0:PS9Z/NY4Pgg=:9ighREcZtmsUUANWB+2Q8n LO8LHBdPEaMfOFpwYtd9pr/iBawxjY7qg/cFqMgT8cqiNax06Kr+fzMhKG4PIpLaFNDuXG3Cg EqD9Yk+D3BkyWvrSbN89F9071vJLI57yIHFnWNc/BPbf4LHztpO6sxFvNEsbECA6XmqpIaGI+ GdBeeM3kmR7XQTWJ2GPf06gNPoYSvstylSEIOl8FiRTBh2LNjed78BysvMpVUnBzEyLhbb9Ts NFKalPuN3j7Y1T/Psjj5DqtDB277HRe0YPwvmDG6YZBw0yhPQ+NC++c9tvw4axJApm+LWWP6x Yqcw81oX8ER6nWJYP3EaFJypEPSHGIXf62oX9/FIM2Zs6zwUvom9XaCyI3Gl44QGDk+9clHaR /VZiSag1rliTUnIsezzPoVUR90PXaEcWqgFNkb/I6TQIEseVmMrkXWfJy5epgGpE5MTRPX6A7 5WbJ2bluEGfFjqIDVMrUZzu/Wb3tpVsRcGX5EjcBxDd9Kwq1RUtUZoO/eojX/l4PH2rSCQyR2 1cJXjo00eDuLmtEG1kKRXhG3XzyhrJc+wtKGk3oJ5yyJOvMoD1K2oi0gDisi6vhiBpXMB88IT 5ptzkTcI3ahTCnGVKo/AfITRZ7Iqp8+cNj39EGYFnmDg8OiZ6IvdC+FowE3QM0oIGv6gFUbRN 9aF7vQtsWLAWRlVCq0luwX6/RkV0fV13YvWJktGo+XoRRTE0x1qYzwToXJ24WrHpaC4A= X-Mailman-Approved-At: Mon, 13 Jun 2016 11:04:23 +0000 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.22 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: Mon, 13 Jun 2016 09:39:11 -0000 Hi, Microsoft has some documentation on GPIO handling with SD card controllers, which should apply to most Cherryview devices: https://msdn.microsoft.com/windows/hardware/drivers/bringup/other-acpi-namespace-objects#sd I did some work on Cherryview SoC support in DragonFlyBSD. In DragonFly master, there is a simple GPIO driver for cherryview in /sys/bus/gpio/gpio_intel. In master, it's currently only used for handling the ACPI GeneralPurposeIo operation regions, and Acpi-Event-Interrupts (which replace GPE interrupts on reduced-hardware platforms). I have some further (more prototype level) code which also contains some code for Intel sdhci controller integration: https://gitweb.dragonflybsd.org/~ivadasz/dragonfly.git/shortlog/refs/heads/cherryview With this branch everything sdcard/eMMC related works quite nicely, e.g. it properly handles plugging in/out the sd-card on my HP X2 210 detachable on DragonFlyBSD. To handle everything properly this contains a bit of work on mostly ACPI related stuff: ACPI device initialization order needs to be according to the ACPI _DEP methods: https://gitweb.dragonflybsd.org/~ivadasz/dragonfly.git/commitdiff/25dec08cafa3ce9089eb5b216700f4e678b3356d We need to map ACPI nodes to the device objects (and at least track a reference count for debugging): https://gitweb.dragonflybsd.org/~ivadasz/dragonfly.git/commitdiff/23135590ffb33b40f170c786ea95fc133358ebdb Then some kind of API is needed for handling the GeneralPurposeIo resources declared for the device in the ACPI tables (e.g. the sdhci controller). (i.e. some way of attempting to "map" the resource from the device driver): https://gitweb.dragonflybsd.org/~ivadasz/dragonfly.git/commitdiff/d5b3d3447bbdd42a68359aebd61f271bfa830951 And I have a prototype of adapting the sdhci driver to handle the GPIO ACPI resources, as described in "https://msdn.microsoft.com/windows/hardware/drivers/bringup/other-acpi-namespace-objects#sd": https://gitweb.dragonflybsd.org/~ivadasz/dragonfly.git/commitdiff/5d2844c280211cbb256a5ecc3ea27f952149e452 Regards, Imre Vadász