From owner-svn-src-all@FreeBSD.ORG Sat Jul 21 12:22:36 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 646C4106566C; Sat, 21 Jul 2012 12:22:36 +0000 (UTC) (envelope-from Daan@vitsch.nl) Received: from VM01.VEHosting.nl (VM016.VEHosting.nl [IPv6:2001:1af8:2100:b020::140]) by mx1.freebsd.org (Postfix) with ESMTP id 001598FC0A; Sat, 21 Jul 2012 12:22:35 +0000 (UTC) Received: from [2001:470:d233:2:224:8cff:fe82:66cd] ([IPv6:2001:470:d233:2:224:8cff:fe82:66cd]) (authenticated bits=0) by VM01.VEHosting.nl (8.14.3/8.13.8) with ESMTP id q6LCMamd063737; Sat, 21 Jul 2012 14:22:36 +0200 (CEST) (envelope-from Daan@vitsch.nl) From: Daan Vreeken Organization: Vitsch Electronics To: Gleb Smirnoff Date: Sat, 21 Jul 2012 14:22:33 +0200 User-Agent: KMail/1.9.10 References: <201206181056.q5IAuUwX075136@svn.freebsd.org> In-Reply-To: <201206181056.q5IAuUwX075136@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201207211422.33791.Daan@vitsch.nl> x-ve-auth-version: mi-1.1.5 2011-02-07 - Copyright (c) 2008, 2011 - Daan Vreeken - VEHosting x-ve-auth: authenticated as 'pa4dan' on VM01.VEHosting.nl Cc: svn-src-all@freebsd.org Subject: Re: svn commit: r237224 - stable/9/sys/dev/sdhci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 21 Jul 2012 12:22:36 -0000 Hi Gleb, On Monday 18 June 2012 12:56:30 Gleb Smirnoff wrote: > Author: glebius > Date: Mon Jun 18 10:56:29 2012 > New Revision: 237224 > URL: http://svn.freebsd.org/changeset/base/237224 > > Log: > Merge 231266 from head: > Add support for RICOH R5CE823 card reader, that can be found in > some Lenovo laptops. > > The conroller needs a quirk to lower its frequency, and after > that it operates normally. ... > Modified: stable/9/sys/dev/sdhci/sdhci.c > =========================================================================== >=== --- stable/9/sys/dev/sdhci/sdhci.c Mon Jun 18 07:54:10 2012 (r237223) > +++ stable/9/sys/dev/sdhci/sdhci.c Mon Jun 18 10:56:29 2012 (r237224) @@ > -74,6 +74,8 @@ __FBSDID("$FreeBSD$"); > #define SDHCI_QUIRK_INCR_TIMEOUT_CONTROL (1<<7) > /* Controller has broken read timings */ > #define SDHCI_QUIRK_BROKEN_TIMINGS (1<<8) > +/* Controller needs lowered frequency */ > +#define SDHCI_QUIRK_LOWER_FREQUENCY (1<<9) > > static const struct sdhci_device { > uint32_t model; > @@ -85,6 +87,8 @@ static const struct sdhci_device { > SDHCI_QUIRK_FORCE_DMA }, > { 0xe8221180, 0xffff, "RICOH SD", > SDHCI_QUIRK_FORCE_DMA }, > + { 0xe8231180, 0xffff, "RICOH R5CE823 SD", > + SDHCI_QUIRK_LOWER_FREQUENCY }, > { 0x8034104c, 0xffff, "TI XX21/XX11 SD", > SDHCI_QUIRK_FORCE_DMA }, > { 0x05501524, 0xffff, "ENE CB712 SD", > @@ -350,6 +354,24 @@ sdhci_init(struct sdhci_slot *slot) > } > > static void > +sdhci_lower_frequency(device_t dev) > +{ > + > + /* Enable SD2.0 mode. */ > + pci_write_config(dev, SDHC_PCI_MODE_KEY, 0xfc, 1); > + pci_write_config(dev, SDHC_PCI_MODE, SDHC_PCI_MODE_SD20, 1); > + pci_write_config(dev, SDHC_PCI_MODE_KEY, 0x00, 1); > + > + /* > + * Some SD/MMC cards don't work with the default base > + * clock frequency of 200MHz. Lower it to 50Hz. Are you sure the comment shouldn't have read '50MHz'? > + */ > + pci_write_config(dev, SDHC_PCI_BASE_FREQ_KEY, 0x01, 1); > + pci_write_config(dev, SDHC_PCI_BASE_FREQ, 50, 1); > + pci_write_config(dev, SDHC_PCI_BASE_FREQ_KEY, 0x00, 1); > +} > + > +static void > sdhci_set_clock(struct sdhci_slot *slot, uint32_t clock) > { > uint32_t res; Regards, -- Daan Vreeken Vitsch Electronics http://VitschVPN.nl/ http://Vitsch.nl/ tel: +31-(0)40-7113051 KvK nr: 17174380