linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gertjan van Wingerde <gwingerde@gmail.com>
To: <linux-wireless@vger.kernel.org>,
	"John W. Linville" <linville@tuxdriver.com>
Cc: <users@rt2x00.serialmonkey.com>,
	Ivo van Doorn <IvDoorn@gmail.com>,
	Helmut Schaa <helmut.schaa@googlemail.com>,
	Gertjan van Wingerde <gwingerde@gmail.com>,
	<stable@vger.kernel.org>
Subject: [PATCH 03/14] rt2x00: Fix rt2400pci rfkill polling prior to interface start.
Date: Thu, 30 Aug 2012 21:34:02 +0200	[thread overview]
Message-ID: <1346355248-5331-4-git-send-email-gwingerde@gmail.com> (raw)
In-Reply-To: <1346355248-5331-3-git-send-email-gwingerde@gmail.com>

We need to program the rfkill switch GPIO pin direction to input at
device initialization time, not only when the interface is brought up.
Doing this only when the interface is brought up could lead to rfkill
detecting the switch is turned on erroneously and inability to create
the interface and bringing it up.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Cc: <stable@vger.kernel.org>

diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index 94f9aa2..6458ab8 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -1611,6 +1611,7 @@ static int rt2400pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 static int rt2400pci_probe_hw(struct rt2x00_dev *rt2x00dev)
 {
 	int retval;
+	u32 reg;
 
 	/*
 	 * Allocate eeprom data.
@@ -1624,6 +1625,14 @@ static int rt2400pci_probe_hw(struct rt2x00_dev *rt2x00dev)
 		return retval;
 
 	/*
+	 * Enable rfkill polling by setting GPIO direction of the
+	 * rfkill switch GPIO pin correctly.
+	 */
+	rt2x00pci_register_read(rt2x00dev, GPIOCSR, &reg);
+	rt2x00_set_field32(&reg, GPIOCSR_DIR0, 1);
+	rt2x00pci_register_write(rt2x00dev, GPIOCSR, reg);
+
+	/*
 	 * Initialize hw specifications.
 	 */
 	retval = rt2400pci_probe_hw_mode(rt2x00dev);
-- 
1.7.11.1


  reply	other threads:[~2012-08-30 19:40 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-30 19:33 [PATCH 00/14] rt2x00: Fixes and cleanups Gertjan van Wingerde
2012-08-30 19:34 ` [PATCH 01/14] rt2x00: Identify ASUS USB-N53 device Gertjan van Wingerde
2012-08-30 19:34   ` [PATCH 02/14] rt2x00: Align rt2400pci GPIOCSR definition with datasheet Gertjan van Wingerde
2012-08-30 19:34     ` Gertjan van Wingerde [this message]
2012-08-30 19:34       ` [PATCH 04/14] rt2x00: Align rt2500pci " Gertjan van Wingerde
2012-08-30 19:34         ` [PATCH 05/14] rt2x00: Fix rt2500pci rfkill polling prior to interface start Gertjan van Wingerde
2012-08-30 19:34           ` [PATCH 06/14] rt2x00: Align rt2500usb MAC_CSR19 definition with datasheet Gertjan van Wingerde
2012-08-30 19:34             ` [PATCH 07/14] rt2x00: Fix rt2500usb rfkill polling prior to interface start Gertjan van Wingerde
2012-08-30 19:34               ` [PATCH 08/14] rt2x00: Align rt61pci MAC_CSR13 definition with datasheet Gertjan van Wingerde
2012-08-30 19:34                 ` [PATCH 09/14] rt2x00: Fix rt61pci rfkill polling prior to interface start Gertjan van Wingerde
2012-08-30 21:04                   ` [PATCH 10/14] rt2x00: Align rt73usb MAC_CSR13 definition with datasheet Gertjan van Wingerde
2012-08-30 21:04                     ` [PATCH 10/17] rt2x00: Fix rt2500usb rfkill polling prior to interface start Gertjan van Wingerde
2012-08-30 21:04                       ` [PATCH 11/17] rt2x00: Align rt61pci MAC_CSR13 definition with datasheet Gertjan van Wingerde
2012-08-30 21:04                         ` [PATCH 11/14] rt2x00: Fix rt73usb rfkill polling prior to interface start Gertjan van Wingerde
2012-08-30 21:04                           ` [PATCH 12/14] rt2x00: Align rt2800 GPIO_CTRL definition with datasheet Gertjan van Wingerde
2012-08-30 21:04                             ` [PATCH 12/17] rt2x00: Fix rt61pci rfkill polling prior to interface start Gertjan van Wingerde
2012-08-30 21:04                               ` [PATCH 13/17] rt2x00: Align rt73usb MAC_CSR13 definition with datasheet Gertjan van Wingerde
2012-08-30 21:04                                 ` [PATCH 13/14] rt2x00: Fix rt2800 rfkill polling prior to interface start Gertjan van Wingerde
2012-08-30 21:04                                   ` [PATCH 14/17] rt2x00: Fix rt73usb " Gertjan van Wingerde
2012-08-30 21:04                                     ` [PATCH 14/14] rt2x00: rt2800 - Make probe_hw function common between PCI and USB Gertjan van Wingerde
2012-08-30 21:04                                       ` [PATCH 15/17] rt2x00: Align rt2800 GPIO_CTRL definition with datasheet Gertjan van Wingerde
2012-08-30 21:04                                         ` [PATCH 16/17] rt2x00: Fix rt2800 rfkill polling prior to interface start Gertjan van Wingerde
2012-08-30 21:04                                           ` [PATCH 17/17] rt2x00: rt2800 - Make probe_hw function common between PCI and USB Gertjan van Wingerde
2012-08-30 21:14                       ` [PATCH 10/17] rt2x00: Fix rt2500usb rfkill polling prior to interface start Gertjan van Wingerde
2012-08-30 21:06         ` [PATCH 04/14] rt2x00: Align rt2500pci GPIOCSR definition with datasheet Jonathan Nieder
2012-08-30 21:05     ` [PATCH 02/14] rt2x00: Align rt2400pci " Jonathan Nieder
2012-08-30 21:08       ` Gertjan van Wingerde
2012-08-31  2:21         ` Jonathan Nieder
2012-08-31 11:14           ` Gertjan van Wingerde
2012-08-31 20:59             ` Jonathan Nieder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1346355248-5331-4-git-send-email-gwingerde@gmail.com \
    --to=gwingerde@gmail.com \
    --cc=IvDoorn@gmail.com \
    --cc=helmut.schaa@googlemail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=stable@vger.kernel.org \
    --cc=users@rt2x00.serialmonkey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).