aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/kernel
diff options
context:
space:
mode:
authorBob Liu <lliubbo@gmail.com>2012-05-16 05:37:24 -0400
committerBob Liu <lliubbo@gmail.com>2012-05-21 02:54:12 -0400
commitb5affb0147cee0ea05d909396f8e389092729236 (patch)
tree483471450269ac65f7748b5408c7f77520421d55 /arch/blackfin/kernel
parent22a826288522863fb748851824ce634eda4f1b07 (diff)
blackfin: add bf60x to current framework
This patch added bf60x to current blackfin kernel framework. Signed-off-by: Bob Liu <lliubbo@gmail.com>
Diffstat (limited to 'arch/blackfin/kernel')
-rw-r--r--arch/blackfin/kernel/bfin_dma.c143
-rw-r--r--arch/blackfin/kernel/bfin_gpio.c27
-rw-r--r--arch/blackfin/kernel/debug-mmrs.c9
-rw-r--r--arch/blackfin/kernel/process.c8
-rw-r--r--arch/blackfin/kernel/reboot.c6
-rw-r--r--arch/blackfin/kernel/setup.c159
-rw-r--r--arch/blackfin/kernel/shadow_console.c6
7 files changed, 282 insertions, 76 deletions
diff --git a/arch/blackfin/kernel/bfin_dma.c b/arch/blackfin/kernel/bfin_dma.c
index 40c2ed61258e..b612324fb8da 100644
--- a/arch/blackfin/kernel/bfin_dma.c
+++ b/arch/blackfin/kernel/bfin_dma.c
@@ -45,9 +45,15 @@ static int __init blackfin_dma_init(void)
45 atomic_set(&dma_ch[i].chan_status, 0); 45 atomic_set(&dma_ch[i].chan_status, 0);
46 dma_ch[i].regs = dma_io_base_addr[i]; 46 dma_ch[i].regs = dma_io_base_addr[i];
47 } 47 }
48#ifdef CH_MEM_STREAM3_SRC
49 /* Mark MEMDMA Channel 3 as requested since we're using it internally */
50 request_dma(CH_MEM_STREAM3_DEST, "Blackfin dma_memcpy");
51 request_dma(CH_MEM_STREAM3_SRC, "Blackfin dma_memcpy");
52#else
48 /* Mark MEMDMA Channel 0 as requested since we're using it internally */ 53 /* Mark MEMDMA Channel 0 as requested since we're using it internally */
49 request_dma(CH_MEM_STREAM0_DEST, "Blackfin dma_memcpy"); 54 request_dma(CH_MEM_STREAM0_DEST, "Blackfin dma_memcpy");
50 request_dma(CH_MEM_STREAM0_SRC, "Blackfin dma_memcpy"); 55 request_dma(CH_MEM_STREAM0_SRC, "Blackfin dma_memcpy");
56#endif
51 57
52#if defined(CONFIG_DEB_DMA_URGENT) 58#if defined(CONFIG_DEB_DMA_URGENT)
53 bfin_write_EBIU_DDRQUE(bfin_read_EBIU_DDRQUE() 59 bfin_write_EBIU_DDRQUE(bfin_read_EBIU_DDRQUE()
@@ -204,6 +210,7 @@ EXPORT_SYMBOL(free_dma);
204# ifndef MAX_DMA_SUSPEND_CHANNELS 210# ifndef MAX_DMA_SUSPEND_CHANNELS
205# define MAX_DMA_SUSPEND_CHANNELS MAX_DMA_CHANNELS 211# define MAX_DMA_SUSPEND_CHANNELS MAX_DMA_CHANNELS
206# endif 212# endif
213# ifndef CONFIG_BF60x
207int blackfin_dma_suspend(void) 214int blackfin_dma_suspend(void)
208{ 215{
209 int i; 216 int i;
@@ -213,7 +220,6 @@ int blackfin_dma_suspend(void)
213 printk(KERN_ERR "DMA Channel %d failed to suspend\n", i); 220 printk(KERN_ERR "DMA Channel %d failed to suspend\n", i);
214 return -EBUSY; 221 return -EBUSY;
215 } 222 }
216
217 if (i < MAX_DMA_SUSPEND_CHANNELS) 223 if (i < MAX_DMA_SUSPEND_CHANNELS)
218 dma_ch[i].saved_peripheral_map = dma_ch[i].regs->peripheral_map; 224 dma_ch[i].saved_peripheral_map = dma_ch[i].regs->peripheral_map;
219 } 225 }
@@ -230,7 +236,6 @@ void blackfin_dma_resume(void)
230 236
231 for (i = 0; i < MAX_DMA_CHANNELS; ++i) { 237 for (i = 0; i < MAX_DMA_CHANNELS; ++i) {
232 dma_ch[i].regs->cfg = 0; 238 dma_ch[i].regs->cfg = 0;
233
234 if (i < MAX_DMA_SUSPEND_CHANNELS) 239 if (i < MAX_DMA_SUSPEND_CHANNELS)
235 dma_ch[i].regs->peripheral_map = dma_ch[i].saved_peripheral_map; 240 dma_ch[i].regs->peripheral_map = dma_ch[i].saved_peripheral_map;
236 } 241 }
@@ -238,6 +243,16 @@ void blackfin_dma_resume(void)
238 bfin_write_DMAC_TC_PER(0x0111); 243 bfin_write_DMAC_TC_PER(0x0111);
239#endif 244#endif
240} 245}
246# else
247int blackfin_dma_suspend(void)
248{
249 return 0;
250}
251
252void blackfin_dma_resume(void)
253{
254}
255#endif
241#endif 256#endif
242 257
243/** 258/**
@@ -279,10 +294,10 @@ void __init early_dma_memcpy(void *pdst, const void *psrc, size_t size)
279 src_ch = (struct dma_register *)MDMA_S0_NEXT_DESC_PTR; 294 src_ch = (struct dma_register *)MDMA_S0_NEXT_DESC_PTR;
280 } 295 }
281 296
282 if (!bfin_read16(&src_ch->cfg)) 297 if (!DMA_MMR_READ(&src_ch->cfg))
283 break; 298 break;
284 else if (bfin_read16(&dst_ch->irq_status) & DMA_DONE) { 299 else if (DMA_MMR_READ(&dst_ch->irq_status) & DMA_DONE) {
285 bfin_write16(&src_ch->cfg, 0); 300 DMA_MMR_WRITE(&src_ch->cfg, 0);
286 break; 301 break;
287 } 302 }
288 } 303 }
@@ -295,22 +310,31 @@ void __init early_dma_memcpy(void *pdst, const void *psrc, size_t size)
295 310
296 /* Destination */ 311 /* Destination */
297 bfin_write32(&dst_ch->start_addr, dst); 312 bfin_write32(&dst_ch->start_addr, dst);
298 bfin_write16(&dst_ch->x_count, size >> 2); 313 DMA_MMR_WRITE(&dst_ch->x_count, size >> 2);
299 bfin_write16(&dst_ch->x_modify, 1 << 2); 314 DMA_MMR_WRITE(&dst_ch->x_modify, 1 << 2);
300 bfin_write16(&dst_ch->irq_status, DMA_DONE | DMA_ERR); 315 DMA_MMR_WRITE(&dst_ch->irq_status, DMA_DONE | DMA_ERR);
301 316
302 /* Source */ 317 /* Source */
303 bfin_write32(&src_ch->start_addr, src); 318 bfin_write32(&src_ch->start_addr, src);
304 bfin_write16(&src_ch->x_count, size >> 2); 319 DMA_MMR_WRITE(&src_ch->x_count, size >> 2);
305 bfin_write16(&src_ch->x_modify, 1 << 2); 320 DMA_MMR_WRITE(&src_ch->x_modify, 1 << 2);
306 bfin_write16(&src_ch->irq_status, DMA_DONE | DMA_ERR); 321 DMA_MMR_WRITE(&src_ch->irq_status, DMA_DONE | DMA_ERR);
307 322
308 /* Enable */ 323 /* Enable */
309 bfin_write16(&src_ch->cfg, DMAEN | WDSIZE_32); 324 DMA_MMR_WRITE(&src_ch->cfg, DMAEN | WDSIZE_32);
310 bfin_write16(&dst_ch->cfg, WNR | DI_EN | DMAEN | WDSIZE_32); 325 DMA_MMR_WRITE(&dst_ch->cfg, WNR | DI_EN_X | DMAEN | WDSIZE_32);
311 326
312 /* Since we are atomic now, don't use the workaround ssync */ 327 /* Since we are atomic now, don't use the workaround ssync */
313 __builtin_bfin_ssync(); 328 __builtin_bfin_ssync();
329
330#ifdef CONFIG_BF60x
331 /* Work around a possible MDMA anomaly. Running 2 MDMA channels to
332 * transfer DDR data to L1 SRAM may corrupt data.
333 * Should be reverted after this issue is root caused.
334 */
335 while (!(DMA_MMR_READ(&dst_ch->irq_status) & DMA_DONE))
336 continue;
337#endif
314} 338}
315 339
316void __init early_dma_memcpy_done(void) 340void __init early_dma_memcpy_done(void)
@@ -336,6 +360,42 @@ void __init early_dma_memcpy_done(void)
336 __builtin_bfin_ssync(); 360 __builtin_bfin_ssync();
337} 361}
338 362
363#ifdef CH_MEM_STREAM3_SRC
364#define bfin_read_MDMA_S_CONFIG bfin_read_MDMA_S3_CONFIG
365#define bfin_write_MDMA_S_CONFIG bfin_write_MDMA_S3_CONFIG
366#define bfin_write_MDMA_S_START_ADDR bfin_write_MDMA_S3_START_ADDR
367#define bfin_write_MDMA_S_IRQ_STATUS bfin_write_MDMA_S3_IRQ_STATUS
368#define bfin_write_MDMA_S_X_COUNT bfin_write_MDMA_S3_X_COUNT
369#define bfin_write_MDMA_S_X_MODIFY bfin_write_MDMA_S3_X_MODIFY
370#define bfin_write_MDMA_S_Y_COUNT bfin_write_MDMA_S3_Y_COUNT
371#define bfin_write_MDMA_S_Y_MODIFY bfin_write_MDMA_S3_Y_MODIFY
372#define bfin_write_MDMA_D_CONFIG bfin_write_MDMA_D3_CONFIG
373#define bfin_write_MDMA_D_START_ADDR bfin_write_MDMA_D3_START_ADDR
374#define bfin_read_MDMA_D_IRQ_STATUS bfin_read_MDMA_D3_IRQ_STATUS
375#define bfin_write_MDMA_D_IRQ_STATUS bfin_write_MDMA_D3_IRQ_STATUS
376#define bfin_write_MDMA_D_X_COUNT bfin_write_MDMA_D3_X_COUNT
377#define bfin_write_MDMA_D_X_MODIFY bfin_write_MDMA_D3_X_MODIFY
378#define bfin_write_MDMA_D_Y_COUNT bfin_write_MDMA_D3_Y_COUNT
379#define bfin_write_MDMA_D_Y_MODIFY bfin_write_MDMA_D3_Y_MODIFY
380#else
381#define bfin_read_MDMA_S_CONFIG bfin_read_MDMA_S0_CONFIG
382#define bfin_write_MDMA_S_CONFIG bfin_write_MDMA_S0_CONFIG
383#define bfin_write_MDMA_S_START_ADDR bfin_write_MDMA_S0_START_ADDR
384#define bfin_write_MDMA_S_IRQ_STATUS bfin_write_MDMA_S0_IRQ_STATUS
385#define bfin_write_MDMA_S_X_COUNT bfin_write_MDMA_S0_X_COUNT
386#define bfin_write_MDMA_S_X_MODIFY bfin_write_MDMA_S0_X_MODIFY
387#define bfin_write_MDMA_S_Y_COUNT bfin_write_MDMA_S0_Y_COUNT
388#define bfin_write_MDMA_S_Y_MODIFY bfin_write_MDMA_S0_Y_MODIFY
389#define bfin_write_MDMA_D_CONFIG bfin_write_MDMA_D0_CONFIG
390#define bfin_write_MDMA_D_START_ADDR bfin_write_MDMA_D0_START_ADDR
391#define bfin_read_MDMA_D_IRQ_STATUS bfin_read_MDMA_D0_IRQ_STATUS
392#define bfin_write_MDMA_D_IRQ_STATUS bfin_write_MDMA_D0_IRQ_STATUS
393#define bfin_write_MDMA_D_X_COUNT bfin_write_MDMA_D0_X_COUNT
394#define bfin_write_MDMA_D_X_MODIFY bfin_write_MDMA_D0_X_MODIFY
395#define bfin_write_MDMA_D_Y_COUNT bfin_write_MDMA_D0_Y_COUNT
396#define bfin_write_MDMA_D_Y_MODIFY bfin_write_MDMA_D0_Y_MODIFY
397#endif
398
339/** 399/**
340 * __dma_memcpy - program the MDMA registers 400 * __dma_memcpy - program the MDMA registers
341 * 401 *
@@ -358,8 +418,8 @@ static void __dma_memcpy(u32 daddr, s16 dmod, u32 saddr, s16 smod, size_t cnt, u
358 */ 418 */
359 __builtin_bfin_ssync(); 419 __builtin_bfin_ssync();
360 420
361 if (bfin_read_MDMA_S0_CONFIG()) 421 if (bfin_read_MDMA_S_CONFIG())
362 while (!(bfin_read_MDMA_D0_IRQ_STATUS() & DMA_DONE)) 422 while (!(bfin_read_MDMA_D_IRQ_STATUS() & DMA_DONE))
363 continue; 423 continue;
364 424
365 if (conf & DMA2D) { 425 if (conf & DMA2D) {
@@ -374,39 +434,42 @@ static void __dma_memcpy(u32 daddr, s16 dmod, u32 saddr, s16 smod, size_t cnt, u
374 u32 shift = abs(dmod) >> 1; 434 u32 shift = abs(dmod) >> 1;
375 size_t ycnt = cnt >> (16 - shift); 435 size_t ycnt = cnt >> (16 - shift);
376 cnt = 1 << (16 - shift); 436 cnt = 1 << (16 - shift);
377 bfin_write_MDMA_D0_Y_COUNT(ycnt); 437 bfin_write_MDMA_D_Y_COUNT(ycnt);
378 bfin_write_MDMA_S0_Y_COUNT(ycnt); 438 bfin_write_MDMA_S_Y_COUNT(ycnt);
379 bfin_write_MDMA_D0_Y_MODIFY(dmod); 439 bfin_write_MDMA_D_Y_MODIFY(dmod);
380 bfin_write_MDMA_S0_Y_MODIFY(smod); 440 bfin_write_MDMA_S_Y_MODIFY(smod);
381 } 441 }
382 442
383 bfin_write_MDMA_D0_START_ADDR(daddr); 443 bfin_write_MDMA_D_START_ADDR(daddr);
384 bfin_write_MDMA_D0_X_COUNT(cnt); 444 bfin_write_MDMA_D_X_COUNT(cnt);
385 bfin_write_MDMA_D0_X_MODIFY(dmod); 445 bfin_write_MDMA_D_X_MODIFY(dmod);
386 bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); 446 bfin_write_MDMA_D_IRQ_STATUS(DMA_DONE | DMA_ERR);
387 447
388 bfin_write_MDMA_S0_START_ADDR(saddr); 448 bfin_write_MDMA_S_START_ADDR(saddr);
389 bfin_write_MDMA_S0_X_COUNT(cnt); 449 bfin_write_MDMA_S_X_COUNT(cnt);
390 bfin_write_MDMA_S0_X_MODIFY(smod); 450 bfin_write_MDMA_S_X_MODIFY(smod);
391 bfin_write_MDMA_S0_IRQ_STATUS(DMA_DONE | DMA_ERR); 451 bfin_write_MDMA_S_IRQ_STATUS(DMA_DONE | DMA_ERR);
392 452
393 bfin_write_MDMA_S0_CONFIG(DMAEN | conf); 453 bfin_write_MDMA_S_CONFIG(DMAEN | conf);
394 bfin_write_MDMA_D0_CONFIG(WNR | DI_EN | DMAEN | conf); 454 if (conf & DMA2D)
455 bfin_write_MDMA_D_CONFIG(WNR | DI_EN_Y | DMAEN | conf);
456 else
457 bfin_write_MDMA_D_CONFIG(WNR | DI_EN_X | DMAEN | conf);
395 458
396 spin_unlock_irqrestore(&mdma_lock, flags); 459 spin_unlock_irqrestore(&mdma_lock, flags);
397 460
398 SSYNC(); 461 SSYNC();
399 462
400 while (!(bfin_read_MDMA_D0_IRQ_STATUS() & DMA_DONE)) 463 while (!(bfin_read_MDMA_D_IRQ_STATUS() & DMA_DONE))
401 if (bfin_read_MDMA_S0_CONFIG()) 464 if (bfin_read_MDMA_S_CONFIG())
402 continue; 465 continue;
403 else 466 else
404 return; 467 return;
405 468
406 bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); 469 bfin_write_MDMA_D_IRQ_STATUS(DMA_DONE | DMA_ERR);
407 470
408 bfin_write_MDMA_S0_CONFIG(0); 471 bfin_write_MDMA_S_CONFIG(0);
409 bfin_write_MDMA_D0_CONFIG(0); 472 bfin_write_MDMA_D_CONFIG(0);
410} 473}
411 474
412/** 475/**
@@ -448,8 +511,10 @@ static void *_dma_memcpy(void *pdst, const void *psrc, size_t size)
448 } 511 }
449 size >>= shift; 512 size >>= shift;
450 513
514#ifndef DMA_MMR_SIZE_32
451 if (size > 0x10000) 515 if (size > 0x10000)
452 conf |= DMA2D; 516 conf |= DMA2D;
517#endif
453 518
454 __dma_memcpy(dst, mod, src, mod, size, conf); 519 __dma_memcpy(dst, mod, src, mod, size, conf);
455 520
@@ -488,6 +553,9 @@ EXPORT_SYMBOL(dma_memcpy);
488 */ 553 */
489void *dma_memcpy_nocache(void *pdst, const void *psrc, size_t size) 554void *dma_memcpy_nocache(void *pdst, const void *psrc, size_t size)
490{ 555{
556#ifdef DMA_MMR_SIZE_32
557 _dma_memcpy(pdst, psrc, size);
558#else
491 size_t bulk, rest; 559 size_t bulk, rest;
492 560
493 bulk = size & ~0xffff; 561 bulk = size & ~0xffff;
@@ -495,6 +563,7 @@ void *dma_memcpy_nocache(void *pdst, const void *psrc, size_t size)
495 if (bulk) 563 if (bulk)
496 _dma_memcpy(pdst, psrc, bulk); 564 _dma_memcpy(pdst, psrc, bulk);
497 _dma_memcpy(pdst + bulk, psrc + bulk, rest); 565 _dma_memcpy(pdst + bulk, psrc + bulk, rest);
566#endif
498 return pdst; 567 return pdst;
499} 568}
500EXPORT_SYMBOL(dma_memcpy_nocache); 569EXPORT_SYMBOL(dma_memcpy_nocache);
@@ -514,14 +583,14 @@ void *safe_dma_memcpy(void *dst, const void *src, size_t size)
514} 583}
515EXPORT_SYMBOL(safe_dma_memcpy); 584EXPORT_SYMBOL(safe_dma_memcpy);
516 585
517static void _dma_out(unsigned long addr, unsigned long buf, unsigned short len, 586static void _dma_out(unsigned long addr, unsigned long buf, unsigned DMA_MMR_SIZE_TYPE len,
518 u16 size, u16 dma_size) 587 u16 size, u16 dma_size)
519{ 588{
520 blackfin_dcache_flush_range(buf, buf + len * size); 589 blackfin_dcache_flush_range(buf, buf + len * size);
521 __dma_memcpy(addr, 0, buf, size, len, dma_size); 590 __dma_memcpy(addr, 0, buf, size, len, dma_size);
522} 591}
523 592
524static void _dma_in(unsigned long addr, unsigned long buf, unsigned short len, 593static void _dma_in(unsigned long addr, unsigned long buf, unsigned DMA_MMR_SIZE_TYPE len,
525 u16 size, u16 dma_size) 594 u16 size, u16 dma_size)
526{ 595{
527 blackfin_dcache_invalidate_range(buf, buf + len * size); 596 blackfin_dcache_invalidate_range(buf, buf + len * size);
@@ -529,7 +598,7 @@ static void _dma_in(unsigned long addr, unsigned long buf, unsigned short len,
529} 598}
530 599
531#define MAKE_DMA_IO(io, bwl, isize, dmasize, cnst) \ 600#define MAKE_DMA_IO(io, bwl, isize, dmasize, cnst) \
532void dma_##io##s##bwl(unsigned long addr, cnst void *buf, unsigned short len) \ 601void dma_##io##s##bwl(unsigned long addr, cnst void *buf, unsigned DMA_MMR_SIZE_TYPE len) \
533{ \ 602{ \
534 _dma_##io(addr, (unsigned long)buf, len, isize, WDSIZE_##dmasize); \ 603 _dma_##io(addr, (unsigned long)buf, len, isize, WDSIZE_##dmasize); \
535} \ 604} \
diff --git a/arch/blackfin/kernel/bfin_gpio.c b/arch/blackfin/kernel/bfin_gpio.c
index 02796b88443d..c6e800998126 100644
--- a/arch/blackfin/kernel/bfin_gpio.c
+++ b/arch/blackfin/kernel/bfin_gpio.c
@@ -58,7 +58,7 @@ static struct gpio_port_t * const gpio_array[] = {
58 (struct gpio_port_t *) FIO0_FLAG_D, 58 (struct gpio_port_t *) FIO0_FLAG_D,
59 (struct gpio_port_t *) FIO1_FLAG_D, 59 (struct gpio_port_t *) FIO1_FLAG_D,
60 (struct gpio_port_t *) FIO2_FLAG_D, 60 (struct gpio_port_t *) FIO2_FLAG_D,
61#elif defined(CONFIG_BF54x) 61#elif defined(CONFIG_BF54x) || defined(CONFIG_BF60x)
62 (struct gpio_port_t *)PORTA_FER, 62 (struct gpio_port_t *)PORTA_FER,
63 (struct gpio_port_t *)PORTB_FER, 63 (struct gpio_port_t *)PORTB_FER,
64 (struct gpio_port_t *)PORTC_FER, 64 (struct gpio_port_t *)PORTC_FER,
@@ -66,6 +66,7 @@ static struct gpio_port_t * const gpio_array[] = {
66 (struct gpio_port_t *)PORTE_FER, 66 (struct gpio_port_t *)PORTE_FER,
67 (struct gpio_port_t *)PORTF_FER, 67 (struct gpio_port_t *)PORTF_FER,
68 (struct gpio_port_t *)PORTG_FER, 68 (struct gpio_port_t *)PORTG_FER,
69#elif defined(CONFIG_BF54x)
69 (struct gpio_port_t *)PORTH_FER, 70 (struct gpio_port_t *)PORTH_FER,
70 (struct gpio_port_t *)PORTI_FER, 71 (struct gpio_port_t *)PORTI_FER,
71 (struct gpio_port_t *)PORTJ_FER, 72 (struct gpio_port_t *)PORTJ_FER,
@@ -210,7 +211,7 @@ static void port_setup(unsigned gpio, unsigned short usage)
210 else 211 else
211 *port_fer[gpio_bank(gpio)] |= gpio_bit(gpio); 212 *port_fer[gpio_bank(gpio)] |= gpio_bit(gpio);
212 SSYNC(); 213 SSYNC();
213#elif defined(CONFIG_BF54x) 214#elif defined(CONFIG_BF54x) || defined(CONFIG_BF60x)
214 if (usage == GPIO_USAGE) 215 if (usage == GPIO_USAGE)
215 gpio_array[gpio_bank(gpio)]->port_fer &= ~gpio_bit(gpio); 216 gpio_array[gpio_bank(gpio)]->port_fer &= ~gpio_bit(gpio);
216 else 217 else
@@ -299,7 +300,7 @@ static void portmux_setup(unsigned short per)
299 pmux |= (function << offset); 300 pmux |= (function << offset);
300 bfin_write_PORT_MUX(pmux); 301 bfin_write_PORT_MUX(pmux);
301} 302}
302#elif defined(CONFIG_BF54x) 303#elif defined(CONFIG_BF54x) || defined(CONFIG_BF60x)
303inline void portmux_setup(unsigned short per) 304inline void portmux_setup(unsigned short per)
304{ 305{
305 u16 ident = P_IDENT(per); 306 u16 ident = P_IDENT(per);
@@ -377,7 +378,7 @@ static int portmux_group_check(unsigned short per)
377} 378}
378#endif 379#endif
379 380
380#ifndef CONFIG_BF54x 381#if !(defined(CONFIG_BF54x) || defined(CONFIG_BF60x))
381/*********************************************************** 382/***********************************************************
382* 383*
383* FUNCTIONS: Blackfin General Purpose Ports Access Functions 384* FUNCTIONS: Blackfin General Purpose Ports Access Functions
@@ -680,7 +681,7 @@ void bfin_gpio_pm_hibernate_restore(void)
680 681
681 682
682#endif 683#endif
683#else /* CONFIG_BF54x */ 684#else /* CONFIG_BF54x || CONFIG_BF60x */
684#ifdef CONFIG_PM 685#ifdef CONFIG_PM
685 686
686int bfin_pm_standby_ctrl(unsigned ctrl) 687int bfin_pm_standby_ctrl(unsigned ctrl)
@@ -726,7 +727,7 @@ unsigned short get_gpio_dir(unsigned gpio)
726} 727}
727EXPORT_SYMBOL(get_gpio_dir); 728EXPORT_SYMBOL(get_gpio_dir);
728 729
729#endif /* CONFIG_BF54x */ 730#endif /* CONFIG_BF54x || CONFIG_BF60x */
730 731
731/*********************************************************** 732/***********************************************************
732* 733*
@@ -783,7 +784,7 @@ int peripheral_request(unsigned short per, const char *label)
783 * be requested and used by several drivers 784 * be requested and used by several drivers
784 */ 785 */
785 786
786#ifdef CONFIG_BF54x 787#if defined(CONFIG_BF54x) || defined(CONFIG_BF60x)
787 if (!((per & P_MAYSHARE) && get_portmux(per) == P_FUNCT2MUX(per))) { 788 if (!((per & P_MAYSHARE) && get_portmux(per) == P_FUNCT2MUX(per))) {
788#else 789#else
789 if (!(per & P_MAYSHARE)) { 790 if (!(per & P_MAYSHARE)) {
@@ -937,7 +938,7 @@ int bfin_gpio_request(unsigned gpio, const char *label)
937 printk(KERN_NOTICE "bfin-gpio: GPIO %d is already reserved as gpio-irq!" 938 printk(KERN_NOTICE "bfin-gpio: GPIO %d is already reserved as gpio-irq!"
938 " (Documentation/blackfin/bfin-gpio-notes.txt)\n", gpio); 939 " (Documentation/blackfin/bfin-gpio-notes.txt)\n", gpio);
939 } 940 }
940#ifndef CONFIG_BF54x 941#if !(defined(CONFIG_BF54x) || defined(CONFIG_BF60x))
941 else { /* Reset POLAR setting when acquiring a gpio for the first time */ 942 else { /* Reset POLAR setting when acquiring a gpio for the first time */
942 set_gpio_polar(gpio, 0); 943 set_gpio_polar(gpio, 0);
943 } 944 }
@@ -1110,7 +1111,7 @@ void bfin_gpio_irq_free(unsigned gpio)
1110 1111
1111static inline void __bfin_gpio_direction_input(unsigned gpio) 1112static inline void __bfin_gpio_direction_input(unsigned gpio)
1112{ 1113{
1113#ifdef CONFIG_BF54x 1114#if defined(CONFIG_BF54x) || defined(CONFIG_BF60x)
1114 gpio_array[gpio_bank(gpio)]->dir_clear = gpio_bit(gpio); 1115 gpio_array[gpio_bank(gpio)]->dir_clear = gpio_bit(gpio);
1115#else 1116#else
1116 gpio_array[gpio_bank(gpio)]->dir &= ~gpio_bit(gpio); 1117 gpio_array[gpio_bank(gpio)]->dir &= ~gpio_bit(gpio);
@@ -1138,13 +1139,13 @@ EXPORT_SYMBOL(bfin_gpio_direction_input);
1138 1139
1139void bfin_gpio_irq_prepare(unsigned gpio) 1140void bfin_gpio_irq_prepare(unsigned gpio)
1140{ 1141{
1141#ifdef CONFIG_BF54x 1142#if defined(CONFIG_BF54x) || defined(CONFIG_BF60x)
1142 unsigned long flags; 1143 unsigned long flags;
1143#endif 1144#endif
1144 1145
1145 port_setup(gpio, GPIO_USAGE); 1146 port_setup(gpio, GPIO_USAGE);
1146 1147
1147#ifdef CONFIG_BF54x 1148#if defined(CONFIG_BF54x) || defined(CONFIG_BF60x)
1148 flags = hard_local_irq_save(); 1149 flags = hard_local_irq_save();
1149 __bfin_gpio_direction_input(gpio); 1150 __bfin_gpio_direction_input(gpio);
1150 hard_local_irq_restore(flags); 1151 hard_local_irq_restore(flags);
@@ -1173,7 +1174,7 @@ int bfin_gpio_direction_output(unsigned gpio, int value)
1173 1174
1174 gpio_array[gpio_bank(gpio)]->inen &= ~gpio_bit(gpio); 1175 gpio_array[gpio_bank(gpio)]->inen &= ~gpio_bit(gpio);
1175 gpio_set_value(gpio, value); 1176 gpio_set_value(gpio, value);
1176#ifdef CONFIG_BF54x 1177#if defined(CONFIG_BF54x) || defined(CONFIG_BF60x)
1177 gpio_array[gpio_bank(gpio)]->dir_set = gpio_bit(gpio); 1178 gpio_array[gpio_bank(gpio)]->dir_set = gpio_bit(gpio);
1178#else 1179#else
1179 gpio_array[gpio_bank(gpio)]->dir |= gpio_bit(gpio); 1180 gpio_array[gpio_bank(gpio)]->dir |= gpio_bit(gpio);
@@ -1188,7 +1189,7 @@ EXPORT_SYMBOL(bfin_gpio_direction_output);
1188 1189
1189int bfin_gpio_get_value(unsigned gpio) 1190int bfin_gpio_get_value(unsigned gpio)
1190{ 1191{
1191#ifdef CONFIG_BF54x 1192#if defined(CONFIG_BF54x) || defined(CONFIG_BF60x)
1192 return (1 & (gpio_array[gpio_bank(gpio)]->data >> gpio_sub_n(gpio))); 1193 return (1 & (gpio_array[gpio_bank(gpio)]->data >> gpio_sub_n(gpio)));
1193#else 1194#else
1194 unsigned long flags; 1195 unsigned long flags;
diff --git a/arch/blackfin/kernel/debug-mmrs.c b/arch/blackfin/kernel/debug-mmrs.c
index 92f664826281..01232a13470d 100644
--- a/arch/blackfin/kernel/debug-mmrs.c
+++ b/arch/blackfin/kernel/debug-mmrs.c
@@ -105,6 +105,7 @@ DEFINE_SYSREG(seqstat, , );
105DEFINE_SYSREG(syscfg, , CSYNC()); 105DEFINE_SYSREG(syscfg, , CSYNC());
106#define D_SYSREG(sr) debugfs_create_file(#sr, S_IRUSR|S_IWUSR, parent, NULL, &fops_sysreg_##sr) 106#define D_SYSREG(sr) debugfs_create_file(#sr, S_IRUSR|S_IWUSR, parent, NULL, &fops_sysreg_##sr)
107 107
108#ifndef CONFIG_BF60x
108/* 109/*
109 * CAN 110 * CAN
110 */ 111 */
@@ -223,8 +224,10 @@ bfin_debug_mmrs_dma(struct dentry *parent, unsigned long base, int num, char mdm
223 __DMA(CURR_DESC_PTR, curr_desc_ptr); 224 __DMA(CURR_DESC_PTR, curr_desc_ptr);
224 __DMA(CURR_ADDR, curr_addr); 225 __DMA(CURR_ADDR, curr_addr);
225 __DMA(IRQ_STATUS, irq_status); 226 __DMA(IRQ_STATUS, irq_status);
227#ifndef CONFIG_BF60x
226 if (strcmp(pfx, "IMDMA") != 0) 228 if (strcmp(pfx, "IMDMA") != 0)
227 __DMA(PERIPHERAL_MAP, peripheral_map); 229 __DMA(PERIPHERAL_MAP, peripheral_map);
230#endif
228 __DMA(CURR_X_COUNT, curr_x_count); 231 __DMA(CURR_X_COUNT, curr_x_count);
229 __DMA(CURR_Y_COUNT, curr_y_count); 232 __DMA(CURR_Y_COUNT, curr_y_count);
230} 233}
@@ -568,7 +571,7 @@ bfin_debug_mmrs_uart(struct dentry *parent, unsigned long base, int num)
568#endif 571#endif
569} 572}
570#define UART(num) bfin_debug_mmrs_uart(parent, UART##num##_DLL, num) 573#define UART(num) bfin_debug_mmrs_uart(parent, UART##num##_DLL, num)
571 574#endif /* CONFIG_BF60x */
572/* 575/*
573 * The actual debugfs generation 576 * The actual debugfs generation
574 */ 577 */
@@ -740,7 +743,7 @@ static int __init bfin_debug_mmrs_init(void)
740 D32(WPDACNT0); 743 D32(WPDACNT0);
741 D32(WPDACNT1); 744 D32(WPDACNT1);
742 D32(WPSTAT); 745 D32(WPSTAT);
743 746#ifndef CONFIG_BF60x
744 /* System MMRs */ 747 /* System MMRs */
745#ifdef ATAPI_CONTROL 748#ifdef ATAPI_CONTROL
746 parent = debugfs_create_dir("atapi", top); 749 parent = debugfs_create_dir("atapi", top);
@@ -1873,7 +1876,7 @@ static int __init bfin_debug_mmrs_init(void)
1873 1876
1874 } 1877 }
1875#endif /* BF54x */ 1878#endif /* BF54x */
1876 1879#endif /* CONFIG_BF60x */
1877 debug_mmrs_dentry = top; 1880 debug_mmrs_dentry = top;
1878 1881
1879 return 0; 1882 return 0;
diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
index c0f4fe287eb6..2e3994b20169 100644
--- a/arch/blackfin/kernel/process.c
+++ b/arch/blackfin/kernel/process.c
@@ -95,7 +95,9 @@ void cpu_idle(void)
95 idle(); 95 idle();
96 rcu_idle_exit(); 96 rcu_idle_exit();
97 tick_nohz_idle_exit(); 97 tick_nohz_idle_exit();
98 schedule_preempt_disabled(); 98 preempt_enable_no_resched();
99 schedule();
100 preempt_disable();
99 } 101 }
100} 102}
101 103
@@ -329,12 +331,16 @@ int in_mem_const(unsigned long addr, unsigned long size,
329{ 331{
330 return in_mem_const_off(addr, size, 0, const_addr, const_size); 332 return in_mem_const_off(addr, size, 0, const_addr, const_size);
331} 333}
334#ifdef CONFIG_BF60x
335#define ASYNC_ENABLED(bnum, bctlnum) 1
336#else
332#define ASYNC_ENABLED(bnum, bctlnum) \ 337#define ASYNC_ENABLED(bnum, bctlnum) \
333({ \ 338({ \
334 (bfin_read_EBIU_AMGCTL() & 0xe) < ((bnum + 1) << 1) ? 0 : \ 339 (bfin_read_EBIU_AMGCTL() & 0xe) < ((bnum + 1) << 1) ? 0 : \
335 bfin_read_EBIU_AMBCTL##bctlnum() & B##bnum##RDYEN ? 0 : \ 340 bfin_read_EBIU_AMBCTL##bctlnum() & B##bnum##RDYEN ? 0 : \
336 1; \ 341 1; \
337}) 342})
343#endif
338/* 344/*
339 * We can't read EBIU banks that aren't enabled or we end up hanging 345 * We can't read EBIU banks that aren't enabled or we end up hanging
340 * on the access to the async space. Make sure we validate accesses 346 * on the access to the async space. Make sure we validate accesses
diff --git a/arch/blackfin/kernel/reboot.c b/arch/blackfin/kernel/reboot.c
index b0434f89e8de..5272e6eefd92 100644
--- a/arch/blackfin/kernel/reboot.c
+++ b/arch/blackfin/kernel/reboot.c
@@ -22,6 +22,7 @@
22__attribute__ ((__l1_text__, __noreturn__)) 22__attribute__ ((__l1_text__, __noreturn__))
23static void bfin_reset(void) 23static void bfin_reset(void)
24{ 24{
25#ifndef CONFIG_BF60x
25 if (!ANOMALY_05000353 && !ANOMALY_05000386) 26 if (!ANOMALY_05000353 && !ANOMALY_05000386)
26 bfrom_SoftReset((void *)(L1_SCRATCH_START + L1_SCRATCH_LENGTH - 20)); 27 bfrom_SoftReset((void *)(L1_SCRATCH_START + L1_SCRATCH_LENGTH - 20));
27 28
@@ -57,7 +58,6 @@ static void bfin_reset(void)
57 if (__SILICON_REVISION__ < 1 && bfin_revid() < 1) 58 if (__SILICON_REVISION__ < 1 && bfin_revid() < 1)
58 bfin_read_SWRST(); 59 bfin_read_SWRST();
59#endif 60#endif
60
61 /* Wait for the SWRST write to complete. Cannot rely on SSYNC 61 /* Wait for the SWRST write to complete. Cannot rely on SSYNC
62 * though as the System state is all reset now. 62 * though as the System state is all reset now.
63 */ 63 */
@@ -72,6 +72,10 @@ static void bfin_reset(void)
72 while (1) 72 while (1)
73 /* Issue core reset */ 73 /* Issue core reset */
74 asm("raise 1"); 74 asm("raise 1");
75#else
76 while (1)
77 bfin_write_RCU0_CTL(0x1);
78#endif
75} 79}
76 80
77__attribute__((weak)) 81__attribute__((weak))
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index 2ad747e909fb..c113cfa459a7 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -25,6 +25,7 @@
25#include <asm/cacheflush.h> 25#include <asm/cacheflush.h>
26#include <asm/blackfin.h> 26#include <asm/blackfin.h>
27#include <asm/cplbinit.h> 27#include <asm/cplbinit.h>
28#include <asm/clocks.h>
28#include <asm/div64.h> 29#include <asm/div64.h>
29#include <asm/cpu.h> 30#include <asm/cpu.h>
30#include <asm/fixed_code.h> 31#include <asm/fixed_code.h>
@@ -550,7 +551,6 @@ static __init void memory_setup(void)
550{ 551{
551#ifdef CONFIG_MTD_UCLINUX 552#ifdef CONFIG_MTD_UCLINUX
552 unsigned long mtd_phys = 0; 553 unsigned long mtd_phys = 0;
553 unsigned long n;
554#endif 554#endif
555 unsigned long max_mem; 555 unsigned long max_mem;
556 556
@@ -594,9 +594,9 @@ static __init void memory_setup(void)
594 mtd_size = PAGE_ALIGN(*((unsigned long *)(mtd_phys + 8))); 594 mtd_size = PAGE_ALIGN(*((unsigned long *)(mtd_phys + 8)));
595 595
596# if defined(CONFIG_EXT2_FS) || defined(CONFIG_EXT3_FS) 596# if defined(CONFIG_EXT2_FS) || defined(CONFIG_EXT3_FS)
597 n = ext2_image_size((void *)(mtd_phys + 0x400)); 597 if (*((unsigned short *)(mtd_phys + 0x438)) == EXT2_SUPER_MAGIC)
598 if (n) 598 mtd_size =
599 mtd_size = PAGE_ALIGN(n * 1024); 599 PAGE_ALIGN(*((unsigned long *)(mtd_phys + 0x404)) << 10);
600# endif 600# endif
601 601
602# if defined(CONFIG_CRAMFS) 602# if defined(CONFIG_CRAMFS)
@@ -612,7 +612,8 @@ static __init void memory_setup(void)
612 612
613 /* ROM_FS is XIP, so if we found it, we need to limit memory */ 613 /* ROM_FS is XIP, so if we found it, we need to limit memory */
614 if (memory_end > max_mem) { 614 if (memory_end > max_mem) {
615 pr_info("Limiting kernel memory to %liMB due to anomaly 05000263\n", max_mem >> 20); 615 pr_info("Limiting kernel memory to %liMB due to anomaly 05000263\n",
616 (max_mem - CONFIG_PHY_RAM_BASE_ADDRESS) >> 20);
616 memory_end = max_mem; 617 memory_end = max_mem;
617 } 618 }
618 } 619 }
@@ -642,7 +643,8 @@ static __init void memory_setup(void)
642 * doesn't exist, or we don't need to - then dont. 643 * doesn't exist, or we don't need to - then dont.
643 */ 644 */
644 if (memory_end > max_mem) { 645 if (memory_end > max_mem) {
645 pr_info("Limiting kernel memory to %liMB due to anomaly 05000263\n", max_mem >> 20); 646 pr_info("Limiting kernel memory to %liMB due to anomaly 05000263\n",
647 (max_mem - CONFIG_PHY_RAM_BASE_ADDRESS) >> 20);
646 memory_end = max_mem; 648 memory_end = max_mem;
647 } 649 }
648 650
@@ -661,8 +663,8 @@ static __init void memory_setup(void)
661 init_mm.end_data = (unsigned long)_edata; 663 init_mm.end_data = (unsigned long)_edata;
662 init_mm.brk = (unsigned long)0; 664 init_mm.brk = (unsigned long)0;
663 665
664 printk(KERN_INFO "Board Memory: %ldMB\n", physical_mem_end >> 20); 666 printk(KERN_INFO "Board Memory: %ldMB\n", (physical_mem_end - CONFIG_PHY_RAM_BASE_ADDRESS) >> 20);
665 printk(KERN_INFO "Kernel Managed Memory: %ldMB\n", _ramend >> 20); 667 printk(KERN_INFO "Kernel Managed Memory: %ldMB\n", (_ramend - CONFIG_PHY_RAM_BASE_ADDRESS) >> 20);
666 668
667 printk(KERN_INFO "Memory map:\n" 669 printk(KERN_INFO "Memory map:\n"
668 " fixedcode = 0x%p-0x%p\n" 670 " fixedcode = 0x%p-0x%p\n"
@@ -705,7 +707,7 @@ void __init find_min_max_pfn(void)
705 int i; 707 int i;
706 708
707 max_pfn = 0; 709 max_pfn = 0;
708 min_low_pfn = memory_end; 710 min_low_pfn = PFN_DOWN(memory_end);
709 711
710 for (i = 0; i < bfin_memmap.nr_map; i++) { 712 for (i = 0; i < bfin_memmap.nr_map; i++) {
711 unsigned long start, end; 713 unsigned long start, end;
@@ -748,8 +750,7 @@ static __init void setup_bootmem_allocator(void)
748 /* pfn of the first usable page frame after kernel image*/ 750 /* pfn of the first usable page frame after kernel image*/
749 if (min_low_pfn < memory_start >> PAGE_SHIFT) 751 if (min_low_pfn < memory_start >> PAGE_SHIFT)
750 min_low_pfn = memory_start >> PAGE_SHIFT; 752 min_low_pfn = memory_start >> PAGE_SHIFT;
751 753 start_pfn = CONFIG_PHY_RAM_BASE_ADDRESS >> PAGE_SHIFT;
752 start_pfn = PAGE_OFFSET >> PAGE_SHIFT;
753 end_pfn = memory_end >> PAGE_SHIFT; 754 end_pfn = memory_end >> PAGE_SHIFT;
754 755
755 /* 756 /*
@@ -794,8 +795,8 @@ static __init void setup_bootmem_allocator(void)
794 } 795 }
795 796
796 /* reserve memory before memory_start, including bootmap */ 797 /* reserve memory before memory_start, including bootmap */
797 reserve_bootmem(PAGE_OFFSET, 798 reserve_bootmem(CONFIG_PHY_RAM_BASE_ADDRESS,
798 memory_start + bootmap_size + PAGE_SIZE - 1 - PAGE_OFFSET, 799 memory_start + bootmap_size + PAGE_SIZE - 1 - CONFIG_PHY_RAM_BASE_ADDRESS,
799 BOOTMEM_DEFAULT); 800 BOOTMEM_DEFAULT);
800} 801}
801 802
@@ -844,13 +845,40 @@ static inline int __init get_mem_size(void)
844 break; 845 break;
845 } 846 }
846 switch (ddrctl & 0x30000) { 847 switch (ddrctl & 0x30000) {
847 case DEVWD_4: ret *= 2; 848 case DEVWD_4:
848 case DEVWD_8: ret *= 2; 849 ret *= 2;
849 case DEVWD_16: break; 850 case DEVWD_8:
851 ret *= 2;
852 case DEVWD_16:
853 break;
850 } 854 }
851 if ((ddrctl & 0xc000) == 0x4000) 855 if ((ddrctl & 0xc000) == 0x4000)
852 ret *= 2; 856 ret *= 2;
853 return ret; 857 return ret;
858#elif defined(CONFIG_BF60x)
859 u32 ddrctl = bfin_read_DDR0_CFG();
860 int ret;
861 switch (ddrctl & 0xf00) {
862 case DEVSZ_64:
863 ret = 64 / 8;
864 break;
865 case DEVSZ_128:
866 ret = 128 / 8;
867 break;
868 case DEVSZ_256:
869 ret = 256 / 8;
870 break;
871 case DEVSZ_512:
872 ret = 512 / 8;
873 break;
874 case DEVSZ_1G:
875 ret = 1024 / 8;
876 break;
877 case DEVSZ_2G:
878 ret = 2048 / 8;
879 break;
880 }
881 return ret;
854#endif 882#endif
855 BUG(); 883 BUG();
856} 884}
@@ -864,12 +892,14 @@ void __init setup_arch(char **cmdline_p)
864{ 892{
865 u32 mmr; 893 u32 mmr;
866 unsigned long sclk, cclk; 894 unsigned long sclk, cclk;
895 struct clk *clk;
867 896
868 native_machine_early_platform_add_devices(); 897 native_machine_early_platform_add_devices();
869 898
870 enable_shadow_console(); 899 enable_shadow_console();
871 900
872 /* Check to make sure we are running on the right processor */ 901 /* Check to make sure we are running on the right processor */
902 mmr = bfin_cpuid();
873 if (unlikely(CPUID != bfin_cpuid())) 903 if (unlikely(CPUID != bfin_cpuid()))
874 printk(KERN_ERR "ERROR: Not running on ADSP-%s: unknown CPUID 0x%04x Rev 0.%d\n", 904 printk(KERN_ERR "ERROR: Not running on ADSP-%s: unknown CPUID 0x%04x Rev 0.%d\n",
875 CPU, bfin_cpuid(), bfin_revid()); 905 CPU, bfin_cpuid(), bfin_revid());
@@ -890,6 +920,10 @@ void __init setup_arch(char **cmdline_p)
890 920
891 memset(&bfin_memmap, 0, sizeof(bfin_memmap)); 921 memset(&bfin_memmap, 0, sizeof(bfin_memmap));
892 922
923#ifdef CONFIG_BF60x
924 /* Should init clock device before parse command early */
925 clk_init();
926#endif
893 /* If the user does not specify things on the command line, use 927 /* If the user does not specify things on the command line, use
894 * what the bootloader set things up as 928 * what the bootloader set things up as
895 */ 929 */
@@ -904,6 +938,7 @@ void __init setup_arch(char **cmdline_p)
904 938
905 memory_setup(); 939 memory_setup();
906 940
941#ifndef CONFIG_BF60x
907 /* Initialize Async memory banks */ 942 /* Initialize Async memory banks */
908 bfin_write_EBIU_AMBCTL0(AMBCTL0VAL); 943 bfin_write_EBIU_AMBCTL0(AMBCTL0VAL);
909 bfin_write_EBIU_AMBCTL1(AMBCTL1VAL); 944 bfin_write_EBIU_AMBCTL1(AMBCTL1VAL);
@@ -913,6 +948,7 @@ void __init setup_arch(char **cmdline_p)
913 bfin_write_EBIU_MODE(CONFIG_EBIU_MODEVAL); 948 bfin_write_EBIU_MODE(CONFIG_EBIU_MODEVAL);
914 bfin_write_EBIU_FCTL(CONFIG_EBIU_FCTLVAL); 949 bfin_write_EBIU_FCTL(CONFIG_EBIU_FCTLVAL);
915#endif 950#endif
951#endif
916#ifdef CONFIG_BFIN_HYSTERESIS_CONTROL 952#ifdef CONFIG_BFIN_HYSTERESIS_CONTROL
917 bfin_write_PORTF_HYSTERESIS(HYST_PORTF_0_15); 953 bfin_write_PORTF_HYSTERESIS(HYST_PORTF_0_15);
918 bfin_write_PORTG_HYSTERESIS(HYST_PORTG_0_15); 954 bfin_write_PORTG_HYSTERESIS(HYST_PORTG_0_15);
@@ -921,8 +957,24 @@ void __init setup_arch(char **cmdline_p)
921 ~HYST_NONEGPIO_MASK) | HYST_NONEGPIO); 957 ~HYST_NONEGPIO_MASK) | HYST_NONEGPIO);
922#endif 958#endif
923 959
960#ifdef CONFIG_BF60x
961 clk = clk_get(NULL, "CCLK");
962 if (!IS_ERR(clk)) {
963 cclk = clk_get_rate(clk);
964 clk_put(clk);
965 } else
966 cclk = 0;
967
968 clk = clk_get(NULL, "SCLK0");
969 if (!IS_ERR(clk)) {
970 sclk = clk_get_rate(clk);
971 clk_put(clk);
972 } else
973 sclk = 0;
974#else
924 cclk = get_cclk(); 975 cclk = get_cclk();
925 sclk = get_sclk(); 976 sclk = get_sclk();
977#endif
926 978
927 if ((ANOMALY_05000273 || ANOMALY_05000274) && (cclk >> 1) < sclk) 979 if ((ANOMALY_05000273 || ANOMALY_05000274) && (cclk >> 1) < sclk)
928 panic("ANOMALY 05000273 or 05000274: CCLK must be >= 2*SCLK"); 980 panic("ANOMALY 05000273 or 05000274: CCLK must be >= 2*SCLK");
@@ -938,7 +990,7 @@ void __init setup_arch(char **cmdline_p)
938 printk(KERN_INFO "Hardware Trace %s and %sabled\n", 990 printk(KERN_INFO "Hardware Trace %s and %sabled\n",
939 (mmr & 0x1) ? "active" : "off", 991 (mmr & 0x1) ? "active" : "off",
940 (mmr & 0x2) ? "en" : "dis"); 992 (mmr & 0x2) ? "en" : "dis");
941 993#ifndef CONFIG_BF60x
942 mmr = bfin_read_SYSCR(); 994 mmr = bfin_read_SYSCR();
943 printk(KERN_INFO "Boot Mode: %i\n", mmr & 0xF); 995 printk(KERN_INFO "Boot Mode: %i\n", mmr & 0xF);
944 996
@@ -980,7 +1032,7 @@ void __init setup_arch(char **cmdline_p)
980 printk(KERN_INFO "Recovering from Watchdog event\n"); 1032 printk(KERN_INFO "Recovering from Watchdog event\n");
981 else if (_bfin_swrst & RESET_SOFTWARE) 1033 else if (_bfin_swrst & RESET_SOFTWARE)
982 printk(KERN_NOTICE "Reset caused by Software reset\n"); 1034 printk(KERN_NOTICE "Reset caused by Software reset\n");
983 1035#endif
984 printk(KERN_INFO "Blackfin support (C) 2004-2010 Analog Devices, Inc.\n"); 1036 printk(KERN_INFO "Blackfin support (C) 2004-2010 Analog Devices, Inc.\n");
985 if (bfin_compiled_revid() == 0xffff) 1037 if (bfin_compiled_revid() == 0xffff)
986 printk(KERN_INFO "Compiled for ADSP-%s Rev any, running on 0.%d\n", CPU, bfin_revid()); 1038 printk(KERN_INFO "Compiled for ADSP-%s Rev any, running on 0.%d\n", CPU, bfin_revid());
@@ -1060,10 +1112,12 @@ subsys_initcall(topology_init);
1060 1112
1061/* Get the input clock frequency */ 1113/* Get the input clock frequency */
1062static u_long cached_clkin_hz = CONFIG_CLKIN_HZ; 1114static u_long cached_clkin_hz = CONFIG_CLKIN_HZ;
1115#ifndef CONFIG_BF60x
1063static u_long get_clkin_hz(void) 1116static u_long get_clkin_hz(void)
1064{ 1117{
1065 return cached_clkin_hz; 1118 return cached_clkin_hz;
1066} 1119}
1120#endif
1067static int __init early_init_clkin_hz(char *buf) 1121static int __init early_init_clkin_hz(char *buf)
1068{ 1122{
1069 cached_clkin_hz = simple_strtoul(buf, NULL, 0); 1123 cached_clkin_hz = simple_strtoul(buf, NULL, 0);
@@ -1075,6 +1129,7 @@ static int __init early_init_clkin_hz(char *buf)
1075} 1129}
1076early_param("clkin_hz=", early_init_clkin_hz); 1130early_param("clkin_hz=", early_init_clkin_hz);
1077 1131
1132#ifndef CONFIG_BF60x
1078/* Get the voltage input multiplier */ 1133/* Get the voltage input multiplier */
1079static u_long get_vco(void) 1134static u_long get_vco(void)
1080{ 1135{
@@ -1097,10 +1152,23 @@ static u_long get_vco(void)
1097 cached_vco *= msel; 1152 cached_vco *= msel;
1098 return cached_vco; 1153 return cached_vco;
1099} 1154}
1155#endif
1100 1156
1101/* Get the Core clock */ 1157/* Get the Core clock */
1102u_long get_cclk(void) 1158u_long get_cclk(void)
1103{ 1159{
1160#ifdef CONFIG_BF60x
1161 struct clk *cclk;
1162 u_long cclk_rate;
1163
1164 cclk = clk_get(NULL, "CCLK");
1165 if (IS_ERR(cclk))
1166 return 0;
1167
1168 cclk_rate = clk_get_rate(cclk);
1169 clk_put(cclk);
1170 return cclk_rate;
1171#else
1104 static u_long cached_cclk_pll_div, cached_cclk; 1172 static u_long cached_cclk_pll_div, cached_cclk;
1105 u_long csel, ssel; 1173 u_long csel, ssel;
1106 1174
@@ -1120,12 +1188,66 @@ u_long get_cclk(void)
1120 else 1188 else
1121 cached_cclk = get_vco() >> csel; 1189 cached_cclk = get_vco() >> csel;
1122 return cached_cclk; 1190 return cached_cclk;
1191#endif
1123} 1192}
1124EXPORT_SYMBOL(get_cclk); 1193EXPORT_SYMBOL(get_cclk);
1125 1194
1195#ifdef CONFIG_BF60x
1196/* Get the bf60x clock of SCLK0 domain */
1197u_long get_sclk0(void)
1198{
1199 struct clk *sclk0;
1200 u_long sclk0_rate;
1201
1202 sclk0 = clk_get(NULL, "SCLK0");
1203 if (IS_ERR(sclk0))
1204 return 0;
1205
1206 sclk0_rate = clk_get_rate(sclk0);
1207 clk_put(sclk0);
1208 return sclk0_rate;
1209}
1210EXPORT_SYMBOL(get_sclk0);
1211
1212/* Get the bf60x clock of SCLK1 domain */
1213u_long get_sclk1(void)
1214{
1215 struct clk *sclk1;
1216 u_long sclk1_rate;
1217
1218 sclk1 = clk_get(NULL, "SCLK1");
1219 if (IS_ERR(sclk1))
1220 return 0;
1221
1222 sclk1_rate = clk_get_rate(sclk1);
1223 clk_put(sclk1);
1224 return sclk1_rate;
1225}
1226EXPORT_SYMBOL(get_sclk1);
1227
1228/* Get the bf60x DRAM clock */
1229u_long get_dclk(void)
1230{
1231 struct clk *dclk;
1232 u_long dclk_rate;
1233
1234 dclk = clk_get(NULL, "DCLK");
1235 if (IS_ERR(dclk))
1236 return 0;
1237
1238 dclk_rate = clk_get_rate(dclk);
1239 clk_put(dclk);
1240 return dclk_rate;
1241}
1242EXPORT_SYMBOL(get_dclk);
1243#endif
1244
1126/* Get the System clock */ 1245/* Get the System clock */
1127u_long get_sclk(void) 1246u_long get_sclk(void)
1128{ 1247{
1248#ifdef CONFIG_BF60x
1249 return get_sclk0();
1250#else
1129 static u_long cached_sclk; 1251 static u_long cached_sclk;
1130 u_long ssel; 1252 u_long ssel;
1131 1253
@@ -1146,6 +1268,7 @@ u_long get_sclk(void)
1146 1268
1147 cached_sclk = get_vco() / ssel; 1269 cached_sclk = get_vco() / ssel;
1148 return cached_sclk; 1270 return cached_sclk;
1271#endif
1149} 1272}
1150EXPORT_SYMBOL(get_sclk); 1273EXPORT_SYMBOL(get_sclk);
1151 1274
diff --git a/arch/blackfin/kernel/shadow_console.c b/arch/blackfin/kernel/shadow_console.c
index 557e9fef406a..aeb8343eeb03 100644
--- a/arch/blackfin/kernel/shadow_console.c
+++ b/arch/blackfin/kernel/shadow_console.c
@@ -15,9 +15,9 @@
15#include <asm/irq_handler.h> 15#include <asm/irq_handler.h>
16#include <asm/early_printk.h> 16#include <asm/early_printk.h>
17 17
18#define SHADOW_CONSOLE_START (0x500) 18#define SHADOW_CONSOLE_START (CONFIG_PHY_RAM_BASE_ADDRESS + 0x500)
19#define SHADOW_CONSOLE_END (0x1000) 19#define SHADOW_CONSOLE_END (CONFIG_PHY_RAM_BASE_ADDRESS + 0x1000)
20#define SHADOW_CONSOLE_MAGIC_LOC (0x4F0) 20#define SHADOW_CONSOLE_MAGIC_LOC (CONFIG_PHY_RAM_BASE_ADDRESS + 0x4F0)
21#define SHADOW_CONSOLE_MAGIC (0xDEADBEEF) 21#define SHADOW_CONSOLE_MAGIC (0xDEADBEEF)
22 22
23static __initdata char *shadow_console_buffer = (char *)SHADOW_CONSOLE_START; 23static __initdata char *shadow_console_buffer = (char *)SHADOW_CONSOLE_START;