From patchwork Sat May 1 16:29:06 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?G=C3=A1bor_Stefanik?= X-Patchwork-Id: 96287 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o41GTE8G011762 for ; Sat, 1 May 2010 16:29:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755995Ab0EAQ3L (ORCPT ); Sat, 1 May 2010 12:29:11 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:41130 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755558Ab0EAQ3J (ORCPT ); Sat, 1 May 2010 12:29:09 -0400 Received: by fxm10 with SMTP id 10so1036971fxm.19 for ; Sat, 01 May 2010 09:29:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:content-type :content-transfer-encoding; bh=b5wRjpfpBkLpCSlbC/r78lZGqh7bjbiDH6CEwVvQ2jM=; b=XUdJNKjrnK6XQnZrRF3SNqpazXPwWwoTLsA97qcog+lGTl7iMTECEvqvXdAnkftOvE CNTzS0n9MVXb8e/wbCM1wWH23bGkCrJd7VIVsSKN63Gs3G0Uy4GsntuL5Th0fjWKwb2y rXYmXDIcJz9gdQs0wLe8CvZZO7vSurvefhMFY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; b=CBmjdRY/xxOs/AsmSOz2hqVMAlwefrBQrTKfuuSnmfD9Jgwc4vLzdfTSd4+kh7hhVO g+bhA8ckK20rOvnYaY8sOCTNbRX77nFqpcZWKB1KXu9gpAwwP90N75mGPX1cBSBLJ6ux r/07iFtyC/TlpN7MGIqa/3i6vAxs/44XN74wg= Received: by 10.223.33.218 with SMTP id i26mr1972543fad.58.1272731345402; Sat, 01 May 2010 09:29:05 -0700 (PDT) Received: from [127.0.0.1] (pool-01be3.externet.hu [88.209.197.226]) by mx.google.com with ESMTPS id z15sm5330462fkz.21.2010.05.01.09.29.04 (version=SSLv3 cipher=RC4-MD5); Sat, 01 May 2010 09:29:04 -0700 (PDT) Message-ID: <4BDC56D2.5060605@gmail.com> Date: Sat, 01 May 2010 18:29:06 +0200 From: =?ISO-8859-2?Q?G=E1bor_Stefanik?= User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; hu; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 To: "John W. Linville" CC: linux-wireless , b43-dev , Michael Buesch , Larry Finger Subject: [PATCH] ssb: Implement fast powerup delay calculation Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sat, 01 May 2010 16:29:14 +0000 (UTC) Index: wireless-testing/drivers/ssb/driver_chipcommon.c =================================================================== --- wireless-testing.orig/drivers/ssb/driver_chipcommon.c +++ wireless-testing/drivers/ssb/driver_chipcommon.c @@ -209,7 +209,24 @@ static void chipco_powercontrol_init(str } } -static void calc_fast_powerup_delay(struct ssb_chipcommon *cc) +static u16 pmu_fast_powerup_delay(struct ssb_chipcommon *cc) +{ + struct ssb_bus *bus = cc->dev->bus; + + switch (bus->chip_id) { + case 0x4312: + case 0x4322: + case 0x4328: + return 7000; + case 0x4325: + /* TODO: */ + default: + break; + } + return 15000; +} + +static u16 calc_fast_powerup_delay(struct ssb_chipcommon *cc) { struct ssb_bus *bus = cc->dev->bus; int minfreq; @@ -217,26 +234,33 @@ static void calc_fast_powerup_delay(stru u32 pll_on_delay; if (bus->bustype != SSB_BUSTYPE_PCI) - return; + return 0; + if (cc->capabilities& SSB_CHIPCO_CAP_PMU) + return pmu_fast_powerup_delay(cc); if (!(cc->capabilities& SSB_CHIPCO_CAP_PCTL)) - return; + return 0; minfreq = chipco_pctl_clockfreqlimit(cc, 0); pll_on_delay = chipco_read32(cc, SSB_CHIPCO_PLLONDELAY); tmp = (((pll_on_delay + 2) * 1000000) + (minfreq - 1)) / minfreq; SSB_WARN_ON(tmp& ~0xFFFF); - cc->fast_pwrup_delay = tmp; + return tmp; } void ssb_chipcommon_init(struct ssb_chipcommon *cc) { + u16 delay; + if (!cc->dev) return; /* We don't have a ChipCommon */ ssb_pmu_init(cc); chipco_powercontrol_init(cc); ssb_chipco_set_clockmode(cc, SSB_CLKMODE_FAST); - calc_fast_powerup_delay(cc); + delay = calc_fast_powerup_delay(cc); + ssb_printk(KERN_INFO PFX "fast_pwrup_delay is %d\n", delay); + cc->fast_pwrup_delay = delay; + ssb_write16(cc->dev, SSB_MMIO_POWERUP_DELAY, delay); } void ssb_chipco_suspend(struct ssb_chipcommon *cc) Index: wireless-testing/include/linux/ssb/ssb_regs.h =================================================================== --- wireless-testing.orig/include/linux/ssb/ssb_regs.h +++ wireless-testing/include/linux/ssb/ssb_regs.h @@ -26,6 +26,7 @@ #define SSB_EUART (SSB_EXTIF_BASE + 0x00800000) #define SSB_LED (SSB_EXTIF_BASE + 0x00900000) +#define SSB_MMIO_POWERUP_DELAY 0x06A8 /* Enumeration space constants */ #define SSB_CORE_SIZE 0x1000 /* Size of a core MMIO area */