linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: linux-ide@vger.kernel.org
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 3/12] qd65xx: add "vlb_clock=" parameter
Date: Thu, 13 Mar 2008 23:44:05 +0100	[thread overview]
Message-ID: <20080313224405.7051.35540.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20080313224352.7051.44005.sendpatchset@localhost.localdomain>

Add "vlb_clock=" parameter for specifying VLB clock frequency (in MHz).

Also rename {active,recovery}_cycle variables to {act,rec}_cyc while at it.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/legacy/qd65xx.c |   29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

Index: b/drivers/ide/legacy/qd65xx.c
===================================================================
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -41,6 +41,8 @@
 
 #include "qd65xx.h"
 
+static int vlb_clock;
+
 /*
  * I/O ports are 0x30-0x31 (and 0x32-0x33 for qd6580)
  *            or 0xb0-0xb1 (and 0xb2-0xb3 for qd6580)
@@ -114,17 +116,18 @@ static void qd65xx_select(ide_drive_t *d
 
 static u8 qd6500_compute_timing (ide_hwif_t *hwif, int active_time, int recovery_time)
 {
-	u8 active_cycle,recovery_cycle;
+	int clk = vlb_clock ? vlb_clock : system_bus_clock();
+	u8 act_cyc, rec_cyc;
 
-	if (system_bus_clock()<=33) {
-		active_cycle =   9  - IDE_IN(active_time   * system_bus_clock() / 1000 + 1, 2, 9);
-		recovery_cycle = 15 - IDE_IN(recovery_time * system_bus_clock() / 1000 + 1, 0, 15);
+	if (clk <= 33) {
+		act_cyc =  9 - IDE_IN(active_time   * clk / 1000 + 1, 2,  9);
+		rec_cyc = 15 - IDE_IN(recovery_time * clk / 1000 + 1, 0, 15);
 	} else {
-		active_cycle =   8  - IDE_IN(active_time   * system_bus_clock() / 1000 + 1, 1, 8);
-		recovery_cycle = 18 - IDE_IN(recovery_time * system_bus_clock() / 1000 + 1, 3, 18);
+		act_cyc =  8 - IDE_IN(active_time   * clk / 1000 + 1, 1,  8);
+		rec_cyc = 18 - IDE_IN(recovery_time * clk / 1000 + 1, 3, 18);
 	}
 
-	return((recovery_cycle<<4) | 0x08 | active_cycle);
+	return (rec_cyc << 4) | 0x08 | act_cyc;
 }
 
 /*
@@ -135,10 +138,13 @@ static u8 qd6500_compute_timing (ide_hwi
 
 static u8 qd6580_compute_timing (int active_time, int recovery_time)
 {
-	u8 active_cycle   = 17 - IDE_IN(active_time   * system_bus_clock() / 1000 + 1, 2, 17);
-	u8 recovery_cycle = 15 - IDE_IN(recovery_time * system_bus_clock() / 1000 + 1, 2, 15);
+	int clk = vlb_clock ? vlb_clock : system_bus_clock();
+	u8 act_cyc, rec_cyc;
+
+	act_cyc = 17 - IDE_IN(active_time   * clk / 1000 + 1, 2, 17);
+	rec_cyc = 15 - IDE_IN(recovery_time * clk / 1000 + 1, 2, 15);
 
-	return((recovery_cycle<<4) | active_cycle);
+	return (rec_cyc << 4) | act_cyc;
 }
 
 /*
@@ -404,6 +410,9 @@ static int probe_qd65xx;
 module_param_named(probe, probe_qd65xx, bool, 0);
 MODULE_PARM_DESC(probe, "probe for QD65xx chipsets");
 
+module_param(vlb_clock, int, 0);
+MODULE_PARM_DESC(vlb_clock, "VLB clock frequency (in MHz)");
+
 static int __init qd65xx_init(void)
 {
 	int rc1, rc2 = -ENODEV;

  parent reply	other threads:[~2008-03-13 22:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-13 22:43 [PATCH 1/12] ali14xx: add "vlb_clock=" parameter Bartlomiej Zolnierkiewicz
2008-03-13 22:43 ` [PATCH 2/12] ht6560b: " Bartlomiej Zolnierkiewicz
2008-03-13 22:44 ` Bartlomiej Zolnierkiewicz [this message]
2008-03-13 22:44 ` [PATCH 4/12] aec62xx: add "pci_clock=" parameter Bartlomiej Zolnierkiewicz
2008-03-13 22:44 ` [PATCH 5/12] alim15x3: " Bartlomiej Zolnierkiewicz
2008-03-13 22:44 ` [PATCH 6/12] amd74xx: " Bartlomiej Zolnierkiewicz
2008-03-13 22:44 ` [PATCH 7/12] cmd64x: " Bartlomiej Zolnierkiewicz
2008-03-13 22:44 ` [PATCH 8/12] cy82c693: " Bartlomiej Zolnierkiewicz
2008-03-13 22:44 ` [PATCH 9/12] opti621: " Bartlomiej Zolnierkiewicz
2008-03-13 22:44 ` [PATCH 10/12] via82cxxx: " Bartlomiej Zolnierkiewicz
2008-03-13 22:45 ` [PATCH 11/12] cmd640: add "cmd_clock=" parameter Bartlomiej Zolnierkiewicz
2008-03-13 22:45 ` [PATCH 12/12] ide: mark "idebus=" kernel parameter as obsoleted Bartlomiej Zolnierkiewicz
2008-03-15 12:36 ` [PATCH 1/12] ali14xx: add "vlb_clock=" parameter Alan Cox
2008-03-15 21:44   ` Bartlomiej Zolnierkiewicz

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=20080313224405.7051.35540.sendpatchset@localhost.localdomain \
    --to=bzolnier@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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).