From patchwork Wed Feb 27 19:09:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 2194501 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 3C950DF2F2 for ; Wed, 27 Feb 2013 19:09:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760228Ab3B0TJh (ORCPT ); Wed, 27 Feb 2013 14:09:37 -0500 Received: from mail-ea0-f174.google.com ([209.85.215.174]:35507 "EHLO mail-ea0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751916Ab3B0TJh (ORCPT ); Wed, 27 Feb 2013 14:09:37 -0500 Received: by mail-ea0-f174.google.com with SMTP id 1so76360eaa.33 for ; Wed, 27 Feb 2013 11:09:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=NJjl/2BiMCX5ypQ2UVSshHQ54yxdnVg491IwiorxERE=; b=eJCUtQ1Ywip+53o8Pp2PiGOli+Syiy9QJ9fXom7vo4139lvKlweAqtGdKL/RK9hHiv 9I7NBsuXs9a4IrqktdHYZZiv2Qo4XX/L9wb1FZZOvTuPbfxP4SHtGkoWZCvB5hooQjnJ gpXJjzrZ0P1r6fJNfvIJfOmrirqged14b2zBhBYN9Fsf2ElCYMciV5hXwpSW2c49pjaR dwlEx4yt/nKSc3uVNvXvU2efrJxa0T9vqfU2zhCmvQSfJtBNwLxGsFt0YQveD5TsMaSN TD97nn/yJYuSBoxsG6f0/0QCb8WAQbogxPZyXava1SNRv1Fpb7iKPx1ZGnQ34iG9Sn0v Gecw== X-Received: by 10.14.211.65 with SMTP id v41mr8688226eeo.33.1361992175821; Wed, 27 Feb 2013 11:09:35 -0800 (PST) Received: from localhost (dynamic-78-8-148-20.ssp.dialog.net.pl. [78.8.148.20]) by mx.google.com with ESMTPS id s3sm7948638eem.4.2013.02.27.11.09.34 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 27 Feb 2013 11:09:35 -0800 (PST) From: Michal Kazior To: linux-wireless@vger.kernel.org, "Luis R. Rodriguez" Cc: Michal Kazior Subject: [PATCH v2] ath: sanitize 0xFFFF regdomain Date: Wed, 27 Feb 2013 20:09:32 +0100 Message-Id: <1361992172-4590-1-git-send-email-kazikcz@gmail.com> X-Mailer: git-send-email 1.8.1.4 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Apparently some Dbii F52N-PRO mini pci devices have been intentionally programemd with a 0xFFFF regdomain. This is incorrect and unsupported by QCA. The patch sanitizes the 0xFFFF regdomain with 0x64 which is the most restrictive custom world regulatory domain in the ath module. This card has been reported to work on MikroTik's RouterOS but failed on Linux with the following: [ 14.320000] ath: EEPROM regdomain: 0xffff [ 14.320000] ath: EEPROM indicates we should expect a country code [ 14.320000] ath: invalid regulatory domain/country code 0xbfff [ 14.320000] ath: Invalid EEPROM contents [ 14.320000] ath9k 0000:00:12.0: Failed to initialize device [ 14.330000] ath9k: probe of 0000:00:12.0 failed with error -22 With the patch the device works fine. Signed-off-by: Michal Kazior --- v2: updated commit message as suggested by Luis drivers/net/wireless/ath/regd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c index ccc4c71..48fb1b9 100644 --- a/drivers/net/wireless/ath/regd.c +++ b/drivers/net/wireless/ath/regd.c @@ -533,10 +533,11 @@ ath_regd_init_wiphy(struct ath_regulatory *reg, * but since we have more than one user with it we need * a solution for them. We default to 0x64, which is the * default Atheros world regulatory domain. + * There is also at least one report of 0xFFFF being set. */ static void ath_regd_sanitize(struct ath_regulatory *reg) { - if (reg->current_rd != COUNTRY_ERD_FLAG) + if (reg->current_rd != COUNTRY_ERD_FLAG && reg->current_rd != 0xFFFF) return; printk(KERN_DEBUG "ath: EEPROM regdomain sanitized\n"); reg->current_rd = 0x64;