Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2992356imu; Mon, 19 Nov 2018 09:05:28 -0800 (PST) X-Google-Smtp-Source: AJdET5fmBGsJCHQ753hz0HEVtrKV7uqsjav48dGzdfPu2sxg3mvL9xIXh7fC9S7J+//vctQpiPrt X-Received: by 2002:a65:4904:: with SMTP id p4mr20989809pgs.384.1542647128834; Mon, 19 Nov 2018 09:05:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542647128; cv=none; d=google.com; s=arc-20160816; b=Wcz1e5yf/iM51mbR/0zHnem93y2o2VhTz4ErWtl5VqUVx0cwQigrkZu+s1cJBzPZGM 6DEEyrQhaZaCC+w5IL2O3JFknebPj8mmLJi31JlYJ3iDPvTQQ/yPDK9ddW4wUM4LuOWc PQ4+CVISBmzYLEQte9dsbdC93wlB7jxKwS+2G7LVKQi2plWUUaOYHVwDo0NLaYKC0MEW GKR700mIBiuFGnpvMxTnlN8xkgo4msLJFJMJ+Vd4fOvbCgcICcu7Yt8t19z7g5Iz7j/6 G7lZkDRT3Pjqy2M/XRh0Ymh93QLO8E2LiMW4+65aX6oYzcZ+5msz/gQ+QFAb1UGaaJmp WOog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5DTnMjpUGkKUYYVOf3b+zfITFZgWtIUlzERO2JS4iAc=; b=cb0/HOKHDeYfVFv4J9Yf0WWEM0BPO6xrBuqAoQApAd/9AKES/qe4AI5osnjgWkzitx +YaY66/uROJWOyX9E+fH2BHJZVPweTyeHxmNj+1xhbkq7w6iADcgycU4mhKNTcDqU/5v u4hz/uptDWxz8y19F+rczTRAl/1avNe7ynwkHBJuvLAN7TIKrL1klD6m98amXlbZuZlC /dR3o92LTt6BLArKt9MUif/2wwyQnozq5YOwCUDGA/j3qoUJ7JErGf3zRqn1Qv1oG7aR PAQqpg7TmBVT4hMXjkr+o6k1qIbA8YZws4dSlft5uXTUTI9825FMNKIGyYG/h9YqQlvH /0vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZOuVPSxG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v4-v6si39887414plp.247.2018.11.19.09.05.13; Mon, 19 Nov 2018 09:05:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZOuVPSxG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406390AbeKTD2N (ORCPT + 99 others); Mon, 19 Nov 2018 22:28:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:42476 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405461AbeKTD2M (ORCPT ); Mon, 19 Nov 2018 22:28:12 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 74E742151B; Mon, 19 Nov 2018 17:03:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542647035; bh=TVqR/ZcZqqPtElbvzEZHMoBNgGi3GnH5mImh0iRVV3Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZOuVPSxGw45+pP0ISojaMZwx2UO9gsMJ6uA7fp7+qXzsmoi1UHDEHjzySEMSu+29f GX3TMPp1qe+jmGuUiNJ6NuNO00dDXThD588v3BdQdVHqkPo+MJFPD/SE8i8hQCvBX2 rX1pewtWQJcbxrWP4dKnWfu30DjxqcjFRSgaxdRg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Maciej S. Szmigiero" , Dominik Brodowski Subject: [PATCH 3.18 03/90] pcmcia: Implement CLKRUN protocol disabling for Ricoh bridges Date: Mon, 19 Nov 2018 17:28:45 +0100 Message-Id: <20181119162621.195160955@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119162620.585061184@linuxfoundation.org> References: <20181119162620.585061184@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Maciej S. Szmigiero commit 95691e3eddc41da2d1cd3cca51fecdfb46bd85bc upstream. Currently, "disable_clkrun" yenta_socket module parameter is only implemented for TI CardBus bridges. Add also an implementation for Ricoh bridges that have the necessary setting documented in publicly available datasheets. Tested on a RL5C476II with a Sunrich C-160 CardBus NIC that doesn't work correctly unless the CLKRUN protocol is disabled. Let's also make it clear in its description that the "disable_clkrun" module parameter only works on these two previously mentioned brands of CardBus bridges. Signed-off-by: Maciej S. Szmigiero Cc: stable@vger.kernel.org Signed-off-by: Dominik Brodowski Signed-off-by: Greg Kroah-Hartman --- drivers/pcmcia/ricoh.h | 35 +++++++++++++++++++++++++++++++++++ drivers/pcmcia/yenta_socket.c | 3 ++- 2 files changed, 37 insertions(+), 1 deletion(-) --- a/drivers/pcmcia/ricoh.h +++ b/drivers/pcmcia/ricoh.h @@ -119,6 +119,10 @@ #define RL5C4XX_MISC_CONTROL 0x2F /* 8 bit */ #define RL5C4XX_ZV_ENABLE 0x08 +/* Misc Control 3 Register */ +#define RL5C4XX_MISC3 0x00A2 /* 16 bit */ +#define RL5C47X_MISC3_CB_CLKRUN_DIS BIT(1) + #ifdef __YENTA_H #define rl_misc(socket) ((socket)->private[0]) @@ -156,6 +160,35 @@ static void ricoh_set_zv(struct yenta_so } } +static void ricoh_set_clkrun(struct yenta_socket *socket, bool quiet) +{ + u16 misc3; + + /* + * RL5C475II likely has this setting, too, however no datasheet + * is publicly available for this chip + */ + if (socket->dev->device != PCI_DEVICE_ID_RICOH_RL5C476 && + socket->dev->device != PCI_DEVICE_ID_RICOH_RL5C478) + return; + + if (socket->dev->revision < 0x80) + return; + + misc3 = config_readw(socket, RL5C4XX_MISC3); + if (misc3 & RL5C47X_MISC3_CB_CLKRUN_DIS) { + if (!quiet) + dev_dbg(&socket->dev->dev, + "CLKRUN feature already disabled\n"); + } else if (disable_clkrun) { + if (!quiet) + dev_info(&socket->dev->dev, + "Disabling CLKRUN feature\n"); + misc3 |= RL5C47X_MISC3_CB_CLKRUN_DIS; + config_writew(socket, RL5C4XX_MISC3, misc3); + } +} + static void ricoh_save_state(struct yenta_socket *socket) { rl_misc(socket) = config_readw(socket, RL5C4XX_MISC); @@ -172,6 +205,7 @@ static void ricoh_restore_state(struct y config_writew(socket, RL5C4XX_16BIT_IO_0, rl_io(socket)); config_writew(socket, RL5C4XX_16BIT_MEM_0, rl_mem(socket)); config_writew(socket, RL5C4XX_CONFIG, rl_config(socket)); + ricoh_set_clkrun(socket, true); } @@ -197,6 +231,7 @@ static int ricoh_override(struct yenta_s config_writew(socket, RL5C4XX_CONFIG, config); ricoh_set_zv(socket); + ricoh_set_clkrun(socket, false); return 0; } --- a/drivers/pcmcia/yenta_socket.c +++ b/drivers/pcmcia/yenta_socket.c @@ -26,7 +26,8 @@ static bool disable_clkrun; module_param(disable_clkrun, bool, 0444); -MODULE_PARM_DESC(disable_clkrun, "If PC card doesn't function properly, please try this option"); +MODULE_PARM_DESC(disable_clkrun, + "If PC card doesn't function properly, please try this option (TI and Ricoh bridges only)"); static bool isa_probe = 1; module_param(isa_probe, bool, 0444);