From 73b0c0b0c1fa06acc3a02a58f301b0db0818d3d0 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sun, 21 Oct 2007 17:03:31 +0800 Subject: Blackfin arch: Fix up /proc/cpuinfo so it is like everyone else Fix up /proc/cpuinfo so it is like everyone else, and gets parsed by various applications properly. Still needs some tweaking on parts without full L1 sram, like 532, 531, so it doesn't print out L1 bank info that doesn't exist. Signed-off-by: Robin Getz Signed-off-by: Bryan Wu --- arch/blackfin/kernel/setup.c | 100 ++++++++++++++++++++++++++----------------- 1 file changed, 61 insertions(+), 39 deletions(-) (limited to 'arch/blackfin/kernel/setup.c') diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c index 8dcd76e87ed5..34fbf93cc118 100644 --- a/arch/blackfin/kernel/setup.c +++ b/arch/blackfin/kernel/setup.c @@ -498,7 +498,7 @@ EXPORT_SYMBOL(get_sclk); */ static int show_cpuinfo(struct seq_file *m, void *v) { - char *cpu, *mmu, *fpu, *name; + char *cpu, *mmu, *fpu, *name, vendor[20], cache[30]; uint32_t revid; u_long cclk = 0, sclk = 0; @@ -513,65 +513,78 @@ static int show_cpuinfo(struct seq_file *m, void *v) cclk = get_cclk(); sclk = get_sclk(); - seq_printf(m, "CPU:\t\tADSP-%s Rev. 0.%d\n" - "MMU:\t\t%s\n" - "FPU:\t\t%s\n" - "Core Clock:\t%9lu Hz\n" - "System Clock:\t%9lu Hz\n" - "BogoMips:\t%lu.%02lu\n" - "Calibration:\t%lu loops\n", - cpu, revid, mmu, fpu, - cclk, - sclk, - (loops_per_jiffy * HZ) / 500000, - ((loops_per_jiffy * HZ) / 5000) % 100, - (loops_per_jiffy * HZ)); - seq_printf(m, "Board Name:\t%s\n", name); - seq_printf(m, "Board Memory:\t%ld MB\n", physical_mem_end >> 20); - seq_printf(m, "Kernel Memory:\t%ld MB\n", (unsigned long)_ramend >> 20); - if (bfin_read_IMEM_CONTROL() & (ENICPLB | IMC)) - seq_printf(m, "I-CACHE:\tON\n"); - else - seq_printf(m, "I-CACHE:\tOFF\n"); - if ((bfin_read_DMEM_CONTROL()) & (ENDCPLB | DMC_ENABLE)) - seq_printf(m, "D-CACHE:\tON" -#if defined CONFIG_BFIN_WB - " (write-back)" -#elif defined CONFIG_BFIN_WT - " (write-through)" -#endif - "\n"); - else - seq_printf(m, "D-CACHE:\tOFF\n"); - + switch (bfin_read_CHIPID() & CHIPID_MANUFACTURE) { + case(0xca): + strcpy(vendor, "AnalogDevices"); + break; + default: + strcpy(vendor, "unknown"); + } + seq_printf(m, "processor\t: %d\n" + "vendor_id\t: %s\n" + "cpu family\t: 0x%x\n" + "model name\t: ADSP-%s %lu(MHz CCLK) %lu(MHz SCLK)\n" + "stepping\t: %d\n", + 0, + vendor, + (bfin_read_CHIPID() & CHIPID_FAMILY), + cpu, cclk/1000000, sclk/1000000, + revid); + + seq_printf(m, "cpu MHz\t\t: %lu.%03lu/%lu.%03lu\n", + cclk/1000000, cclk%1000000, + sclk/1000000, sclk%1000000); + seq_printf(m, "bogomips\t: %lu.%02lu\n" + "Calibration\t: %lu loops\n", + (loops_per_jiffy * HZ) / 500000, + ((loops_per_jiffy * HZ) / 5000) % 100, + (loops_per_jiffy * HZ)); + + /* Check Cache configutation */ switch (bfin_read_DMEM_CONTROL() & (1 << DMC0_P | 1 << DMC1_P)) { case ACACHE_BSRAM: - seq_printf(m, "DBANK-A:\tCACHE\n" "DBANK-B:\tSRAM\n"); + strcpy(cache, "dbank-A/B\t: cache/sram"); dcache_size = 16; dsup_banks = 1; break; case ACACHE_BCACHE: - seq_printf(m, "DBANK-A:\tCACHE\n" "DBANK-B:\tCACHE\n"); + strcpy(cache, "dbank-A/B\t: cache/cache"); dcache_size = 32; dsup_banks = 2; break; case ASRAM_BSRAM: - seq_printf(m, "DBANK-A:\tSRAM\n" "DBANK-B:\tSRAM\n"); + strcpy(cache, "dbank-A/B\t: sram/sram"); dcache_size = 0; dsup_banks = 0; break; default: + strcpy(cache, "unknown"); + dcache_size = 0; + dsup_banks = 0; break; } + /* Is it turned on? */ + if (!((bfin_read_DMEM_CONTROL()) & (ENDCPLB | DMC_ENABLE))) + dcache_size = 0; - seq_printf(m, "I-CACHE Size:\t%dKB\n", BFIN_ICACHESIZE / 1024); - seq_printf(m, "D-CACHE Size:\t%dKB\n", dcache_size); - seq_printf(m, "I-CACHE Setup:\t%d Sub-banks/%d Ways, %d Lines/Way\n", + seq_printf(m, "cache size\t: %d KB(L1 icache) " + "%d KB(L1 dcache-%s) %d KB(L2 cache)\n", + BFIN_ICACHESIZE / 1024, dcache_size, +#if defined CONFIG_BFIN_WB + "wb" +#elif defined CONFIG_BFIN_WT + "wt" +#endif + , 0); + + seq_printf(m, "%s\n", cache); + + seq_printf(m, "icache setup\t: %d Sub-banks/%d Ways, %d Lines/Way\n", BFIN_ISUBBANKS, BFIN_IWAYS, BFIN_ILINES); seq_printf(m, - "D-CACHE Setup:\t%d Super-banks/%d Sub-banks/%d Ways, %d Lines/Way\n", + "dcache setup\t: %d Super-banks/%d Sub-banks/%d Ways, %d Lines/Way\n", dsup_banks, BFIN_DSUBBANKS, BFIN_DWAYS, BFIN_DLINES); #ifdef CONFIG_BFIN_ICACHE_LOCK @@ -625,6 +638,15 @@ static int show_cpuinfo(struct seq_file *m, void *v) seq_printf(m, "No Ways are locked\n"); } #endif + + seq_printf(m, "board name\t: %s\n", name); + seq_printf(m, "board memory\t: %ld kB (0x%p -> 0x%p)\n", + physical_mem_end >> 10, (void *)0, (void *)physical_mem_end); + seq_printf(m, "kernel memory\t: %d kB (0x%p -> 0x%p)\n", + ((int)memory_end - (int)_stext) >> 10, + _stext, + (void *)memory_end); + return 0; } -- cgit v1.2.3-59-g8ed1b From 066954a3891d32198edad3b319792d8db6a6a575 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 21 Oct 2007 22:36:06 +0800 Subject: Blackfin arch: use "char bfin_board_name[]" rather than "char *bfin_board_name" per discussion on lkml as the former uses less storage Signed-off-by: Mike Frysinger Signed-off-by: Bryan Wu --- arch/blackfin/kernel/setup.c | 20 ++++++++++---------- arch/blackfin/mach-bf527/boards/ezkit.c | 2 +- arch/blackfin/mach-bf533/boards/cm_bf533.c | 2 +- arch/blackfin/mach-bf533/boards/ezkit.c | 2 +- arch/blackfin/mach-bf533/boards/generic_board.c | 2 +- arch/blackfin/mach-bf533/boards/stamp.c | 2 +- arch/blackfin/mach-bf537/boards/cm_bf537.c | 2 +- arch/blackfin/mach-bf537/boards/generic_board.c | 2 +- arch/blackfin/mach-bf537/boards/pnav10.c | 2 +- arch/blackfin/mach-bf537/boards/stamp.c | 2 +- arch/blackfin/mach-bf548/boards/ezkit.c | 2 +- arch/blackfin/mach-bf561/boards/cm_bf561.c | 2 +- arch/blackfin/mach-bf561/boards/ezkit.c | 2 +- arch/blackfin/mach-bf561/boards/generic_board.c | 2 +- arch/blackfin/mach-bf561/boards/tepla.c | 2 +- include/asm-blackfin/bfin-global.h | 2 +- 16 files changed, 25 insertions(+), 25 deletions(-) (limited to 'arch/blackfin/kernel/setup.c') diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c index 34fbf93cc118..6b85145f8488 100644 --- a/arch/blackfin/kernel/setup.c +++ b/arch/blackfin/kernel/setup.c @@ -498,7 +498,7 @@ EXPORT_SYMBOL(get_sclk); */ static int show_cpuinfo(struct seq_file *m, void *v) { - char *cpu, *mmu, *fpu, *name, vendor[20], cache[30]; + char *cpu, *mmu, *fpu, *vendor, *cache; uint32_t revid; u_long cclk = 0, sclk = 0; @@ -508,17 +508,17 @@ static int show_cpuinfo(struct seq_file *m, void *v) mmu = "none"; fpu = "none"; revid = bfin_revid(); - name = bfin_board_name; cclk = get_cclk(); sclk = get_sclk(); switch (bfin_read_CHIPID() & CHIPID_MANUFACTURE) { - case(0xca): - strcpy(vendor, "AnalogDevices"); + case 0xca: + vendor = "Analog Devices"; break; default: - strcpy(vendor, "unknown"); + vendor = "unknown"; + break; } seq_printf(m, "processor\t: %d\n" @@ -544,22 +544,22 @@ static int show_cpuinfo(struct seq_file *m, void *v) /* Check Cache configutation */ switch (bfin_read_DMEM_CONTROL() & (1 << DMC0_P | 1 << DMC1_P)) { case ACACHE_BSRAM: - strcpy(cache, "dbank-A/B\t: cache/sram"); + cache = "dbank-A/B\t: cache/sram"; dcache_size = 16; dsup_banks = 1; break; case ACACHE_BCACHE: - strcpy(cache, "dbank-A/B\t: cache/cache"); + cache = "dbank-A/B\t: cache/cache"; dcache_size = 32; dsup_banks = 2; break; case ASRAM_BSRAM: - strcpy(cache, "dbank-A/B\t: sram/sram"); + cache = "dbank-A/B\t: sram/sram"; dcache_size = 0; dsup_banks = 0; break; default: - strcpy(cache, "unknown"); + cache = "unknown"; dcache_size = 0; dsup_banks = 0; break; @@ -639,7 +639,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) } #endif - seq_printf(m, "board name\t: %s\n", name); + seq_printf(m, "board name\t: %s\n", bfin_board_name); seq_printf(m, "board memory\t: %ld kB (0x%p -> 0x%p)\n", physical_mem_end >> 10, (void *)0, (void *)physical_mem_end); seq_printf(m, "kernel memory\t: %d kB (0x%p -> 0x%p)\n", diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c index 09fb624af5ac..3e884f3a8182 100644 --- a/arch/blackfin/mach-bf527/boards/ezkit.c +++ b/arch/blackfin/mach-bf527/boards/ezkit.c @@ -49,7 +49,7 @@ /* * Name the Board for the /proc/cpuinfo */ -char *bfin_board_name = "ADDS-BF527-EZKIT"; +const char bfin_board_name[] = "ADDS-BF527-EZKIT"; /* * Driver needs to know address, irq and flag pin. diff --git a/arch/blackfin/mach-bf533/boards/cm_bf533.c b/arch/blackfin/mach-bf533/boards/cm_bf533.c index a57b52d207cd..1c5a86adfab7 100644 --- a/arch/blackfin/mach-bf533/boards/cm_bf533.c +++ b/arch/blackfin/mach-bf533/boards/cm_bf533.c @@ -42,7 +42,7 @@ /* * Name the Board for the /proc/cpuinfo */ -char *bfin_board_name = "Bluetechnix CM BF533"; +const char bfin_board_name[] = "Bluetechnix CM BF533"; #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) /* all SPI peripherals info goes here */ diff --git a/arch/blackfin/mach-bf533/boards/ezkit.c b/arch/blackfin/mach-bf533/boards/ezkit.c index 5c1e35d3c012..34b63920e272 100644 --- a/arch/blackfin/mach-bf533/boards/ezkit.c +++ b/arch/blackfin/mach-bf533/boards/ezkit.c @@ -43,7 +43,7 @@ /* * Name the Board for the /proc/cpuinfo */ -char *bfin_board_name = "ADDS-BF533-EZKIT"; +const char bfin_board_name[] = "ADDS-BF533-EZKIT"; #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) static struct platform_device rtc_device = { diff --git a/arch/blackfin/mach-bf533/boards/generic_board.c b/arch/blackfin/mach-bf533/boards/generic_board.c index 9bc1f0d0ab50..310b7772c458 100644 --- a/arch/blackfin/mach-bf533/boards/generic_board.c +++ b/arch/blackfin/mach-bf533/boards/generic_board.c @@ -35,7 +35,7 @@ /* * Name the Board for the /proc/cpuinfo */ -char *bfin_board_name = "UNKNOWN BOARD"; +const char bfin_board_name[] = "UNKNOWN BOARD"; #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) static struct platform_device rtc_device = { diff --git a/arch/blackfin/mach-bf533/boards/stamp.c b/arch/blackfin/mach-bf533/boards/stamp.c index 8975e06ea158..f84be4eabfd1 100644 --- a/arch/blackfin/mach-bf533/boards/stamp.c +++ b/arch/blackfin/mach-bf533/boards/stamp.c @@ -46,7 +46,7 @@ /* * Name the Board for the /proc/cpuinfo */ -char *bfin_board_name = "ADDS-BF533-STAMP"; +const char bfin_board_name[] = "ADDS-BF533-STAMP"; #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) static struct platform_device rtc_device = { diff --git a/arch/blackfin/mach-bf537/boards/cm_bf537.c b/arch/blackfin/mach-bf537/boards/cm_bf537.c index 44dea05e1d03..52e2320307de 100644 --- a/arch/blackfin/mach-bf537/boards/cm_bf537.c +++ b/arch/blackfin/mach-bf537/boards/cm_bf537.c @@ -43,7 +43,7 @@ /* * Name the Board for the /proc/cpuinfo */ -char *bfin_board_name = "Bluetechnix CM BF537"; +const char bfin_board_name[] = "Bluetechnix CM BF537"; #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) /* all SPI peripherals info goes here */ diff --git a/arch/blackfin/mach-bf537/boards/generic_board.c b/arch/blackfin/mach-bf537/boards/generic_board.c index 6668c8e4a3fc..255da7a98481 100644 --- a/arch/blackfin/mach-bf537/boards/generic_board.c +++ b/arch/blackfin/mach-bf537/boards/generic_board.c @@ -49,7 +49,7 @@ /* * Name the Board for the /proc/cpuinfo */ -char *bfin_board_name = "GENERIC Board"; +const char bfin_board_name[] = "GENERIC Board"; /* * Driver needs to know address, irq and flag pin. diff --git a/arch/blackfin/mach-bf537/boards/pnav10.c b/arch/blackfin/mach-bf537/boards/pnav10.c index f83a2544004d..87b808926789 100644 --- a/arch/blackfin/mach-bf537/boards/pnav10.c +++ b/arch/blackfin/mach-bf537/boards/pnav10.c @@ -47,7 +47,7 @@ /* * Name the Board for the /proc/cpuinfo */ -char *bfin_board_name = "PNAV-1.0"; +const char bfin_board_name[] = "PNAV-1.0"; /* * Driver needs to know address, irq and flag pin. diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c index f42ba3aa86d7..cc41f6c2ef4f 100644 --- a/arch/blackfin/mach-bf537/boards/stamp.c +++ b/arch/blackfin/mach-bf537/boards/stamp.c @@ -49,7 +49,7 @@ /* * Name the Board for the /proc/cpuinfo */ -char *bfin_board_name = "ADDS-BF537-STAMP"; +const char bfin_board_name[] = "ADDS-BF537-STAMP"; /* * Driver needs to know address, irq and flag pin. diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c index 046e6d84bbfc..f5428a57b6e2 100644 --- a/arch/blackfin/mach-bf548/boards/ezkit.c +++ b/arch/blackfin/mach-bf548/boards/ezkit.c @@ -49,7 +49,7 @@ /* * Name the Board for the /proc/cpuinfo */ -char *bfin_board_name = "ADSP-BF548-EZKIT"; +const char bfin_board_name[] = "ADSP-BF548-EZKIT"; /* * Driver needs to know address, irq and flag pin. diff --git a/arch/blackfin/mach-bf561/boards/cm_bf561.c b/arch/blackfin/mach-bf561/boards/cm_bf561.c index cd827a1b6ba1..97aeb43fd8b4 100644 --- a/arch/blackfin/mach-bf561/boards/cm_bf561.c +++ b/arch/blackfin/mach-bf561/boards/cm_bf561.c @@ -42,7 +42,7 @@ /* * Name the Board for the /proc/cpuinfo */ -char *bfin_board_name = "Bluetechnix CM BF561"; +const char bfin_board_name[] = "Bluetechnix CM BF561"; #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) /* all SPI peripherals info goes here */ diff --git a/arch/blackfin/mach-bf561/boards/ezkit.c b/arch/blackfin/mach-bf561/boards/ezkit.c index 57e14edca8b1..059d516cec23 100644 --- a/arch/blackfin/mach-bf561/boards/ezkit.c +++ b/arch/blackfin/mach-bf561/boards/ezkit.c @@ -39,7 +39,7 @@ /* * Name the Board for the /proc/cpuinfo */ -char *bfin_board_name = "ADDS-BF561-EZKIT"; +const char bfin_board_name[] = "ADDS-BF561-EZKIT"; #define ISP1761_BASE 0x2C0F0000 #define ISP1761_IRQ IRQ_PF10 diff --git a/arch/blackfin/mach-bf561/boards/generic_board.c b/arch/blackfin/mach-bf561/boards/generic_board.c index 4dfea5da674c..46816be4b2ba 100644 --- a/arch/blackfin/mach-bf561/boards/generic_board.c +++ b/arch/blackfin/mach-bf561/boards/generic_board.c @@ -32,7 +32,7 @@ #include #include -char *bfin_board_name = "UNKNOWN BOARD"; +const char bfin_board_name[] = "UNKNOWN BOARD"; /* * Driver needs to know address, irq and flag pin. diff --git a/arch/blackfin/mach-bf561/boards/tepla.c b/arch/blackfin/mach-bf561/boards/tepla.c index c442eb23db5e..4a17c6da2a59 100644 --- a/arch/blackfin/mach-bf561/boards/tepla.c +++ b/arch/blackfin/mach-bf561/boards/tepla.c @@ -16,7 +16,7 @@ #include #include -char *bfin_board_name = "Tepla-BF561"; +const char bfin_board_name[] = "Tepla-BF561"; /* * Driver needs to know address, irq and flag pin. diff --git a/include/asm-blackfin/bfin-global.h b/include/asm-blackfin/bfin-global.h index a970781a0f98..a006353a4310 100644 --- a/include/asm-blackfin/bfin-global.h +++ b/include/asm-blackfin/bfin-global.h @@ -105,7 +105,7 @@ extern void led_disp_num(int); extern void led_toggle_num(int); extern void init_leds(void); -extern char *bfin_board_name __attribute__ ((weak)); +extern const char bfin_board_name[]; extern unsigned long wall_jiffies; extern unsigned long ipdt_table[]; extern unsigned long dpdt_table[]; -- cgit v1.2.3-59-g8ed1b From 2f6cf7bfc64c44d760d53caf4b547e7729392e78 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 21 Oct 2007 22:59:49 +0800 Subject: Blackfin arch: add functions for converting between sclks and usecs Signed-off-by: Mike Frysinger Signed-off-by: Bryan Wu --- arch/blackfin/kernel/setup.c | 14 +++++++++++++- include/asm-blackfin/bfin-global.h | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'arch/blackfin/kernel/setup.c') diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c index 6b85145f8488..0e746449c29b 100644 --- a/arch/blackfin/kernel/setup.c +++ b/arch/blackfin/kernel/setup.c @@ -459,7 +459,7 @@ static u_long get_vco(void) return vco; } -/*Get the Core clock*/ +/* Get the Core clock */ u_long get_cclk(void) { u_long csel, ssel; @@ -493,6 +493,18 @@ u_long get_sclk(void) } EXPORT_SYMBOL(get_sclk); +unsigned long sclk_to_usecs(unsigned long sclk) +{ + return (USEC_PER_SEC * (u64)sclk) / get_sclk(); +} +EXPORT_SYMBOL(sclk_to_usecs); + +unsigned long usecs_to_sclk(unsigned long usecs) +{ + return get_sclk() / (USEC_PER_SEC * (u64)usecs); +} +EXPORT_SYMBOL(usecs_to_sclk); + /* * Get CPU information for use by the procfs. */ diff --git a/include/asm-blackfin/bfin-global.h b/include/asm-blackfin/bfin-global.h index a006353a4310..14cb8d35924e 100644 --- a/include/asm-blackfin/bfin-global.h +++ b/include/asm-blackfin/bfin-global.h @@ -47,6 +47,8 @@ extern unsigned long get_cclk(void); extern unsigned long get_sclk(void); +extern unsigned long sclk_to_usecs(unsigned long sclk); +extern unsigned long usecs_to_sclk(unsigned long usecs); extern void dump_thread(struct pt_regs *regs, struct user *dump); extern void dump_bfin_regs(struct pt_regs *fp, void *retaddr); -- cgit v1.2.3-59-g8ed1b