Skip to content

Commit

Permalink
[Blackfin] arch: Fix bug to Enable kernel to build for bf548 with PM.
Browse files Browse the repository at this point in the history
On BF548-EZKIT, build kernel faills with power management, video and audio enabled.
This patch fix this.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
  • Loading branch information
Sonic Zhang authored and Bryan Wu committed Dec 23, 2007
1 parent c50e19f commit fb5f004
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 15 deletions.
2 changes: 2 additions & 0 deletions arch/blackfin/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,8 @@ config PM_WAKEUP_SIC_IWR
depends on PM_WAKEUP_GPIO_BY_SIC_IWR
default 0x80000000 if (BF537 || BF536 || BF534)
default 0x100000 if (BF533 || BF532 || BF531)
default 0x800000 if (BF549 || BF548 || BF547 || BF542)
default 0x800000 if (BF527 || BF524 || BF522)

config PM_WAKEUP_GPIO_NUMBER
int "Wakeup GPIO number"
Expand Down
8 changes: 4 additions & 4 deletions arch/blackfin/mach-bf548/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ ENTRY(_start_dma_code)
w[p0] = r0.l;
ssync;

p0.h = hi(SIC_IWR);
p0.l = lo(SIC_IWR);
p0.h = hi(SIC_IWR0);
p0.l = lo(SIC_IWR0);
r0.l = 0x1;
r0.h = 0x0;
[p0] = r0;
Expand Down Expand Up @@ -395,8 +395,8 @@ ENTRY(_start_dma_code)
[P2] = R1;
SSYNC;

p0.h = hi(SIC_IWR);
p0.l = lo(SIC_IWR);
p0.h = hi(SIC_IWR0);
p0.l = lo(SIC_IWR0);
r0.l = lo(IWR_ENABLE_ALL);
r0.h = hi(IWR_ENABLE_ALL);
[p0] = r0;
Expand Down
2 changes: 1 addition & 1 deletion arch/blackfin/mach-bf548/ints-priority.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void program_IAR(void)
((CONFIG_IRQ_PINT1 - 7) << IRQ_PINT1_POS) |
((CONFIG_IRQ_MDMAS0 - 7) << IRQ_MDMAS0_POS) |
((CONFIG_IRQ_MDMAS1 - 7) << IRQ_MDMAS1_POS) |
((CONFIG_IRQ_WATCHDOG - 7) << IRQ_WATCHDOG_POS));
((CONFIG_IRQ_WATCHDOG - 7) << IRQ_WATCH_POS));

bfin_write_SIC_IAR3(((CONFIG_IRQ_DMAC1_ERR - 7) << IRQ_DMAC1_ERR_POS) |
((CONFIG_IRQ_SPORT2_ERR - 7) << IRQ_SPORT2_ERR_POS) |
Expand Down
46 changes: 38 additions & 8 deletions arch/blackfin/mach-common/dpmc.S
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ ENTRY(_unmask_wdog_wakeup_evt)
#if defined(CONFIG_BF561)
P0.H = hi(SICA_IWR1);
P0.L = lo(SICA_IWR1);
#elif defined(CONFIG_BF54x) || defined(CONFIG_BF52x)
P0.h = HI(SIC_IWR0);
P0.l = LO(SIC_IWR0);
#else
P0.h = HI(SIC_IWR);
P0.l = LO(SIC_IWR);
Expand Down Expand Up @@ -236,7 +239,7 @@ ENTRY(_deep_sleep)

call _set_sic_iwr;

call _set_sdram_srfs;
call _set_dram_srfs;

/* Clear all the interrupts,bits sticky */
R0 = 0xFFFF (Z);
Expand All @@ -253,7 +256,7 @@ ENTRY(_deep_sleep)
SSYNC;
IDLE;

call _unset_sdram_srfs;
call _unset_dram_srfs;

call _test_pll_locked;

Expand Down Expand Up @@ -285,7 +288,7 @@ ENTRY(_sleep_deeper)
P3 = R0;
R0 = IWR_ENABLE(0);
call _set_sic_iwr;
call _set_sdram_srfs;
call _set_dram_srfs;

/* Clear all the interrupts,bits sticky */
R0 = 0xFFFF (Z);
Expand Down Expand Up @@ -360,42 +363,69 @@ ENTRY(_sleep_deeper)
IDLE;
call _test_pll_locked;

call _unset_sdram_srfs;
call _unset_dram_srfs;

STI R4;

RETS = [SP++];
( R7:0, P5:0 ) = [SP++];
RTS;

ENTRY(_set_sdram_srfs)
/* set the sdram to self refresh mode */
ENTRY(_set_dram_srfs)
/* set the dram to self refresh mode */
#if defined(CONFIG_BF54x)
P0.H = hi(EBIU_RSTCTL);
P0.L = lo(EBIU_RSTCTL);
R2 = [P0];
R3.H = hi(SRREQ);
R3.L = lo(SRREQ);
#else
P0.H = hi(EBIU_SDGCTL);
P0.L = lo(EBIU_SDGCTL);
R2 = [P0];
R3.H = hi(SRFS);
R3.L = lo(SRFS);
#endif
R2 = R2|R3;
[P0] = R2;
ssync;
#if defined(CONFIG_BF54x)
.LSRR_MODE:
R2 = [P0];
CC = BITTST(R2, 4);
if !CC JUMP .LSRR_MODE;
#endif
RTS;

ENTRY(_unset_sdram_srfs)
/* set the sdram out of self refresh mode */
ENTRY(_unset_dram_srfs)
/* set the dram out of self refresh mode */
#if defined(CONFIG_BF54x)
P0.H = hi(EBIU_RSTCTL);
P0.L = lo(EBIU_RSTCTL);
R2 = [P0];
R3.H = hi(SRREQ);
R3.L = lo(SRREQ);
#else
P0.H = hi(EBIU_SDGCTL);
P0.L = lo(EBIU_SDGCTL);
R2 = [P0];
R3.H = hi(SRFS);
R3.L = lo(SRFS);
#endif
R3 = ~R3;
R2 = R2&R3;
[P0] = R2;
ssync;
RTS;

ENTRY(_set_sic_iwr)
#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x)
P0.H = hi(SIC_IWR0);
P0.L = lo(SIC_IWR0);
#else
P0.H = hi(SIC_IWR);
P0.L = lo(SIC_IWR);
#endif
[P0] = R0;
SSYNC;
RTS;
Expand Down
16 changes: 16 additions & 0 deletions arch/blackfin/mach-common/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,31 @@ void bfin_pm_suspend_standby_enter(void)

gpio_pm_restore();

#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x)
bfin_write_SIC_IWR0(IWR_ENABLE_ALL);
bfin_write_SIC_IWR1(IWR_ENABLE_ALL);
# ifdef CONFIG_BF54x
bfin_write_SIC_IWR2(IWR_ENABLE_ALL);
# endif
#else
bfin_write_SIC_IWR(IWR_ENABLE_ALL);
#endif

local_irq_restore(flags);
}
#endif

#if defined(CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR)
sleep_deeper(CONFIG_PM_WAKEUP_SIC_IWR);
# if defined(CONFIG_BF54x) || defined(CONFIG_BF52x)
bfin_write_SIC_IWR0(IWR_ENABLE_ALL);
bfin_write_SIC_IWR1(IWR_ENABLE_ALL);
# ifdef CONFIG_BF54x
bfin_write_SIC_IWR2(IWR_ENABLE_ALL);
# endif
# else
bfin_write_SIC_IWR(IWR_ENABLE_ALL);
# endif
#endif /* CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR */
}

Expand Down
4 changes: 2 additions & 2 deletions include/asm-blackfin/mach-bf548/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Events (highest priority) EMU 0
#define IRQ_PINT1 BFIN_IRQ(20) /* PINT1 Interrupt */
#define IRQ_MDMAS0 BFIN_IRQ(21) /* MDMA Stream 0 Interrupt */
#define IRQ_MDMAS1 BFIN_IRQ(22) /* MDMA Stream 1 Interrupt */
#define IRQ_WATCHDOG BFIN_IRQ(23) /* Watchdog Interrupt */
#define IRQ_WATCH BFIN_IRQ(23) /* Watchdog Interrupt */
#define IRQ_DMAC1_ERROR BFIN_IRQ(24) /* DMAC1 Status (Error) Interrupt */
#define IRQ_SPORT2_ERROR BFIN_IRQ(25) /* SPORT2 Error Interrupt */
#define IRQ_SPORT3_ERROR BFIN_IRQ(26) /* SPORT3 Error Interrupt */
Expand Down Expand Up @@ -406,7 +406,7 @@ Events (highest priority) EMU 0
#define IRQ_PINT1_POS 16
#define IRQ_MDMAS0_POS 20
#define IRQ_MDMAS1_POS 24
#define IRQ_WATCHDOG_POS 28
#define IRQ_WATCH_POS 28

/* IAR3 BIT FIELDS */
#define IRQ_DMAC1_ERR_POS 0
Expand Down
1 change: 1 addition & 0 deletions include/asm-blackfin/mach-bf548/mem_init.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
*/

#if (CONFIG_MEM_MT46V32M16)
#endif

#if defined CONFIG_CLKIN_HALF
#define CLKIN_HALF 1
Expand Down

0 comments on commit fb5f004

Please sign in to comment.