* [PATCH] pcmcia: Implement CLKRUN protocol disabling for Ricoh bridges
@ 2018-09-08 23:21 Maciej S. Szmigiero
2018-10-01 9:46 ` Dominik Brodowski
0 siblings, 1 reply; 2+ messages in thread
From: Maciej S. Szmigiero @ 2018-09-08 23:21 UTC (permalink / raw)
To: Dominik Brodowski; +Cc: Greg Kroah-Hartman, linux-kernel
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 <mail@maciej.szmigiero.name>
---
drivers/pcmcia/ricoh.h | 35 +++++++++++++++++++++++++++++++++++
drivers/pcmcia/yenta_socket.c | 3 ++-
2 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/drivers/pcmcia/ricoh.h b/drivers/pcmcia/ricoh.h
index 01098c841f87..8ac7b138c094 100644
--- 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_socket *socket)
}
}
+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 yenta_socket *socket)
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_socket *socket)
config_writew(socket, RL5C4XX_CONFIG, config);
ricoh_set_zv(socket);
+ ricoh_set_clkrun(socket, false);
return 0;
}
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index ab3da2262f0f..ac6a3f46b1e6 100644
--- 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);
--
2.17.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] pcmcia: Implement CLKRUN protocol disabling for Ricoh bridges
2018-09-08 23:21 [PATCH] pcmcia: Implement CLKRUN protocol disabling for Ricoh bridges Maciej S. Szmigiero
@ 2018-10-01 9:46 ` Dominik Brodowski
0 siblings, 0 replies; 2+ messages in thread
From: Dominik Brodowski @ 2018-10-01 9:46 UTC (permalink / raw)
To: Maciej S. Szmigiero; +Cc: Greg Kroah-Hartman, linux-kernel
On Sun, Sep 09, 2018 at 01:21:06AM +0200, Maciej S. Szmigiero wrote:
> 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 <mail@maciej.szmigiero.name>
Applied to pcmcia-next. Thanks!
Dominik
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-10-01 11:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-08 23:21 [PATCH] pcmcia: Implement CLKRUN protocol disabling for Ricoh bridges Maciej S. Szmigiero
2018-10-01 9:46 ` Dominik Brodowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®