Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3440506imu; Sun, 11 Nov 2018 15:09:08 -0800 (PST) X-Google-Smtp-Source: AJdET5eirZwkuiGM7MItO2WLxbscQcHsjJLmZl9lMtn1O36fT2y5cIefn+48Fv8EITIX6hNLAvAO X-Received: by 2002:a63:4101:: with SMTP id o1mr2106471pga.447.1541977748364; Sun, 11 Nov 2018 15:09:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541977748; cv=none; d=google.com; s=arc-20160816; b=ohoalw8MzwSyCFJQHW2fjme4xKhTN3Gyepn11bJhDFC8eSBmvw5PV+LlDKSmgWpQaD DVtP6qDNIodwPyvnXUh0Tou9xwzhn9+WfDUgKpXSpqI7zgOy1aIar2kLN6eWmlxLTTmR XZK77XcYy+MaKlM84/lMshVmOSYkrHldLfRYDxIN2VVTaLj57RaDjNn6XXi9FuboRufE 6sRt4EKKAqu54tTHxH6CFB87xWLc6NjetpN5t//2H2ppnRZDpHjfo5xlhIgE179iPmoc a5F2oExGwGn0yR1DPVg5VPs7B5w8cBuzdrfh/IdOG24SwXk+o24/+NnvrxBbEz+7/9Af Q87A== 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=otZvFwYPelLyfrNqRnQwZI7s8jGcQedGKOCf6oda+ew=; b=SwX03CREs/SGuhFxKrwXEbNwwZWHf28XF+AROL8cml9U8SszjMX5DT5FdkdHPXQYFe /abQUpirqbavdcnvoD/x1t+r60bAbfaGRfDW+0RVLH+AGk4E8aQxUVr07ysTpywhp53r ex2vjQzzfCyNmVanqM6aEtcamRdWWM7OM9erIK0fNXNQ5kIeQx1mpq6f32xzylEHWym+ 66a4KdNlmmmra57mtwfkpcs8z3cYGpBc7rsILLW2LJs8cWOScBKYSwk2tmxEwPNVHfMB wfagdDulmCdB7dxpZ7vrfGuZH2LFyMTieXxEOVTa+mr/5M5JWUQFPXVEzag5Z1dyOOmX fzGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ES0NvSAh; 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 m33si13821034pgl.379.2018.11.11.15.08.53; Sun, 11 Nov 2018 15:09:08 -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=ES0NvSAh; 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 S2390734AbeKLI6Z (ORCPT + 99 others); Mon, 12 Nov 2018 03:58:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:51232 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390253AbeKLIWF (ORCPT ); Mon, 12 Nov 2018 03:22:05 -0500 Received: from localhost (unknown [206.108.79.134]) (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 EBD3F21508; Sun, 11 Nov 2018 22:32:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975528; bh=x+jHDGNIKoh4pHSwrcnn7iVz29d2bM6KGSGJklgFV/8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ES0NvSAhysNVQBThF4FbJ4QtxmEb3WqmyLO6oePIlSpB4k7gRw1vIpN7SfMSOzVlo 6/gWV/7E2myI5PlaePbNSD+4ZmEx7rmxPv58FjO0NXAsbF0rQZSBE0uH8hk4/h5ot+ MCD2/JRLHuPO5Z4fu31+jLAOxKG2o3Qvzsuv3APw= 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 4.14 008/222] pcmcia: Implement CLKRUN protocol disabling for Ricoh bridges Date: Sun, 11 Nov 2018 14:21:45 -0800 Message-Id: <20181111221648.661687998@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221647.665769131@linuxfoundation.org> References: <20181111221647.665769131@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 4.14-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);