Skip to contentSkip to conversation

ali14xx: add "vlb_clock=" parameter

PATCH In review Bartlomiej Zolnierkiewicz 2 participants 14 messages Mar 13, 2008 – Mar 15, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/12 ali14xx: add "vlb_clock=" parameter

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

---
 drivers/ide/legacy/ali14xx.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/ide/legacy/ali14xx.c +6 -1
Index: b/drivers/ide/legacy/ali14xx.c
===================================================================
@@ -51,6 +51,8 @@
 
 #define DRV_NAME "ali14xx"
 
+static int vlb_clock;
+
 /* port addresses for auto-detection */
 #define ALI_NUM_PORTS 4
 static const int ports[ALI_NUM_PORTS] __initdata =
@@ -116,7 +118,7 @@ static void ali14xx_set_pio_mode(ide_dri
 	int time1, time2;
 	u8 param1, param2, param3, param4;
 	unsigned long flags;
-	int bus_speed = system_bus_clock();
+	int bus_speed = vlb_clock ? vlb_clock : system_bus_clock();
 
 	/* calculate timing, according to PIO mode */
 	time1 = ide_pio_cycle_time(drive, pio);
@@ -225,6 +227,9 @@ static int probe_ali14xx;
 module_param_named(probe, probe_ali14xx, bool, 0);
 MODULE_PARM_DESC(probe, "probe for ALI M14xx chipsets");
 
+module_param(vlb_clock, int, 0);
+MODULE_PARM_DESC(vlb_clock, "VLB clock frequency (in MHz)");
+
 static int __init ali14xx_init(void)
 {
 	if (probe_ali14xx == 0)
#1 lore raw

PATCH 2/12 ht6560b: add "vlb_clock=" parameter

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

---
 drivers/ide/legacy/ht6560b.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/ide/legacy/ht6560b.c +7 -2
Index: b/drivers/ide/legacy/ht6560b.c
===================================================================
@@ -116,6 +116,8 @@
 #define HT_TIMING(drivea) (u8)((drivea)->drive_data & 0x00ff)
 #define HT_TIMING_DEFAULT 0xff
 
+static int vlb_clock;
+
 /*
  * This routine handles interface switching for the peculiar hardware design
  * on the F.G.I./Holtek HT-6560B VLB IDE interface.
@@ -212,8 +214,8 @@ static u8 ht_pio2timings(ide_drive_t *dr
 {
 	int active_time, recovery_time;
 	int active_cycles, recovery_cycles;
-	int bus_speed = system_bus_clock();
-	
+	int bus_speed = vlb_clock ? vlb_clock : system_bus_clock();
+
         if (pio) {
 		unsigned int cycle_time;
 
@@ -328,6 +330,9 @@ static int probe_ht6560b;
 module_param_named(probe, probe_ht6560b, bool, 0);
 MODULE_PARM_DESC(probe, "probe for HT6560B chipset");
 
+module_param(vlb_clock, int, 0);
+MODULE_PARM_DESC(vlb_clock, "VLB clock frequency (in MHz)");
+
 static const struct ide_port_ops ht6560b_port_ops = {
 	.port_init_devs		= ht6560b_port_init_devs,
 	.set_pio_mode		= ht6560b_set_pio_mode,
#2 lore raw

PATCH 3/12 qd65xx: add "vlb_clock=" parameter

In reply to Bartlomiej Zolnierkiewicz

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

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

---
 drivers/ide/legacy/qd65xx.c |   29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)
drivers/ide/legacy/qd65xx.c +19 -10
Index: 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;
#3 lore raw

PATCH 4/12 aec62xx: add "pci_clock=" parameter

In reply to Bartlomiej Zolnierkiewicz

Add "pci_clock=" parameter for specifying PCI bus clock frequency (in MHz).

---
 drivers/ide/pci/aec62xx.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/ide/pci/aec62xx.c +6 -1
Index: b/drivers/ide/pci/aec62xx.c
===================================================================
@@ -13,6 +13,8 @@
 
 #include <asm/io.h>
 
+static int pci_clock;
+
 struct chipset_bus_clock_list_entry {
 	u8 xfer_speed;
 	u8 chipset_settings;
@@ -140,7 +142,7 @@ static void aec_set_pio_mode(ide_drive_t
 
 static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const char *name)
 {
-	int bus_speed = system_bus_clock();
+	int bus_speed = pci_clock ? pci_clock : system_bus_clock();
 
 	if (bus_speed <= 33)
 		pci_set_drvdata(dev, (void *) aec6xxx_33_base);
@@ -308,6 +310,9 @@ static int __init aec62xx_ide_init(void)
 
 module_init(aec62xx_ide_init);
 
+module_param(pci_clock, int, 0);
+MODULE_PARM_DESC(pci_clock, "PCI bus clock frequency (in MHz)");
+
 MODULE_AUTHOR("Andre Hedrick");
 MODULE_DESCRIPTION("PCI driver module for ARTOP AEC62xx IDE");
 MODULE_LICENSE("GPL");
#4 lore raw

PATCH 5/12 alim15x3: add "pci_clock=" parameter

In reply to Bartlomiej Zolnierkiewicz

Add "pci_clock=" parameter for specifying PCI bus clock frequency (in MHz).

---
 drivers/ide/pci/alim15x3.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/ide/pci/alim15x3.c +6 -1
Index: b/drivers/ide/pci/alim15x3.c
===================================================================
@@ -40,6 +40,8 @@
 
 #define DISPLAY_ALI_TIMINGS
 
+static int pci_clock;
+
 /*
  *	ALi devices are not plug in. Otherwise these static values would
  *	need to go. They ought to go away anyway
@@ -294,7 +296,7 @@ static void ali_set_pio_mode(ide_drive_t
 	int s_time, a_time, c_time;
 	u8 s_clc, a_clc, r_clc;
 	unsigned long flags;
-	int bus_speed = system_bus_clock();
+	int bus_speed = pci_clock ? pci_clock : system_bus_clock();
 	int port = hwif->channel ? 0x5c : 0x58;
 	int portFIFO = hwif->channel ? 0x55 : 0x54;
 	u8 cd_dma_fifo = 0;
@@ -839,6 +841,9 @@ static int __init ali15x3_ide_init(void)
 
 module_init(ali15x3_ide_init);
 
+module_param(pci_clock, int, 0);
+MODULE_PARM_DESC(pci_clock, "PCI bus clock frequency (in MHz)");
+
 MODULE_AUTHOR("Michael Aubry, Andrzej Krzysztofowicz, CJ, Andre Hedrick, Alan Cox");
 MODULE_DESCRIPTION("PCI driver module for ALi 15x3 IDE");
 MODULE_LICENSE("GPL");
#5 lore raw

PATCH 6/12 amd74xx: add "pci_clock=" parameter

In reply to Bartlomiej Zolnierkiewicz

Add "pci_clock=" parameter for specifying PCI bus clock frequency (in MHz).

---
 drivers/ide/pci/amd74xx.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/ide/pci/amd74xx.c +6 -1
Index: b/drivers/ide/pci/amd74xx.c
===================================================================
@@ -32,6 +32,8 @@ enum {
 	AMD_UDMA_TIMING		= 0x50,
 };
 
+static int pci_clock;
+
 static unsigned int amd_80w;
 static unsigned int amd_clock;
 
@@ -179,7 +181,7 @@ static unsigned int __devinit init_chips
  * Determine the system bus clock.
  */
 
-	amd_clock = system_bus_clock() * 1000;
+	amd_clock = (pci_clock ? pci_clock : system_bus_clock()) * 1000;
 
 	switch (amd_clock) {
 		case 33000: amd_clock = 33333; break;
@@ -353,6 +355,9 @@ static int __init amd74xx_ide_init(void)
 
 module_init(amd74xx_ide_init);
 
+module_param(pci_clock, int, 0);
+MODULE_PARM_DESC(pci_clock, "PCI bus clock frequency (in MHz)");
+
 MODULE_AUTHOR("Vojtech Pavlik");
 MODULE_DESCRIPTION("AMD PCI IDE driver");
 MODULE_LICENSE("GPL");
#6 lore raw

PATCH 7/12 cmd64x: add "pci_clock=" parameter

In reply to Bartlomiej Zolnierkiewicz

Add "pci_clock=" parameter for specifying PCI bus clock frequency (in MHz).

---
 drivers/ide/pci/cmd64x.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/ide/pci/cmd64x.c +8 -3
Index: b/drivers/ide/pci/cmd64x.c
===================================================================
@@ -57,6 +57,8 @@
 #define UDIDETCR1	0x7B
 #define DTPR1		0x7C
 
+static int pci_clock;
+
 static u8 quantize_timing(int timing, int quant)
 {
 	return (timing + quant - 1) / quant;
@@ -68,8 +70,8 @@ static u8 quantize_timing(int timing, in
  */
 static void program_cycle_times (ide_drive_t *drive, int cycle_time, int active_time)
 {
-	struct pci_dev *dev	= to_pci_dev(drive->hwif->dev);
-	int clock_time		= 1000 / system_bus_clock();
+	struct pci_dev *dev = to_pci_dev(drive->hwif->dev);
+	int clock_time = 1000 / (pci_clock ? pci_clock : system_bus_clock());
 	u8  cycle_count, active_count, recovery_count, drwtim;
 	static const u8 recovery_values[] =
 		{15, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0};
@@ -128,7 +130,7 @@ static void cmd64x_tune_pio(ide_drive_t 
 			    ide_pio_timings[pio].active_time);
 
 	setup_count = quantize_timing(ide_pio_timings[pio].setup_time,
-				      1000 / system_bus_clock());
+			1000 / (pci_clock ? pci_clock : system_bus_clock()));
 
 	/*
 	 * The primary channel has individual address setup timing registers
@@ -532,6 +534,9 @@ static int __init cmd64x_ide_init(void)
 
 module_init(cmd64x_ide_init);
 
+module_param(pci_clock, int, 0);
+MODULE_PARM_DESC(pci_clock, "PCI bus clock frequency (in MHz)");
+
 MODULE_AUTHOR("Eddie Dost, David Miller, Andre Hedrick");
 MODULE_DESCRIPTION("PCI driver module for CMD64x IDE");
 MODULE_LICENSE("GPL");
#7 lore raw

PATCH 8/12 cy82c693: add "pci_clock=" parameter

In reply to Bartlomiej Zolnierkiewicz

Add "pci_clock=" parameter for specifying PCI bus clock frequency (in MHz).

---
 drivers/ide/pci/cy82c693.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/ide/pci/cy82c693.c +6 -1
Index: b/drivers/ide/pci/cy82c693.c
===================================================================
@@ -98,6 +98,8 @@
 #define CY82C963_MIN_BUS_SPEED	25
 #define CY82C963_MAX_BUS_SPEED	33
 
+static int pci_clock;
+
 /* the struct for the PIO mode timings */
 typedef struct pio_clocks_s {
 	u8	address_time;	/* Address setup (clocks) */
@@ -136,7 +138,7 @@ static int calc_clk(int time, int bus_sp
 static void compute_clocks(u8 pio, pio_clocks_t *p_pclk)
 {
 	int clk1, clk2;
-	int bus_speed = system_bus_clock();	/* get speed of PCI bus */
+	int bus_speed = pci_clock ? pci_clock : system_bus_clock();
 
 	/* we don't check against CY82C693's min and max speed,
 	 * so you can play with the idebus=xx parameter
@@ -447,6 +449,9 @@ static int __init cy82c693_ide_init(void
 
 module_init(cy82c693_ide_init);
 
+module_param(pci_clock, int, 0);
+MODULE_PARM_DESC(pci_clock, "PCI bus clock frequency (in MHz)");
+
 MODULE_AUTHOR("Andreas Krebs, Andre Hedrick");
 MODULE_DESCRIPTION("PCI driver module for the Cypress CY82C693 IDE");
 MODULE_LICENSE("GPL");
#8 lore raw

PATCH 9/12 opti621: add "pci_clock=" parameter

In reply to Bartlomiej Zolnierkiewicz

Add "pci_clock=" parameter for specifying PCI bus clock frequency (in MHz).

---
 drivers/ide/pci/opti621.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/ide/pci/opti621.c +6 -1
Index: b/drivers/ide/pci/opti621.c
===================================================================
@@ -123,6 +123,8 @@
 
 static int reg_base;
 
+static int pci_clock;
+
 #define PIO_NOT_EXIST 254
 #define PIO_DONT_KNOW 255
 
@@ -210,7 +212,7 @@ static void compute_clocks(int pio, pio_
 {
 	if (pio != PIO_NOT_EXIST) {
 		int adr_setup, data_pls;
-		int bus_speed = system_bus_clock();
+		int bus_speed = pci_clock ? pci_clock : system_bus_clock();
 
 		adr_setup = ide_pio_timings[pio].setup_time;
 		data_pls = ide_pio_timings[pio].active_time;
@@ -376,6 +378,9 @@ static int __init opti621_ide_init(void)
 
 module_init(opti621_ide_init);
 
+module_param(pci_clock, int, 0);
+MODULE_PARM_DESC(pci_clock, "PCI bus clock frequency (in MHz)");
+
 MODULE_AUTHOR("Jaromir Koutek, Jan Harkes, Mark Lord");
 MODULE_DESCRIPTION("PCI driver module for Opti621 IDE");
 MODULE_LICENSE("GPL");
#9 lore raw

PATCH 10/12 via82cxxx: add "pci_clock=" parameter

In reply to Bartlomiej Zolnierkiewicz

Add "pci_clock=" parameter for specifying PCI bus clock frequency (in MHz).

---
 drivers/ide/pci/via82cxxx.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/ide/pci/via82cxxx.c +6 -1
Index: b/drivers/ide/pci/via82cxxx.c
===================================================================
@@ -94,6 +94,8 @@ static struct via_isa_bridge {
 	{ NULL }
 };
 
+static int pci_clock;
+
 static unsigned int via_clock;
 static char *via_dma[] = { "16", "25", "33", "44", "66", "100", "133" };
 
@@ -340,7 +342,7 @@ static unsigned int __devinit init_chips
 	 * Determine system bus clock.
 	 */
 
-	via_clock = system_bus_clock() * 1000;
+	via_clock = (pci_clock ? pci_clock : system_bus_clock()) * 1000;
 
 	switch (via_clock) {
 		case 33000: via_clock = 33333; break;
@@ -495,6 +497,9 @@ static int __init via_ide_init(void)
 
 module_init(via_ide_init);
 
+module_param(pci_clock, int, 0);
+MODULE_PARM_DESC(pci_clock, "PCI bus clock frequency (in MHz)");
+
 MODULE_AUTHOR("Vojtech Pavlik, Michel Aubry, Jeff Garzik, Andre Hedrick");
 MODULE_DESCRIPTION("PCI driver module for VIA IDE");
 MODULE_LICENSE("GPL");
#10 lore raw

PATCH 11/12 cmd640: add "cmd_clock=" parameter

In reply to Bartlomiej Zolnierkiewicz

Add "cmd_clock=" parameter for specifying VLB or PCI bus clock frequency (in MHz).

---
 drivers/ide/pci/cmd640.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/ide/pci/cmd640.c +6 -1
Index: b/drivers/ide/pci/cmd640.c
===================================================================
@@ -157,6 +157,8 @@ static int cmd640_vlb;
 #define DRWTIM23	0x58
 #define BRST		0x59
 
+static int cmd_clock;
+
 /*
  * Registers and masks for easy access by drive index:
  */
@@ -552,7 +554,7 @@ static void cmd640_set_mode(ide_drive_t 
 {
 	int setup_time, active_time, recovery_time, clock_time;
 	u8 setup_count, active_count, recovery_count, recovery_count2, cycle_count;
-	int bus_speed = system_bus_clock();
+	int bus_speed = cmd_clock ? cmd_clock : system_bus_clock();
 
 	if (pio_mode > 5)
 		pio_mode = 5;
@@ -904,4 +906,7 @@ static int __init cmd640x_init(void)
 module_param_named(probe_vlb, cmd640_vlb, bool, 0);
 MODULE_PARM_DESC(probe_vlb, "probe for VLB version of CMD640 chipset");
 
+module_param(cmd_clock, int, 0);
+MODULE_PARM_DESC(cmd_clock, "VLB or PCI bus clock frequency (in MHz)");
+
 module_init(cmd640x_init);
#11 lore raw

PATCH 12/12 ide: mark "idebus=" kernel parameter as obsoleted

In reply to Bartlomiej Zolnierkiewicz

We have per host driver "vlb|pci|cmd_clock=" parameters now.

---
 Documentation/ide/ide.txt |   10 ----------
 drivers/ide/ide.c         |    2 +-
 2 files changed, 1 insertion(+), 11 deletions(-)
Documentation/ide/ide.txt +0 -10
Index: b/Documentation/ide/ide.txt
===================================================================
@@ -214,16 +214,6 @@ Summary of ide driver parameters for ker
 
  "hdx=nodma"		: disallow DMA
 
- "idebus=xx"		: inform IDE driver of VESA/PCI bus speed in MHz,
-			  where "xx" is between 20 and 66 inclusive,
-			  used when tuning chipset PIO modes.
-			  For PCI bus, 25 is correct for a P75 system,
-			  30 is correct for P90,P120,P180 systems,
-			  and 33 is used for P100,P133,P166 systems.
-			  If in doubt, use idebus=33 for PCI.
-			  As for VLB, it is safest to not specify it.
-			  Bigger values are safer than smaller ones.
-
  "ide=reverse"		: formerly called to pci sub-system, but now local.
 
 The following are valid ONLY on ide0, which usually corresponds
drivers/ide/ide.c +1 -1
Index: b/drivers/ide/ide.c
===================================================================
@@ -979,7 +979,7 @@ static int __init ide_setup(char *s)
 			idebus_parameter = vals[0];
 		} else
 			printk(" -- BAD BUS SPEED! Expected value from 20 to 66");
-		goto done;
+		goto obsolete_option;
 	}
 
 bad_option:
#13 lore raw
Quoted 9 lines · Alan Cox
Quoted 3 lines · On Thu, 13 Mar 2008 23:43:52 +0100 Bartlomiej Zolnierkiewicz…

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

Surely this value should be set once per system (ditto for PCI) not something you have to set in each specific driver on the box ?

Yeah, I'll re-do the patches. Thanks for pointing this out.

Bart