* [PATCH] sc-ip22.c cleanup
@ 2003-05-07 20:22 Ladislav Michl
2003-05-07 22:17 ` Juan Quintela
0 siblings, 1 reply; 2+ messages in thread
From: Ladislav Michl @ 2003-05-07 20:22 UTC (permalink / raw)
To: linux-mips; +Cc: Ralf Baechle
use serial eeprom access functions to detect scache size
diff -Naur linux_2_4/arch/mips/mm/sc-ip22.c linux_2_4-fucked/arch/mips/mm/sc-ip22.c
--- linux_2_4/arch/mips/mm/sc-ip22.c Thu Apr 17 02:29:14 2003
+++ linux_2_4-fucked/arch/mips/mm/sc-ip22.c Wed May 7 20:10:22 2003
@@ -14,9 +14,7 @@
#include <asm/pgtable.h>
#include <asm/system.h>
#include <asm/bootinfo.h>
-#include <asm/mmu_context.h>
-#include <asm/sgialib.h>
-#include <asm/sgi/sgi.h>
+#include <asm/sgi/ip22.h>
#include <asm/sgi/mc.h>
/* Secondary cache size in bytes, if present. */
@@ -149,60 +147,14 @@
static inline int __init indy_sc_probe(void)
{
- volatile unsigned int *cpu_control;
- unsigned short cmd = 0xc220;
- unsigned long data = 0;
- int i, n;
-
-#ifdef __MIPSEB__
- cpu_control = (volatile unsigned int *) KSEG1ADDR(0x1fa00034);
-#else
- cpu_control = (volatile unsigned int *) KSEG1ADDR(0x1fa00030);
-#endif
-#define DEASSERT(bit) (*(cpu_control) &= (~(bit)))
-#define ASSERT(bit) (*(cpu_control) |= (bit))
-#define DELAY for(n = 0; n < 100000; n++) __asm__ __volatile__("")
- DEASSERT(SGIMC_EEPROM_PRE);
- DEASSERT(SGIMC_EEPROM_SDATAO);
- DEASSERT(SGIMC_EEPROM_SECLOCK);
- DEASSERT(SGIMC_EEPROM_PRE);
- DELAY;
- ASSERT(SGIMC_EEPROM_CSEL); ASSERT(SGIMC_EEPROM_SECLOCK);
- for(i = 0; i < 11; i++) {
- if(cmd & (1<<15))
- ASSERT(SGIMC_EEPROM_SDATAO);
- else
- DEASSERT(SGIMC_EEPROM_SDATAO);
- DEASSERT(SGIMC_EEPROM_SECLOCK);
- ASSERT(SGIMC_EEPROM_SECLOCK);
- cmd <<= 1;
- }
- DEASSERT(SGIMC_EEPROM_SDATAO);
- for(i = 0; i < (sizeof(unsigned short) * 8); i++) {
- unsigned int tmp;
-
- DEASSERT(SGIMC_EEPROM_SECLOCK);
- DELAY;
- ASSERT(SGIMC_EEPROM_SECLOCK);
- DELAY;
- data <<= 1;
- tmp = *cpu_control;
- if(tmp & SGIMC_EEPROM_SDATAI)
- data |= 1;
- }
- DEASSERT(SGIMC_EEPROM_SECLOCK);
- DEASSERT(SGIMC_EEPROM_CSEL);
- ASSERT(SGIMC_EEPROM_PRE);
- ASSERT(SGIMC_EEPROM_SECLOCK);
-
- data <<= PAGE_SHIFT;
- if (data == 0)
+ unsigned long size = ip22_eeprom_read(&sgimc->eeprom, 17);
+ size <<= PAGE_SHIFT;
+ if (size == 0)
return 0;
- scache_size = data;
-
printk(KERN_INFO "R4600/R5000 SCACHE size %ldK, linesize 32 bytes.\n",
- scache_size >> 10);
+ size >> 10);
+ scache_size = size;
return 1;
}
diff -Naur linux_2_4/arch/mips/mm/sc-ip22.c linux_2_4-fucked/arch/mips/mm/sc-ip22.c
--- linux_2_4/arch/mips/mm/sc-ip22.c Thu Apr 17 02:29:14 2003
+++ linux_2_4-fucked/arch/mips/mm/sc-ip22.c Wed May 7 20:10:22 2003
@@ -14,9 +14,7 @@
#include <asm/pgtable.h>
#include <asm/system.h>
#include <asm/bootinfo.h>
-#include <asm/mmu_context.h>
-#include <asm/sgialib.h>
-#include <asm/sgi/sgi.h>
+#include <asm/sgi/ip22.h>
#include <asm/sgi/mc.h>
/* Secondary cache size in bytes, if present. */
@@ -149,60 +147,14 @@
static inline int __init indy_sc_probe(void)
{
- volatile unsigned int *cpu_control;
- unsigned short cmd = 0xc220;
- unsigned long data = 0;
- int i, n;
-
-#ifdef __MIPSEB__
- cpu_control = (volatile unsigned int *) KSEG1ADDR(0x1fa00034);
-#else
- cpu_control = (volatile unsigned int *) KSEG1ADDR(0x1fa00030);
-#endif
-#define DEASSERT(bit) (*(cpu_control) &= (~(bit)))
-#define ASSERT(bit) (*(cpu_control) |= (bit))
-#define DELAY for(n = 0; n < 100000; n++) __asm__ __volatile__("")
- DEASSERT(SGIMC_EEPROM_PRE);
- DEASSERT(SGIMC_EEPROM_SDATAO);
- DEASSERT(SGIMC_EEPROM_SECLOCK);
- DEASSERT(SGIMC_EEPROM_PRE);
- DELAY;
- ASSERT(SGIMC_EEPROM_CSEL); ASSERT(SGIMC_EEPROM_SECLOCK);
- for(i = 0; i < 11; i++) {
- if(cmd & (1<<15))
- ASSERT(SGIMC_EEPROM_SDATAO);
- else
- DEASSERT(SGIMC_EEPROM_SDATAO);
- DEASSERT(SGIMC_EEPROM_SECLOCK);
- ASSERT(SGIMC_EEPROM_SECLOCK);
- cmd <<= 1;
- }
- DEASSERT(SGIMC_EEPROM_SDATAO);
- for(i = 0; i < (sizeof(unsigned short) * 8); i++) {
- unsigned int tmp;
-
- DEASSERT(SGIMC_EEPROM_SECLOCK);
- DELAY;
- ASSERT(SGIMC_EEPROM_SECLOCK);
- DELAY;
- data <<= 1;
- tmp = *cpu_control;
- if(tmp & SGIMC_EEPROM_SDATAI)
- data |= 1;
- }
- DEASSERT(SGIMC_EEPROM_SECLOCK);
- DEASSERT(SGIMC_EEPROM_CSEL);
- ASSERT(SGIMC_EEPROM_PRE);
- ASSERT(SGIMC_EEPROM_SECLOCK);
-
- data <<= PAGE_SHIFT;
- if (data == 0)
+ unsigned long size = ip22_eeprom_read(&sgimc->eeprom, 17);
+ size <<= PAGE_SHIFT;
+ if (size == 0)
return 0;
- scache_size = data;
-
printk(KERN_INFO "R4600/R5000 SCACHE size %ldK, linesize 32 bytes.\n",
- scache_size >> 10);
+ size >> 10);
+ scache_size = size;
return 1;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] sc-ip22.c cleanup
2003-05-07 20:22 [PATCH] sc-ip22.c cleanup Ladislav Michl
@ 2003-05-07 22:17 ` Juan Quintela
0 siblings, 0 replies; 2+ messages in thread
From: Juan Quintela @ 2003-05-07 22:17 UTC (permalink / raw)
To: Ladislav Michl; +Cc: linux-mips, Ralf Baechle
>>>>> "ladis" == Ladislav Michl <ladis@linux-mips.org> writes:
Hi
ladis> + unsigned long size = ip22_eeprom_read(&sgimc->eeprom, 17);
Defining somewhere what 17 mean could be a good idea :)
Except for that looks like a good gain, you remove a lot fo code :)
Later, Juan.
--
In theory, practice and theory are the same, but in practice they
are different -- Larry McVoy
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-05-07 22:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-07 20:22 [PATCH] sc-ip22.c cleanup Ladislav Michl
2003-05-07 22:17 ` Juan Quintela
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox