File tree Expand file tree Collapse file tree 7 files changed +28
-14
lines changed
include/asm/mach-loongson Expand file tree Collapse file tree 7 files changed +28
-14
lines changed Original file line number Diff line number Diff line change @@ -249,8 +249,11 @@ static inline void do_perfcnt_IRQ(void)
249249#define LOONGSON_PXARB_CFG LOONGSON_REG(LOONGSON_REGBASE + 0x68)
250250#define LOONGSON_PXARB_STATUS LOONGSON_REG(LOONGSON_REGBASE + 0x6c)
251251
252- /* Chip Config */
253- #define LOONGSON_CHIPCFG0 LOONGSON_REG(LOONGSON_REGBASE + 0x80)
252+ #define MAX_PACKAGES 4
253+
254+ /* Chip Config registor of each physical cpu package, PRid >= Loongson-2F */
255+ extern u64 loongson_chipcfg [MAX_PACKAGES ];
256+ #define LOONGSON_CHIPCFG (id ) (*(volatile u32 *)(loongson_chipcfg[id]))
254257
255258/* pcimap */
256259
Original file line number Diff line number Diff line change @@ -27,6 +27,8 @@ EXPORT_SYMBOL(cpu_clock_freq);
2727struct efi_memory_map_loongson * loongson_memmap ;
2828struct loongson_system_configuration loongson_sysconf ;
2929
30+ u64 loongson_chipcfg [MAX_PACKAGES ] = {0xffffffffbfc00180 };
31+
3032#define parse_even_earlier (res , option , p ) \
3133do { \
3234 unsigned int tmp __maybe_unused; \
@@ -77,6 +79,15 @@ void __init prom_init_env(void)
7779
7880 cpu_clock_freq = ecpu -> cpu_clock_freq ;
7981 loongson_sysconf .cputype = ecpu -> cputype ;
82+ if (ecpu -> cputype == Loongson_3A ) {
83+ loongson_chipcfg [0 ] = 0x900000001fe00180 ;
84+ loongson_chipcfg [1 ] = 0x900010001fe00180 ;
85+ loongson_chipcfg [2 ] = 0x900020001fe00180 ;
86+ loongson_chipcfg [3 ] = 0x900030001fe00180 ;
87+ } else {
88+ loongson_chipcfg [0 ] = 0x900000001fe00180 ;
89+ }
90+
8091 loongson_sysconf .nr_cpus = ecpu -> nr_cpus ;
8192 if (ecpu -> nr_cpus > NR_CPUS || ecpu -> nr_cpus == 0 )
8293 loongson_sysconf .nr_cpus = NR_CPUS ;
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ int __weak wakeup_loongson(void)
7979static void wait_for_wakeup_events (void )
8080{
8181 while (!wakeup_loongson ())
82- LOONGSON_CHIPCFG0 &= ~0x7 ;
82+ LOONGSON_CHIPCFG ( 0 ) &= ~0x7 ;
8383}
8484
8585/*
@@ -102,15 +102,15 @@ static void loongson_suspend_enter(void)
102102
103103 stop_perf_counters ();
104104
105- cached_cpu_freq = LOONGSON_CHIPCFG0 ;
105+ cached_cpu_freq = LOONGSON_CHIPCFG ( 0 ) ;
106106
107107 /* Put CPU into wait mode */
108- LOONGSON_CHIPCFG0 &= ~0x7 ;
108+ LOONGSON_CHIPCFG ( 0 ) &= ~0x7 ;
109109
110110 /* wait for the given events to wakeup cpu from wait mode */
111111 wait_for_wakeup_events ();
112112
113- LOONGSON_CHIPCFG0 = cached_cpu_freq ;
113+ LOONGSON_CHIPCFG ( 0 ) = cached_cpu_freq ;
114114 mmiowb ();
115115}
116116
Original file line number Diff line number Diff line change @@ -114,9 +114,9 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
114114
115115 clk -> rate = rate ;
116116
117- regval = LOONGSON_CHIPCFG0 ;
117+ regval = LOONGSON_CHIPCFG ( 0 ) ;
118118 regval = (regval & ~0x7 ) | (pos -> driver_data - 1 );
119- LOONGSON_CHIPCFG0 = regval ;
119+ LOONGSON_CHIPCFG ( 0 ) = regval ;
120120
121121 return ret ;
122122}
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ static void reset_cpu(void)
2828 * reset cpu to full speed, this is needed when enabling cpu frequency
2929 * scalling
3030 */
31- LOONGSON_CHIPCFG0 |= 0x7 ;
31+ LOONGSON_CHIPCFG ( 0 ) |= 0x7 ;
3232}
3333
3434/* reset support for fuloong2f */
Original file line number Diff line number Diff line change @@ -399,12 +399,12 @@ static int loongson3_cpu_callback(struct notifier_block *nfb,
399399 case CPU_POST_DEAD :
400400 case CPU_POST_DEAD_FROZEN :
401401 pr_info ("Disable clock for CPU#%d\n" , cpu );
402- LOONGSON_CHIPCFG0 &= ~(1 << (12 + cpu ));
402+ LOONGSON_CHIPCFG ( 0 ) &= ~(1 << (12 + cpu ));
403403 break ;
404404 case CPU_UP_PREPARE :
405405 case CPU_UP_PREPARE_FROZEN :
406406 pr_info ("Enable clock for CPU#%d\n" , cpu );
407- LOONGSON_CHIPCFG0 |= 1 << (12 + cpu );
407+ LOONGSON_CHIPCFG ( 0 ) |= 1 << (12 + cpu );
408408 break ;
409409 }
410410
Original file line number Diff line number Diff line change @@ -148,9 +148,9 @@ static void loongson2_cpu_wait(void)
148148 u32 cpu_freq ;
149149
150150 spin_lock_irqsave (& loongson2_wait_lock , flags );
151- cpu_freq = LOONGSON_CHIPCFG0 ;
152- LOONGSON_CHIPCFG0 &= ~0x7 ; /* Put CPU into wait mode */
153- LOONGSON_CHIPCFG0 = cpu_freq ; /* Restore CPU state */
151+ cpu_freq = LOONGSON_CHIPCFG ( 0 ) ;
152+ LOONGSON_CHIPCFG ( 0 ) &= ~0x7 ; /* Put CPU into wait mode */
153+ LOONGSON_CHIPCFG ( 0 ) = cpu_freq ; /* Restore CPU state */
154154 spin_unlock_irqrestore (& loongson2_wait_lock , flags );
155155 local_irq_enable ();
156156}
You can’t perform that action at this time.
0 commit comments