aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin
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
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')
-rw-r--r--arch/blackfin/Kconfig25
-rw-r--r--arch/blackfin/Makefile2
-rw-r--r--arch/blackfin/configs/BF609-EZKIT_defconfig153
-rw-r--r--arch/blackfin/include/asm/bfin-global.h5
-rw-r--r--arch/blackfin/include/asm/bfin_dma.h84
-rw-r--r--arch/blackfin/include/asm/bfin_serial.h168
-rw-r--r--arch/blackfin/include/asm/dma.h137
-rw-r--r--arch/blackfin/include/asm/fixed_code.h30
-rw-r--r--arch/blackfin/include/asm/page.h5
-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
-rw-r--r--arch/blackfin/mach-common/entry.S3
-rw-r--r--arch/blackfin/mach-common/head.S2
-rw-r--r--arch/blackfin/mm/init.c14
19 files changed, 840 insertions, 146 deletions
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index 373a6902d8fa..23bae9a3f787 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -226,6 +226,12 @@ config BF561
226 help 226 help
227 BF561 Processor Support. 227 BF561 Processor Support.
228 228
229config BF609
230 bool "BF609"
231 select CLKDEV_LOOKUP
232 help
233 BF609 Processor Support.
234
229endchoice 235endchoice
230 236
231config SMP 237config SMP
@@ -251,27 +257,27 @@ config HOTPLUG_CPU
251 257
252config BF_REV_MIN 258config BF_REV_MIN
253 int 259 int
254 default 0 if (BF51x || BF52x || (BF54x && !BF54xM)) 260 default 0 if (BF51x || BF52x || (BF54x && !BF54xM)) || BF60x
255 default 2 if (BF537 || BF536 || BF534) 261 default 2 if (BF537 || BF536 || BF534)
256 default 3 if (BF561 || BF533 || BF532 || BF531 || BF54xM) 262 default 3 if (BF561 || BF533 || BF532 || BF531 || BF54xM)
257 default 4 if (BF538 || BF539) 263 default 4 if (BF538 || BF539)
258 264
259config BF_REV_MAX 265config BF_REV_MAX
260 int 266 int
261 default 2 if (BF51x || BF52x || (BF54x && !BF54xM)) 267 default 2 if (BF51x || BF52x || (BF54x && !BF54xM)) || BF60x
262 default 3 if (BF537 || BF536 || BF534 || BF54xM) 268 default 3 if (BF537 || BF536 || BF534 || BF54xM)
263 default 5 if (BF561 || BF538 || BF539) 269 default 5 if (BF561 || BF538 || BF539)
264 default 6 if (BF533 || BF532 || BF531) 270 default 6 if (BF533 || BF532 || BF531)
265 271
266choice 272choice
267 prompt "Silicon Rev" 273 prompt "Silicon Rev"
268 default BF_REV_0_0 if (BF51x || BF52x) 274 default BF_REV_0_0 if (BF51x || BF52x || BF60x)
269 default BF_REV_0_2 if (BF534 || BF536 || BF537 || (BF54x && !BF54xM)) 275 default BF_REV_0_2 if (BF534 || BF536 || BF537 || (BF54x && !BF54xM))
270 default BF_REV_0_3 if (BF531 || BF532 || BF533 || BF54xM || BF561) 276 default BF_REV_0_3 if (BF531 || BF532 || BF533 || BF54xM || BF561)
271 277
272config BF_REV_0_0 278config BF_REV_0_0
273 bool "0.0" 279 bool "0.0"
274 depends on (BF51x || BF52x || (BF54x && !BF54xM)) 280 depends on (BF51x || BF52x || (BF54x && !BF54xM) || BF60x)
275 281
276config BF_REV_0_1 282config BF_REV_0_1
277 bool "0.1" 283 bool "0.1"
@@ -350,6 +356,7 @@ source "arch/blackfin/mach-bf561/Kconfig"
350source "arch/blackfin/mach-bf537/Kconfig" 356source "arch/blackfin/mach-bf537/Kconfig"
351source "arch/blackfin/mach-bf538/Kconfig" 357source "arch/blackfin/mach-bf538/Kconfig"
352source "arch/blackfin/mach-bf548/Kconfig" 358source "arch/blackfin/mach-bf548/Kconfig"
359source "arch/blackfin/mach-bf609/Kconfig"
353 360
354menu "Board customizations" 361menu "Board customizations"
355 362
@@ -379,6 +386,12 @@ config BOOT_LOAD
379 memory region is used to capture NULL pointer references as well 386 memory region is used to capture NULL pointer references as well
380 as some core kernel functions. 387 as some core kernel functions.
381 388
389config PHY_RAM_BASE_ADDRESS
390 hex "Physical RAM Base"
391 default 0x0
392 help
393 set BF609 FPGA physical SRAM base address
394
382config ROM_BASE 395config ROM_BASE
383 hex "Kernel ROM Base" 396 hex "Kernel ROM Base"
384 depends on ROMKERNEL 397 depends on ROMKERNEL
@@ -1051,7 +1064,7 @@ endchoice
1051config BFIN_L2_DCACHEABLE 1064config BFIN_L2_DCACHEABLE
1052 bool "Enable DCACHE for L2 SRAM" 1065 bool "Enable DCACHE for L2 SRAM"
1053 depends on BFIN_DCACHE 1066 depends on BFIN_DCACHE
1054 depends on (BF54x || BF561) && !SMP 1067 depends on (BF54x || BF561 || BF60x) && !SMP
1055 default n 1068 default n
1056choice 1069choice
1057 prompt "L2 SRAM DCACHE policy" 1070 prompt "L2 SRAM DCACHE policy"
@@ -1077,6 +1090,7 @@ config MPU
1077comment "Asynchronous Memory Configuration" 1090comment "Asynchronous Memory Configuration"
1078 1091
1079menu "EBIU_AMGCTL Global Control" 1092menu "EBIU_AMGCTL Global Control"
1093 depends on !BF60x
1080config C_AMCKEN 1094config C_AMCKEN
1081 bool "Enable CLKOUT" 1095 bool "Enable CLKOUT"
1082 default y 1096 default y
@@ -1127,6 +1141,7 @@ endchoice
1127endmenu 1141endmenu
1128 1142
1129menu "EBIU_AMBCTL Control" 1143menu "EBIU_AMBCTL Control"
1144 depends on !BF60x
1130config BANK_0 1145config BANK_0
1131 hex "Bank 0 (AMBCTL0.L)" 1146 hex "Bank 0 (AMBCTL0.L)"
1132 default 0x7BB0 1147 default 0x7BB0
diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile
index 46f42b2066e5..74fdf679da01 100644
--- a/arch/blackfin/Makefile
+++ b/arch/blackfin/Makefile
@@ -54,6 +54,7 @@ machine-$(CONFIG_BF548M) := bf548
54machine-$(CONFIG_BF549) := bf548 54machine-$(CONFIG_BF549) := bf548
55machine-$(CONFIG_BF549M) := bf548 55machine-$(CONFIG_BF549M) := bf548
56machine-$(CONFIG_BF561) := bf561 56machine-$(CONFIG_BF561) := bf561
57machine-$(CONFIG_BF609) := bf609
57MACHINE := $(machine-y) 58MACHINE := $(machine-y)
58export MACHINE 59export MACHINE
59 60
@@ -86,6 +87,7 @@ cpu-$(CONFIG_BF548M) := bf548m
86cpu-$(CONFIG_BF549) := bf549 87cpu-$(CONFIG_BF549) := bf549
87cpu-$(CONFIG_BF549M) := bf549m 88cpu-$(CONFIG_BF549M) := bf549m
88cpu-$(CONFIG_BF561) := bf561 89cpu-$(CONFIG_BF561) := bf561
90cpu-$(CONFIG_BF609) := bf609
89 91
90rev-$(CONFIG_BF_REV_0_0) := 0.0 92rev-$(CONFIG_BF_REV_0_0) := 0.0
91rev-$(CONFIG_BF_REV_0_1) := 0.1 93rev-$(CONFIG_BF_REV_0_1) := 0.1
diff --git a/arch/blackfin/configs/BF609-EZKIT_defconfig b/arch/blackfin/configs/BF609-EZKIT_defconfig
new file mode 100644
index 000000000000..07c92465109a
--- /dev/null
+++ b/arch/blackfin/configs/BF609-EZKIT_defconfig
@@ -0,0 +1,153 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y
3CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y
7CONFIG_EXPERT=y
8# CONFIG_ELF_CORE is not set
9# CONFIG_FUTEX is not set
10# CONFIG_SIGNALFD is not set
11# CONFIG_TIMERFD is not set
12# CONFIG_EVENTFD is not set
13# CONFIG_AIO is not set
14CONFIG_SLAB=y
15CONFIG_MMAP_ALLOW_UNINITIALIZED=y
16CONFIG_MODULES=y
17CONFIG_MODULE_UNLOAD=y
18# CONFIG_LBDAF is not set
19# CONFIG_BLK_DEV_BSG is not set
20# CONFIG_IOSCHED_DEADLINE is not set
21# CONFIG_IOSCHED_CFQ is not set
22CONFIG_PREEMPT_VOLUNTARY=y
23CONFIG_BF609=y
24CONFIG_PINT1_ASSIGN=0x01010000
25CONFIG_PINT2_ASSIGN=0x07000101
26CONFIG_PINT3_ASSIGN=0x02020303
27CONFIG_HIGH_RES_TIMERS=y
28CONFIG_IP_CHECKSUM_L1=y
29CONFIG_SYSCALL_TAB_L1=y
30CONFIG_CPLB_SWITCH_TAB_L1=y
31# CONFIG_APP_STACK_L1 is not set
32# CONFIG_BFIN_INS_LOWOVERHEAD is not set
33CONFIG_NOMMU_INITIAL_TRIM_EXCESS=0
34CONFIG_BINFMT_FLAT=y
35CONFIG_BINFMT_ZFLAT=y
36# CONFIG_SUSPEND is not set
37CONFIG_CPU_FREQ=y
38CONFIG_CPU_FREQ_GOV_POWERSAVE=y
39CONFIG_CPU_FREQ_GOV_ONDEMAND=y
40CONFIG_NET=y
41CONFIG_PACKET=y
42CONFIG_UNIX=y
43CONFIG_INET=y
44CONFIG_IP_PNP=y
45CONFIG_IP_PNP_DHCP=y
46CONFIG_IP_PNP_BOOTP=y
47CONFIG_IP_PNP_RARP=y
48# CONFIG_IPV6 is not set
49CONFIG_NETFILTER=y
50CONFIG_CAN=y
51CONFIG_CAN_BFIN=y
52CONFIG_IRDA=y
53CONFIG_IRTTY_SIR=y
54# CONFIG_WIRELESS is not set
55CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
56CONFIG_FW_LOADER=m
57CONFIG_MTD=y
58CONFIG_MTD_CMDLINE_PARTS=y
59CONFIG_MTD_CHAR=y
60CONFIG_MTD_CFI=y
61CONFIG_MTD_CFI_INTELEXT=y
62CONFIG_MTD_CFI_STAA=y
63CONFIG_MTD_COMPLEX_MAPPINGS=y
64CONFIG_MTD_BFIN_BF60x=y
65CONFIG_MTD_M25P80=y
66CONFIG_MTD_UBI=m
67CONFIG_SCSI=y
68CONFIG_BLK_DEV_SD=y
69CONFIG_NETDEVICES=y
70# CONFIG_NET_VENDOR_BROADCOM is not set
71# CONFIG_NET_VENDOR_CHELSIO is not set
72# CONFIG_NET_VENDOR_INTEL is not set
73# CONFIG_NET_VENDOR_MARVELL is not set
74# CONFIG_NET_VENDOR_MICREL is not set
75# CONFIG_NET_VENDOR_MICROCHIP is not set
76# CONFIG_NET_VENDOR_NATSEMI is not set
77# CONFIG_NET_VENDOR_SEEQ is not set
78# CONFIG_NET_VENDOR_SMSC is not set
79CONFIG_STMMAC_ETH=y
80CONFIG_STMMAC_IEEE1588=y
81# CONFIG_WLAN is not set
82# CONFIG_INPUT_MOUSEDEV is not set
83CONFIG_INPUT_EVDEV=y
84# CONFIG_INPUT_KEYBOARD is not set
85# CONFIG_INPUT_MOUSE is not set
86CONFIG_INPUT_MISC=y
87CONFIG_INPUT_BFIN_ROTARY=y
88# CONFIG_SERIO is not set
89# CONFIG_LEGACY_PTYS is not set
90CONFIG_BFIN_SIMPLE_TIMER=m
91CONFIG_BFIN_LINKPORT=y
92# CONFIG_DEVKMEM is not set
93CONFIG_SERIAL_BFIN=y
94CONFIG_SERIAL_BFIN_CONSOLE=y
95CONFIG_SERIAL_BFIN_UART0=y
96# CONFIG_HW_RANDOM is not set
97CONFIG_I2C=y
98CONFIG_I2C_CHARDEV=y
99CONFIG_I2C_BLACKFIN_TWI=y
100CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=100
101CONFIG_SPI=y
102CONFIG_SPI_BFIN6XX=y
103CONFIG_GPIOLIB=y
104CONFIG_GPIO_SYSFS=y
105# CONFIG_HWMON is not set
106CONFIG_WATCHDOG=y
107CONFIG_BFIN_WDT=y
108CONFIG_SOUND=m
109CONFIG_SND=m
110CONFIG_SND_MIXER_OSS=m
111CONFIG_SND_PCM_OSS=m
112# CONFIG_SND_DRIVERS is not set
113# CONFIG_SND_SPI is not set
114# CONFIG_SND_USB is not set
115CONFIG_SND_SOC=m
116CONFIG_SND_BF6XX_I2S=m
117CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61=m
118CONFIG_SND_SOC_ALL_CODECS=m
119CONFIG_USB=y
120CONFIG_USB_MUSB_HDRC=y
121CONFIG_USB_MUSB_BLACKFIN=y
122CONFIG_USB_STORAGE=y
123CONFIG_USB_GADGET=y
124CONFIG_USB_GADGET_MUSB_HDRC=y
125CONFIG_USB_ZERO=y
126CONFIG_MMC=y
127CONFIG_SDH_BFIN=y
128# CONFIG_IOMMU_SUPPORT is not set
129CONFIG_EXT2_FS=y
130# CONFIG_DNOTIFY is not set
131CONFIG_MSDOS_FS=y
132CONFIG_VFAT_FS=y
133CONFIG_JFFS2_FS=m
134CONFIG_UBIFS_FS=m
135CONFIG_NFS_FS=m
136CONFIG_NFS_V3=y
137CONFIG_NLS_CODEPAGE_437=y
138CONFIG_NLS_ISO8859_1=y
139CONFIG_DEBUG_FS=y
140CONFIG_DEBUG_SHIRQ=y
141CONFIG_DETECT_HUNG_TASK=y
142CONFIG_DEBUG_INFO=y
143CONFIG_FRAME_POINTER=y
144# CONFIG_FTRACE is not set
145CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_ONE=y
146CONFIG_EARLY_PRINTK=y
147CONFIG_CPLB_INFO=y
148CONFIG_BFIN_PSEUDODBG_INSNS=y
149CONFIG_CRYPTO_HMAC=y
150CONFIG_CRYPTO_MD4=y
151CONFIG_CRYPTO_MD5=y
152CONFIG_CRYPTO_ARC4=y
153# CONFIG_CRYPTO_ANSI_CPRNG is not set
diff --git a/arch/blackfin/include/asm/bfin-global.h b/arch/blackfin/include/asm/bfin-global.h
index 17bcbf60bcae..a83e922a878d 100644
--- a/arch/blackfin/include/asm/bfin-global.h
+++ b/arch/blackfin/include/asm/bfin-global.h
@@ -35,6 +35,11 @@ extern void bfin_setup_cpudata(unsigned int cpu);
35 35
36extern unsigned long get_cclk(void); 36extern unsigned long get_cclk(void);
37extern unsigned long get_sclk(void); 37extern unsigned long get_sclk(void);
38#ifdef CONFIG_BF60x
39extern unsigned long get_sclk0(void);
40extern unsigned long get_sclk1(void);
41extern unsigned long get_dramclk(void);
42#endif
38extern unsigned long sclk_to_usecs(unsigned long sclk); 43extern unsigned long sclk_to_usecs(unsigned long sclk);
39extern unsigned long usecs_to_sclk(unsigned long usecs); 44extern unsigned long usecs_to_sclk(unsigned long usecs);
40 45
diff --git a/arch/blackfin/include/asm/bfin_dma.h b/arch/blackfin/include/asm/bfin_dma.h
index d51120744148..6319f4e49083 100644
--- a/arch/blackfin/include/asm/bfin_dma.h
+++ b/arch/blackfin/include/asm/bfin_dma.h
@@ -15,12 +15,55 @@
15#define DMAEN 0x0001 /* DMA Channel Enable */ 15#define DMAEN 0x0001 /* DMA Channel Enable */
16#define WNR 0x0002 /* Channel Direction (W/R*) */ 16#define WNR 0x0002 /* Channel Direction (W/R*) */
17#define WDSIZE_8 0x0000 /* Transfer Word Size = 8 */ 17#define WDSIZE_8 0x0000 /* Transfer Word Size = 8 */
18#define PSIZE_8 0x00000000 /* Transfer Word Size = 16 */
19
20#ifdef CONFIG_BF60x
21
22#define PSIZE_16 0x00000010 /* Transfer Word Size = 16 */
23#define PSIZE_32 0x00000020 /* Transfer Word Size = 32 */
24#define PSIZE_64 0x00000030 /* Transfer Word Size = 32 */
25#define WDSIZE_16 0x00000100 /* Transfer Word Size = 16 */
26#define WDSIZE_32 0x00000200 /* Transfer Word Size = 32 */
27#define WDSIZE_64 0x00000300 /* Transfer Word Size = 32 */
28#define WDSIZE_128 0x00000400 /* Transfer Word Size = 32 */
29#define WDSIZE_256 0x00000500 /* Transfer Word Size = 32 */
30#define DMA2D 0x04000000 /* DMA Mode (2D/1D*) */
31#define RESTART 0x00000004 /* DMA Buffer Clear SYNC */
32#define DI_EN_X 0x00100000 /* Data Interrupt Enable in X count */
33#define DI_EN_Y 0x00200000 /* Data Interrupt Enable in Y count */
34#define DI_EN_P 0x00300000 /* Data Interrupt Enable in Peripheral */
35#define DI_EN DI_EN_X /* Data Interrupt Enable */
36#define NDSIZE_0 0x00000000 /* Next Descriptor Size = 1 */
37#define NDSIZE_1 0x00010000 /* Next Descriptor Size = 2 */
38#define NDSIZE_2 0x00020000 /* Next Descriptor Size = 3 */
39#define NDSIZE_3 0x00030000 /* Next Descriptor Size = 4 */
40#define NDSIZE_4 0x00040000 /* Next Descriptor Size = 5 */
41#define NDSIZE_5 0x00050000 /* Next Descriptor Size = 6 */
42#define NDSIZE_6 0x00060000 /* Next Descriptor Size = 7 */
43#define NDSIZE 0x00070000 /* Next Descriptor Size */
44#define NDSIZE_OFFSET 16 /* Next Descriptor Size Offset */
45#define DMAFLOW_LIST 0x00004000 /* Descriptor List Mode */
46#define DMAFLOW_LARGE DMAFLOW_LIST
47#define DMAFLOW_ARRAY 0x00005000 /* Descriptor Array Mode */
48#define DMAFLOW_LIST_DEMAND 0x00006000 /* Descriptor Demand List Mode */
49#define DMAFLOW_ARRAY_DEMAND 0x00007000 /* Descriptor Demand Array Mode */
50#define DMA_RUN_DFETCH 0x00000100 /* DMA Channel Running Indicator (DFETCH) */
51#define DMA_RUN 0x00000200 /* DMA Channel Running Indicator */
52#define DMA_RUN_WAIT_TRIG 0x00000300 /* DMA Channel Running Indicator (WAIT TRIG) */
53#define DMA_RUN_WAIT_ACK 0x00000400 /* DMA Channel Running Indicator (WAIT ACK) */
54
55#else
56
57#define PSIZE_16 0x0000 /* Transfer Word Size = 16 */
58#define PSIZE_32 0x0000 /* Transfer Word Size = 32 */
18#define WDSIZE_16 0x0004 /* Transfer Word Size = 16 */ 59#define WDSIZE_16 0x0004 /* Transfer Word Size = 16 */
19#define WDSIZE_32 0x0008 /* Transfer Word Size = 32 */ 60#define WDSIZE_32 0x0008 /* Transfer Word Size = 32 */
20#define DMA2D 0x0010 /* DMA Mode (2D/1D*) */ 61#define DMA2D 0x0010 /* DMA Mode (2D/1D*) */
21#define RESTART 0x0020 /* DMA Buffer Clear */ 62#define RESTART 0x0020 /* DMA Buffer Clear */
22#define DI_SEL 0x0040 /* Data Interrupt Timing Select */ 63#define DI_SEL 0x0040 /* Data Interrupt Timing Select */
23#define DI_EN 0x0080 /* Data Interrupt Enable */ 64#define DI_EN 0x0080 /* Data Interrupt Enable */
65#define DI_EN_X 0x00C0 /* Data Interrupt Enable in X count*/
66#define DI_EN_Y 0x0080 /* Data Interrupt Enable in Y count*/
24#define NDSIZE_0 0x0000 /* Next Descriptor Size = 0 (Stop/Autobuffer) */ 67#define NDSIZE_0 0x0000 /* Next Descriptor Size = 0 (Stop/Autobuffer) */
25#define NDSIZE_1 0x0100 /* Next Descriptor Size = 1 */ 68#define NDSIZE_1 0x0100 /* Next Descriptor Size = 1 */
26#define NDSIZE_2 0x0200 /* Next Descriptor Size = 2 */ 69#define NDSIZE_2 0x0200 /* Next Descriptor Size = 2 */
@@ -32,18 +75,26 @@
32#define NDSIZE_8 0x0800 /* Next Descriptor Size = 8 */ 75#define NDSIZE_8 0x0800 /* Next Descriptor Size = 8 */
33#define NDSIZE_9 0x0900 /* Next Descriptor Size = 9 */ 76#define NDSIZE_9 0x0900 /* Next Descriptor Size = 9 */
34#define NDSIZE 0x0f00 /* Next Descriptor Size */ 77#define NDSIZE 0x0f00 /* Next Descriptor Size */
35#define DMAFLOW 0x7000 /* Flow Control */ 78#define NDSIZE_OFFSET 8 /* Next Descriptor Size Offset */
36#define DMAFLOW_STOP 0x0000 /* Stop Mode */
37#define DMAFLOW_AUTO 0x1000 /* Autobuffer Mode */
38#define DMAFLOW_ARRAY 0x4000 /* Descriptor Array Mode */ 79#define DMAFLOW_ARRAY 0x4000 /* Descriptor Array Mode */
39#define DMAFLOW_SMALL 0x6000 /* Small Model Descriptor List Mode */ 80#define DMAFLOW_SMALL 0x6000 /* Small Model Descriptor List Mode */
40#define DMAFLOW_LARGE 0x7000 /* Large Model Descriptor List Mode */ 81#define DMAFLOW_LARGE 0x7000 /* Large Model Descriptor List Mode */
82#define DFETCH 0x0004 /* DMA Descriptor Fetch Indicator */
83#define DMA_RUN 0x0008 /* DMA Channel Running Indicator */
84
85#endif
86#define DMAFLOW 0x7000 /* Flow Control */
87#define DMAFLOW_STOP 0x0000 /* Stop Mode */
88#define DMAFLOW_AUTO 0x1000 /* Autobuffer Mode */
41 89
42/* DMA_IRQ_STATUS Masks */ 90/* DMA_IRQ_STATUS Masks */
43#define DMA_DONE 0x0001 /* DMA Completion Interrupt Status */ 91#define DMA_DONE 0x0001 /* DMA Completion Interrupt Status */
44#define DMA_ERR 0x0002 /* DMA Error Interrupt Status */ 92#define DMA_ERR 0x0002 /* DMA Error Interrupt Status */
45#define DFETCH 0x0004 /* DMA Descriptor Fetch Indicator */ 93#ifdef CONFIG_BF60x
46#define DMA_RUN 0x0008 /* DMA Channel Running Indicator */ 94#define DMA_PIRQ 0x0004 /* DMA Peripheral Error Interrupt Status */
95#else
96#define DMA_PIRQ 0
97#endif
47 98
48/* 99/*
49 * All Blackfin system MMRs are padded to 32bits even if the register 100 * All Blackfin system MMRs are padded to 32bits even if the register
@@ -57,6 +108,26 @@
57struct bfin_dma_regs { 108struct bfin_dma_regs {
58 u32 next_desc_ptr; 109 u32 next_desc_ptr;
59 u32 start_addr; 110 u32 start_addr;
111#ifdef CONFIG_BF60x
112 u32 cfg;
113 u32 x_count;
114 u32 x_modify;
115 u32 y_count;
116 u32 y_modify;
117 u32 pad1;
118 u32 pad2;
119 u32 curr_desc_ptr;
120 u32 prev_desc_ptr;
121 u32 curr_addr;
122 u32 irq_status;
123 u32 curr_x_count;
124 u32 curr_y_count;
125 u32 pad3;
126 u32 bw_limit_count;
127 u32 curr_bw_limit_count;
128 u32 bw_monitor_count;
129 u32 curr_bw_monitor_count;
130#else
60 __BFP(config); 131 __BFP(config);
61 u32 __pad0; 132 u32 __pad0;
62 __BFP(x_count); 133 __BFP(x_count);
@@ -71,8 +142,10 @@ struct bfin_dma_regs {
71 u32 __pad1; 142 u32 __pad1;
72 __BFP(curr_y_count); 143 __BFP(curr_y_count);
73 u32 __pad2; 144 u32 __pad2;
145#endif
74}; 146};
75 147
148#ifndef CONFIG_BF60x
76/* 149/*
77 * bfin handshake mdma registers layout 150 * bfin handshake mdma registers layout
78 */ 151 */
@@ -85,6 +158,7 @@ struct bfin_hmdma_regs {
85 __BFP(ecount); 158 __BFP(ecount);
86 __BFP(bcount); 159 __BFP(bcount);
87}; 160};
161#endif
88 162
89#undef __BFP 163#undef __BFP
90 164
diff --git a/arch/blackfin/include/asm/bfin_serial.h b/arch/blackfin/include/asm/bfin_serial.h
index 68bcc3d119b6..80a58488dbe7 100644
--- a/arch/blackfin/include/asm/bfin_serial.h
+++ b/arch/blackfin/include/asm/bfin_serial.h
@@ -18,7 +18,7 @@
18 defined(CONFIG_BFIN_UART1_CTSRTS) || \ 18 defined(CONFIG_BFIN_UART1_CTSRTS) || \
19 defined(CONFIG_BFIN_UART2_CTSRTS) || \ 19 defined(CONFIG_BFIN_UART2_CTSRTS) || \
20 defined(CONFIG_BFIN_UART3_CTSRTS) 20 defined(CONFIG_BFIN_UART3_CTSRTS)
21# ifdef BFIN_UART_BF54X_STYLE 21# if defined(BFIN_UART_BF54X_STYLE) || defined(BFIN_UART_BF60X_STYLE)
22# define CONFIG_SERIAL_BFIN_HARD_CTSRTS 22# define CONFIG_SERIAL_BFIN_HARD_CTSRTS
23# else 23# else
24# define CONFIG_SERIAL_BFIN_CTSRTS 24# define CONFIG_SERIAL_BFIN_CTSRTS
@@ -58,14 +58,67 @@ struct bfin_serial_port {
58#endif 58#endif
59}; 59};
60 60
61#ifdef BFIN_UART_BF60X_STYLE
62
63/* UART_CTL Masks */
64#define UCEN 0x1 /* Enable UARTx Clocks */
65#define LOOP_ENA 0x2 /* Loopback Mode Enable */
66#define UMOD_MDB 0x10 /* Enable MDB Mode */
67#define UMOD_IRDA 0x20 /* Enable IrDA Mode */
68#define UMOD_MASK 0x30 /* Uart Mode Mask */
69#define WLS(x) (((x-5) & 0x03) << 8) /* Word Length Select */
70#define WLS_MASK 0x300 /* Word length Select Mask */
71#define STB 0x1000 /* Stop Bits */
72#define STBH 0x2000 /* Half Stop Bits */
73#define PEN 0x4000 /* Parity Enable */
74#define EPS 0x8000 /* Even Parity Select */
75#define STP 0x10000 /* Stick Parity */
76#define FPE 0x20000 /* Force Parity Error On Transmit */
77#define FFE 0x40000 /* Force Framing Error On Transmit */
78#define SB 0x80000 /* Set Break */
79#define LCR_MASK (STP | EPS | PEN | STB | WLS_MASK)
80#define FCPOL 0x400000 /* Flow Control Pin Polarity */
81#define RPOLC 0x800000 /* IrDA RX Polarity Change */
82#define TPOLC 0x1000000 /* IrDA TX Polarity Change */
83#define MRTS 0x2000000 /* Manual Request To Send */
84#define XOFF 0x4000000 /* Transmitter Off */
85#define ARTS 0x8000000 /* Automatic Request To Send */
86#define ACTS 0x10000000 /* Automatic Clear To Send */
87#define RFIT 0x20000000 /* Receive FIFO IRQ Threshold */
88#define RFRT 0x40000000 /* Receive FIFO RTS Threshold */
89
90/* UART_STAT Masks */
91#define DR 0x01 /* Data Ready */
92#define OE 0x02 /* Overrun Error */
93#define PE 0x04 /* Parity Error */
94#define FE 0x08 /* Framing Error */
95#define BI 0x10 /* Break Interrupt */
96#define THRE 0x20 /* THR Empty */
97#define TEMT 0x80 /* TSR and UART_THR Empty */
98#define TFI 0x100 /* Transmission Finished Indicator */
99
100#define ASTKY 0x200 /* Address Sticky */
101#define ADDR 0x400 /* Address bit status */
102#define RO 0x800 /* Reception Ongoing */
103#define SCTS 0x1000 /* Sticky CTS */
104#define CTS 0x10000 /* Clear To Send */
105#define RFCS 0x20000 /* Receive FIFO Count Status */
106
107/* UART_CLOCK Masks */
108#define EDBO 0x80000000 /* Enable Devide by One */
109
110#else /* BFIN_UART_BF60X_STYLE */
111
61/* UART_LCR Masks */ 112/* UART_LCR Masks */
62#define WLS(x) (((x)-5) & 0x03) /* Word Length Select */ 113#define WLS(x) (((x)-5) & 0x03) /* Word Length Select */
114#define WLS_MASK 0x03 /* Word length Select Mask */
63#define STB 0x04 /* Stop Bits */ 115#define STB 0x04 /* Stop Bits */
64#define PEN 0x08 /* Parity Enable */ 116#define PEN 0x08 /* Parity Enable */
65#define EPS 0x10 /* Even Parity Select */ 117#define EPS 0x10 /* Even Parity Select */
66#define STP 0x20 /* Stick Parity */ 118#define STP 0x20 /* Stick Parity */
67#define SB 0x40 /* Set Break */ 119#define SB 0x40 /* Set Break */
68#define DLAB 0x80 /* Divisor Latch Access */ 120#define DLAB 0x80 /* Divisor Latch Access */
121#define LCR_MASK (STP | EPS | PEN | STB | WLS_MASK)
69 122
70/* UART_LSR Masks */ 123/* UART_LSR Masks */
71#define DR 0x01 /* Data Ready */ 124#define DR 0x01 /* Data Ready */
@@ -77,15 +130,6 @@ struct bfin_serial_port {
77#define TEMT 0x40 /* TSR and UART_THR Empty */ 130#define TEMT 0x40 /* TSR and UART_THR Empty */
78#define TFI 0x80 /* Transmission Finished Indicator */ 131#define TFI 0x80 /* Transmission Finished Indicator */
79 132
80/* UART_IER Masks */
81#define ERBFI 0x01 /* Enable Receive Buffer Full Interrupt */
82#define ETBEI 0x02 /* Enable Transmit Buffer Empty Interrupt */
83#define ELSI 0x04 /* Enable RX Status Interrupt */
84#define EDSSI 0x08 /* Enable Modem Status Interrupt */
85#define EDTPTI 0x10 /* Enable DMA Transmit PIRQ Interrupt */
86#define ETFI 0x20 /* Enable Transmission Finished Interrupt */
87#define ERFCI 0x40 /* Enable Receive FIFO Count Interrupt */
88
89/* UART_MCR Masks */ 133/* UART_MCR Masks */
90#define XOFF 0x01 /* Transmitter Off */ 134#define XOFF 0x01 /* Transmitter Off */
91#define MRTS 0x02 /* Manual Request To Send */ 135#define MRTS 0x02 /* Manual Request To Send */
@@ -103,13 +147,36 @@ struct bfin_serial_port {
103 147
104/* UART_GCTL Masks */ 148/* UART_GCTL Masks */
105#define UCEN 0x01 /* Enable UARTx Clocks */ 149#define UCEN 0x01 /* Enable UARTx Clocks */
106#define IREN 0x02 /* Enable IrDA Mode */ 150#define UMOD_IRDA 0x02 /* Enable IrDA Mode */
151#define UMOD_MASK 0x02 /* Uart Mode Mask */
107#define TPOLC 0x04 /* IrDA TX Polarity Change */ 152#define TPOLC 0x04 /* IrDA TX Polarity Change */
108#define RPOLC 0x08 /* IrDA RX Polarity Change */ 153#define RPOLC 0x08 /* IrDA RX Polarity Change */
109#define FPE 0x10 /* Force Parity Error On Transmit */ 154#define FPE 0x10 /* Force Parity Error On Transmit */
110#define FFE 0x20 /* Force Framing Error On Transmit */ 155#define FFE 0x20 /* Force Framing Error On Transmit */
111 156
112#ifdef BFIN_UART_BF54X_STYLE 157#endif /* BFIN_UART_BF60X_STYLE */
158
159/* UART_IER Masks */
160#define ERBFI 0x01 /* Enable Receive Buffer Full Interrupt */
161#define ETBEI 0x02 /* Enable Transmit Buffer Empty Interrupt */
162#define ELSI 0x04 /* Enable RX Status Interrupt */
163#define EDSSI 0x08 /* Enable Modem Status Interrupt */
164#define EDTPTI 0x10 /* Enable DMA Transmit PIRQ Interrupt */
165#define ETFI 0x20 /* Enable Transmission Finished Interrupt */
166#define ERFCI 0x40 /* Enable Receive FIFO Count Interrupt */
167
168#if defined(BFIN_UART_BF60X_STYLE)
169# define OFFSET_REDIV 0x00 /* Version ID Register */
170# define OFFSET_CTL 0x04 /* Control Register */
171# define OFFSET_STAT 0x08 /* Status Register */
172# define OFFSET_SCR 0x0C /* SCR Scratch Register */
173# define OFFSET_CLK 0x10 /* Clock Rate Register */
174# define OFFSET_IER 0x14 /* Interrupt Enable Register */
175# define OFFSET_IER_SET 0x18 /* Set Interrupt Enable Register */
176# define OFFSET_IER_CLEAR 0x1C /* Clear Interrupt Enable Register */
177# define OFFSET_RBR 0x20 /* Receive Buffer register */
178# define OFFSET_THR 0x24 /* Transmit Holding register */
179#elif defined(BFIN_UART_BF54X_STYLE)
113# define OFFSET_DLL 0x00 /* Divisor Latch (Low-Byte) */ 180# define OFFSET_DLL 0x00 /* Divisor Latch (Low-Byte) */
114# define OFFSET_DLH 0x04 /* Divisor Latch (High-Byte) */ 181# define OFFSET_DLH 0x04 /* Divisor Latch (High-Byte) */
115# define OFFSET_GCTL 0x08 /* Global Control Register */ 182# define OFFSET_GCTL 0x08 /* Global Control Register */
@@ -145,7 +212,23 @@ struct bfin_serial_port {
145 */ 212 */
146#define __BFP(m) u16 m; u16 __pad_##m 213#define __BFP(m) u16 m; u16 __pad_##m
147struct bfin_uart_regs { 214struct bfin_uart_regs {
148#ifdef BFIN_UART_BF54X_STYLE 215#if defined(BFIN_UART_BF60X_STYLE)
216 u32 revid;
217 u32 ctl;
218 u32 stat;
219 u32 scr;
220 u32 clk;
221 u32 ier;
222 u32 ier_set;
223 u32 ier_clear;
224 u32 rbr;
225 u32 thr;
226 u32 taip;
227 u32 tsr;
228 u32 rsr;
229 u32 txdiv;
230 u32 rxdiv;
231#elif defined(BFIN_UART_BF54X_STYLE)
149 __BFP(dll); 232 __BFP(dll);
150 __BFP(dlh); 233 __BFP(dlh);
151 __BFP(gctl); 234 __BFP(gctl);
@@ -182,13 +265,58 @@ struct bfin_uart_regs {
182}; 265};
183#undef __BFP 266#undef __BFP
184 267
268#define port_membase(uart) (((struct bfin_serial_port *)(uart))->port.membase)
269
270/*
185#ifndef port_membase 271#ifndef port_membase
186# define port_membase(p) 0 272# define port_membase(p) 0
187#endif 273#endif
274*/
275#ifdef BFIN_UART_BF60X_STYLE
276
277#define UART_GET_CHAR(p) bfin_read32(port_membase(p) + OFFSET_RBR)
278#define UART_GET_CLK(p) bfin_read32(port_membase(p) + OFFSET_CLK)
279#define UART_GET_CTL(p) bfin_read32(port_membase(p) + OFFSET_CTL)
280#define UART_GET_GCTL(p) UART_GET_CTL(p)
281#define UART_GET_LCR(p) UART_GET_CTL(p)
282#define UART_GET_MCR(p) UART_GET_CTL(p)
283#define UART_GET_STAT(p) bfin_read32(port_membase(p) + OFFSET_STAT)
284#define UART_GET_MSR(p) UART_GET_STAT(p)
285
286#define UART_PUT_CHAR(p, v) bfin_write32(port_membase(p) + OFFSET_THR, v)
287#define UART_PUT_CLK(p, v) bfin_write32(port_membase(p) + OFFSET_CLK, v)
288#define UART_PUT_CTL(p, v) bfin_write32(port_membase(p) + OFFSET_CTL, v)
289#define UART_PUT_GCTL(p, v) UART_PUT_CTL(p, v)
290#define UART_PUT_LCR(p, v) UART_PUT_CTL(p, v)
291#define UART_PUT_MCR(p, v) UART_PUT_CTL(p, v)
292#define UART_PUT_STAT(p, v) bfin_write32(port_membase(p) + OFFSET_STAT, v)
293
294#define UART_CLEAR_IER(p, v) bfin_write32(port_membase(p) + OFFSET_IER_CLEAR, v)
295#define UART_GET_IER(p) bfin_read32(port_membase(p) + OFFSET_IER)
296#define UART_SET_IER(p, v) bfin_write32(port_membase(p) + OFFSET_IER_SET, v)
297
298#define UART_CLEAR_DLAB(p) /* MMRs not muxed on BF60x */
299#define UART_SET_DLAB(p) /* MMRs not muxed on BF60x */
300
301#define UART_CLEAR_LSR(p) UART_PUT_STAT(p, -1)
302#define UART_GET_LSR(p) UART_GET_STAT(p)
303#define UART_PUT_LSR(p, v) UART_PUT_STAT(p, v)
304
305/* This handles hard CTS/RTS */
306#define BFIN_UART_CTSRTS_HARD
307#define UART_CLEAR_SCTS(p) UART_PUT_STAT(p, SCTS)
308#define UART_GET_CTS(x) (UART_GET_MSR(x) & CTS)
309#define UART_DISABLE_RTS(x) UART_PUT_MCR(x, UART_GET_MCR(x) & ~(ARTS | MRTS))
310#define UART_ENABLE_RTS(x) UART_PUT_MCR(x, UART_GET_MCR(x) | MRTS | ARTS)
311#define UART_ENABLE_INTS(x, v) UART_SET_IER(x, v)
312#define UART_DISABLE_INTS(x) UART_CLEAR_IER(x, 0xF)
313
314#else /* BFIN_UART_BF60X_STYLE */
188 315
189#define UART_GET_CHAR(p) bfin_read16(port_membase(p) + OFFSET_RBR) 316#define UART_GET_CHAR(p) bfin_read16(port_membase(p) + OFFSET_RBR)
190#define UART_GET_DLL(p) bfin_read16(port_membase(p) + OFFSET_DLL) 317#define UART_GET_DLL(p) bfin_read16(port_membase(p) + OFFSET_DLL)
191#define UART_GET_DLH(p) bfin_read16(port_membase(p) + OFFSET_DLH) 318#define UART_GET_DLH(p) bfin_read16(port_membase(p) + OFFSET_DLH)
319#define UART_GET_CLK(p) ((UART_GET_DLH(p) << 8) | UART_GET_DLL(p))
192#define UART_GET_GCTL(p) bfin_read16(port_membase(p) + OFFSET_GCTL) 320#define UART_GET_GCTL(p) bfin_read16(port_membase(p) + OFFSET_GCTL)
193#define UART_GET_LCR(p) bfin_read16(port_membase(p) + OFFSET_LCR) 321#define UART_GET_LCR(p) bfin_read16(port_membase(p) + OFFSET_LCR)
194#define UART_GET_MCR(p) bfin_read16(port_membase(p) + OFFSET_MCR) 322#define UART_GET_MCR(p) bfin_read16(port_membase(p) + OFFSET_MCR)
@@ -197,6 +325,11 @@ struct bfin_uart_regs {
197#define UART_PUT_CHAR(p, v) bfin_write16(port_membase(p) + OFFSET_THR, v) 325#define UART_PUT_CHAR(p, v) bfin_write16(port_membase(p) + OFFSET_THR, v)
198#define UART_PUT_DLL(p, v) bfin_write16(port_membase(p) + OFFSET_DLL, v) 326#define UART_PUT_DLL(p, v) bfin_write16(port_membase(p) + OFFSET_DLL, v)
199#define UART_PUT_DLH(p, v) bfin_write16(port_membase(p) + OFFSET_DLH, v) 327#define UART_PUT_DLH(p, v) bfin_write16(port_membase(p) + OFFSET_DLH, v)
328#define UART_PUT_CLK(p, v) do \
329{\
330UART_PUT_DLL(p, v & 0xFF); \
331UART_PUT_DLH(p, (v >> 8) & 0xFF); } while (0);
332
200#define UART_PUT_GCTL(p, v) bfin_write16(port_membase(p) + OFFSET_GCTL, v) 333#define UART_PUT_GCTL(p, v) bfin_write16(port_membase(p) + OFFSET_GCTL, v)
201#define UART_PUT_LCR(p, v) bfin_write16(port_membase(p) + OFFSET_LCR, v) 334#define UART_PUT_LCR(p, v) bfin_write16(port_membase(p) + OFFSET_LCR, v)
202#define UART_PUT_MCR(p, v) bfin_write16(port_membase(p) + OFFSET_MCR, v) 335#define UART_PUT_MCR(p, v) bfin_write16(port_membase(p) + OFFSET_MCR, v)
@@ -233,12 +366,17 @@ struct bfin_uart_regs {
233#define UART_CLEAR_DLAB(p) do { UART_PUT_LCR(p, UART_GET_LCR(p) & ~DLAB); SSYNC(); } while (0) 366#define UART_CLEAR_DLAB(p) do { UART_PUT_LCR(p, UART_GET_LCR(p) & ~DLAB); SSYNC(); } while (0)
234#define UART_SET_DLAB(p) do { UART_PUT_LCR(p, UART_GET_LCR(p) | DLAB); SSYNC(); } while (0) 367#define UART_SET_DLAB(p) do { UART_PUT_LCR(p, UART_GET_LCR(p) | DLAB); SSYNC(); } while (0)
235 368
369#define get_lsr_cache(uart) (((struct bfin_serial_port *)(uart))->lsr)
370#define put_lsr_cache(uart, v) (((struct bfin_serial_port *)(uart))->lsr = (v))
371
372/*
236#ifndef put_lsr_cache 373#ifndef put_lsr_cache
237# define put_lsr_cache(p, v) 374# define put_lsr_cache(p, v)
238#endif 375#endif
239#ifndef get_lsr_cache 376#ifndef get_lsr_cache
240# define get_lsr_cache(p) 0 377# define get_lsr_cache(p) 0
241#endif 378#endif
379*/
242 380
243/* The hardware clears the LSR bits upon read, so we need to cache 381/* The hardware clears the LSR bits upon read, so we need to cache
244 * some of the more fun bits in software so they don't get lost 382 * some of the more fun bits in software so they don't get lost
@@ -267,7 +405,9 @@ static inline void UART_PUT_LSR(void *p, uint16_t val)
267#define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v) 405#define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v)
268#define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0) 406#define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0)
269 407
270#endif 408#endif /* BFIN_UART_BF54X_STYLE */
409
410#endif /* BFIN_UART_BF60X_STYLE */
271 411
272#ifndef BFIN_UART_TX_FIFO_SIZE 412#ifndef BFIN_UART_TX_FIFO_SIZE
273# define BFIN_UART_TX_FIFO_SIZE 2 413# define BFIN_UART_TX_FIFO_SIZE 2
diff --git a/arch/blackfin/include/asm/dma.h b/arch/blackfin/include/asm/dma.h
index dac0c97242bb..40e9c2bbc6e3 100644
--- a/arch/blackfin/include/asm/dma.h
+++ b/arch/blackfin/include/asm/dma.h
@@ -22,12 +22,22 @@
22#define DATA_SIZE_8 0 22#define DATA_SIZE_8 0
23#define DATA_SIZE_16 1 23#define DATA_SIZE_16 1
24#define DATA_SIZE_32 2 24#define DATA_SIZE_32 2
25#ifdef CONFIG_BF60x
26#define DATA_SIZE_64 3
27#endif
25 28
26#define DMA_FLOW_STOP 0 29#define DMA_FLOW_STOP 0
27#define DMA_FLOW_AUTO 1 30#define DMA_FLOW_AUTO 1
31#ifdef CONFIG_BF60x
32#define DMA_FLOW_LIST 4
33#define DMA_FLOW_ARRAY 5
34#define DMA_FLOW_LIST_DEMAND 6
35#define DMA_FLOW_ARRAY_DEMAND 7
36#else
28#define DMA_FLOW_ARRAY 4 37#define DMA_FLOW_ARRAY 4
29#define DMA_FLOW_SMALL 6 38#define DMA_FLOW_SMALL 6
30#define DMA_FLOW_LARGE 7 39#define DMA_FLOW_LARGE 7
40#endif
31 41
32#define DIMENSION_LINEAR 0 42#define DIMENSION_LINEAR 0
33#define DIMENSION_2D 1 43#define DIMENSION_2D 1
@@ -36,26 +46,80 @@
36#define DIR_WRITE 1 46#define DIR_WRITE 1
37 47
38#define INTR_DISABLE 0 48#define INTR_DISABLE 0
49#ifdef CONFIG_BF60x
50#define INTR_ON_PERI 1
51#endif
39#define INTR_ON_BUF 2 52#define INTR_ON_BUF 2
40#define INTR_ON_ROW 3 53#define INTR_ON_ROW 3
41 54
42#define DMA_NOSYNC_KEEP_DMA_BUF 0 55#define DMA_NOSYNC_KEEP_DMA_BUF 0
43#define DMA_SYNC_RESTART 1 56#define DMA_SYNC_RESTART 1
44 57
58#ifdef DMA_MMR_SIZE_32
59#define DMA_MMR_SIZE_TYPE long
60#define DMA_MMR_READ bfin_read32
61#define DMA_MMR_WRITE bfin_write32
62#else
63#define DMA_MMR_SIZE_TYPE short
64#define DMA_MMR_READ bfin_read16
65#define DMA_MMR_WRITE bfin_write16
66#endif
67
68struct dma_desc_array {
69 unsigned long start_addr;
70 unsigned DMA_MMR_SIZE_TYPE cfg;
71 unsigned DMA_MMR_SIZE_TYPE x_count;
72 DMA_MMR_SIZE_TYPE x_modify;
73} __attribute__((packed));
74
45struct dmasg { 75struct dmasg {
46 void *next_desc_addr; 76 void *next_desc_addr;
47 unsigned long start_addr; 77 unsigned long start_addr;
48 unsigned short cfg; 78 unsigned DMA_MMR_SIZE_TYPE cfg;
49 unsigned short x_count; 79 unsigned DMA_MMR_SIZE_TYPE x_count;
50 short x_modify; 80 DMA_MMR_SIZE_TYPE x_modify;
51 unsigned short y_count; 81 unsigned DMA_MMR_SIZE_TYPE y_count;
52 short y_modify; 82 DMA_MMR_SIZE_TYPE y_modify;
53} __attribute__((packed)); 83} __attribute__((packed));
54 84
55struct dma_register { 85struct dma_register {
56 void *next_desc_ptr; /* DMA Next Descriptor Pointer register */ 86 void *next_desc_ptr; /* DMA Next Descriptor Pointer register */
57 unsigned long start_addr; /* DMA Start address register */ 87 unsigned long start_addr; /* DMA Start address register */
88#ifdef CONFIG_BF60x
89 unsigned long cfg; /* DMA Configuration register */
58 90
91 unsigned long x_count; /* DMA x_count register */
92
93 long x_modify; /* DMA x_modify register */
94
95 unsigned long y_count; /* DMA y_count register */
96
97 long y_modify; /* DMA y_modify register */
98
99 unsigned long reserved;
100 unsigned long reserved2;
101
102 void *curr_desc_ptr; /* DMA Current Descriptor Pointer
103 register */
104 void *prev_desc_ptr; /* DMA previous initial Descriptor Pointer
105 register */
106 unsigned long curr_addr_ptr; /* DMA Current Address Pointer
107 register */
108 unsigned long irq_status; /* DMA irq status register */
109
110 unsigned long curr_x_count; /* DMA Current x-count register */
111
112 unsigned long curr_y_count; /* DMA Current y-count register */
113
114 unsigned long reserved3;
115
116 unsigned long bw_limit_count; /* DMA band width limit count register */
117 unsigned long curr_bw_limit_count; /* DMA Current band width limit
118 count register */
119 unsigned long bw_monitor_count; /* DMA band width limit count register */
120 unsigned long curr_bw_monitor_count; /* DMA Current band width limit
121 count register */
122#else
59 unsigned short cfg; /* DMA Configuration register */ 123 unsigned short cfg; /* DMA Configuration register */
60 unsigned short dummy1; /* DMA Configuration register */ 124 unsigned short dummy1; /* DMA Configuration register */
61 125
@@ -92,6 +156,7 @@ struct dma_register {
92 unsigned short dummy9; 156 unsigned short dummy9;
93 157
94 unsigned long reserved3; 158 unsigned long reserved3;
159#endif
95 160
96}; 161};
97 162
@@ -131,23 +196,23 @@ static inline void set_dma_curr_desc_addr(unsigned int channel, void *addr)
131{ 196{
132 dma_ch[channel].regs->curr_desc_ptr = addr; 197 dma_ch[channel].regs->curr_desc_ptr = addr;
133} 198}
134static inline void set_dma_x_count(unsigned int channel, unsigned short x_count) 199static inline void set_dma_x_count(unsigned int channel, unsigned DMA_MMR_SIZE_TYPE x_count)
135{ 200{
136 dma_ch[channel].regs->x_count = x_count; 201 dma_ch[channel].regs->x_count = x_count;
137} 202}
138static inline void set_dma_y_count(unsigned int channel, unsigned short y_count) 203static inline void set_dma_y_count(unsigned int channel, unsigned DMA_MMR_SIZE_TYPE y_count)
139{ 204{
140 dma_ch[channel].regs->y_count = y_count; 205 dma_ch[channel].regs->y_count = y_count;
141} 206}
142static inline void set_dma_x_modify(unsigned int channel, short x_modify) 207static inline void set_dma_x_modify(unsigned int channel, DMA_MMR_SIZE_TYPE x_modify)
143{ 208{
144 dma_ch[channel].regs->x_modify = x_modify; 209 dma_ch[channel].regs->x_modify = x_modify;
145} 210}
146static inline void set_dma_y_modify(unsigned int channel, short y_modify) 211static inline void set_dma_y_modify(unsigned int channel, DMA_MMR_SIZE_TYPE y_modify)
147{ 212{
148 dma_ch[channel].regs->y_modify = y_modify; 213 dma_ch[channel].regs->y_modify = y_modify;
149} 214}
150static inline void set_dma_config(unsigned int channel, unsigned short config) 215static inline void set_dma_config(unsigned int channel, unsigned DMA_MMR_SIZE_TYPE config)
151{ 216{
152 dma_ch[channel].regs->cfg = config; 217 dma_ch[channel].regs->cfg = config;
153} 218}
@@ -156,23 +221,55 @@ static inline void set_dma_curr_addr(unsigned int channel, unsigned long addr)
156 dma_ch[channel].regs->curr_addr_ptr = addr; 221 dma_ch[channel].regs->curr_addr_ptr = addr;
157} 222}
158 223
159static inline unsigned short 224#ifdef CONFIG_BF60x
225static inline unsigned long
226set_bfin_dma_config2(char direction, char flow_mode, char intr_mode,
227 char dma_mode, char mem_width, char syncmode, char peri_width)
228{
229 unsigned long config = 0;
230
231 switch (intr_mode) {
232 case INTR_ON_BUF:
233 if (dma_mode == DIMENSION_2D)
234 config = DI_EN_Y;
235 else
236 config = DI_EN_X;
237 break;
238 case INTR_ON_ROW:
239 config = DI_EN_X;
240 break;
241 case INTR_ON_PERI:
242 config = DI_EN_P;
243 break;
244 };
245
246 return config | (direction << 1) | (mem_width << 8) | (dma_mode << 26) |
247 (flow_mode << 12) | (syncmode << 2) | (peri_width << 4);
248}
249#endif
250
251static inline unsigned DMA_MMR_SIZE_TYPE
160set_bfin_dma_config(char direction, char flow_mode, 252set_bfin_dma_config(char direction, char flow_mode,
161 char intr_mode, char dma_mode, char width, char syncmode) 253 char intr_mode, char dma_mode, char mem_width, char syncmode)
162{ 254{
163 return (direction << 1) | (width << 2) | (dma_mode << 4) | 255#ifdef CONFIG_BF60x
256 return set_bfin_dma_config2(direction, flow_mode, intr_mode, dma_mode,
257 mem_width, syncmode, mem_width);
258#else
259 return (direction << 1) | (mem_width << 2) | (dma_mode << 4) |
164 (intr_mode << 6) | (flow_mode << 12) | (syncmode << 5); 260 (intr_mode << 6) | (flow_mode << 12) | (syncmode << 5);
261#endif
165} 262}
166 263
167static inline unsigned short get_dma_curr_irqstat(unsigned int channel) 264static inline unsigned DMA_MMR_SIZE_TYPE get_dma_curr_irqstat(unsigned int channel)
168{ 265{
169 return dma_ch[channel].regs->irq_status; 266 return dma_ch[channel].regs->irq_status;
170} 267}
171static inline unsigned short get_dma_curr_xcount(unsigned int channel) 268static inline unsigned DMA_MMR_SIZE_TYPE get_dma_curr_xcount(unsigned int channel)
172{ 269{
173 return dma_ch[channel].regs->curr_x_count; 270 return dma_ch[channel].regs->curr_x_count;
174} 271}
175static inline unsigned short get_dma_curr_ycount(unsigned int channel) 272static inline unsigned DMA_MMR_SIZE_TYPE get_dma_curr_ycount(unsigned int channel)
176{ 273{
177 return dma_ch[channel].regs->curr_y_count; 274 return dma_ch[channel].regs->curr_y_count;
178} 275}
@@ -184,7 +281,7 @@ static inline void *get_dma_curr_desc_ptr(unsigned int channel)
184{ 281{
185 return dma_ch[channel].regs->curr_desc_ptr; 282 return dma_ch[channel].regs->curr_desc_ptr;
186} 283}
187static inline unsigned short get_dma_config(unsigned int channel) 284static inline unsigned DMA_MMR_SIZE_TYPE get_dma_config(unsigned int channel)
188{ 285{
189 return dma_ch[channel].regs->cfg; 286 return dma_ch[channel].regs->cfg;
190} 287}
@@ -203,8 +300,8 @@ static inline void set_dma_sg(unsigned int channel, struct dmasg *sg, int ndsize
203 300
204 dma_ch[channel].regs->next_desc_ptr = sg; 301 dma_ch[channel].regs->next_desc_ptr = sg;
205 dma_ch[channel].regs->cfg = 302 dma_ch[channel].regs->cfg =
206 (dma_ch[channel].regs->cfg & ~(0xf << 8)) | 303 (dma_ch[channel].regs->cfg & ~NDSIZE) |
207 ((ndsize & 0xf) << 8); 304 ((ndsize << NDSIZE_OFFSET) & NDSIZE);
208} 305}
209 306
210static inline int dma_channel_active(unsigned int channel) 307static inline int dma_channel_active(unsigned int channel)
@@ -239,7 +336,7 @@ static inline void dma_enable_irq(unsigned int channel)
239} 336}
240static inline void clear_dma_irqstat(unsigned int channel) 337static inline void clear_dma_irqstat(unsigned int channel)
241{ 338{
242 dma_ch[channel].regs->irq_status = DMA_DONE | DMA_ERR; 339 dma_ch[channel].regs->irq_status = DMA_DONE | DMA_ERR | DMA_PIRQ;
243} 340}
244 341
245void *dma_memcpy(void *dest, const void *src, size_t count); 342void *dma_memcpy(void *dest, const void *src, size_t count);
diff --git a/arch/blackfin/include/asm/fixed_code.h b/arch/blackfin/include/asm/fixed_code.h
index 73fe53e7fd24..5395088b2d0e 100644
--- a/arch/blackfin/include/asm/fixed_code.h
+++ b/arch/blackfin/include/asm/fixed_code.h
@@ -29,24 +29,28 @@ extern void sigreturn_stub(void);
29#endif 29#endif
30#endif 30#endif
31 31
32#define FIXED_CODE_START 0x400 32#ifndef CONFIG_PHY_RAM_BASE_ADDRESS
33#define CONFIG_PHY_RAM_BASE_ADDRESS 0x0
34#endif
35
36#define FIXED_CODE_START (CONFIG_PHY_RAM_BASE_ADDRESS + 0x400)
33 37
34#define SIGRETURN_STUB 0x400 38#define SIGRETURN_STUB (CONFIG_PHY_RAM_BASE_ADDRESS + 0x400)
35 39
36#define ATOMIC_SEQS_START 0x410 40#define ATOMIC_SEQS_START (CONFIG_PHY_RAM_BASE_ADDRESS + 0x410)
37 41
38#define ATOMIC_XCHG32 0x410 42#define ATOMIC_XCHG32 (CONFIG_PHY_RAM_BASE_ADDRESS + 0x410)
39#define ATOMIC_CAS32 0x420 43#define ATOMIC_CAS32 (CONFIG_PHY_RAM_BASE_ADDRESS + 0x420)
40#define ATOMIC_ADD32 0x430 44#define ATOMIC_ADD32 (CONFIG_PHY_RAM_BASE_ADDRESS + 0x430)
41#define ATOMIC_SUB32 0x440 45#define ATOMIC_SUB32 (CONFIG_PHY_RAM_BASE_ADDRESS + 0x440)
42#define ATOMIC_IOR32 0x450 46#define ATOMIC_IOR32 (CONFIG_PHY_RAM_BASE_ADDRESS + 0x450)
43#define ATOMIC_AND32 0x460 47#define ATOMIC_AND32 (CONFIG_PHY_RAM_BASE_ADDRESS + 0x460)
44#define ATOMIC_XOR32 0x470 48#define ATOMIC_XOR32 (CONFIG_PHY_RAM_BASE_ADDRESS + 0x470)
45 49
46#define ATOMIC_SEQS_END 0x480 50#define ATOMIC_SEQS_END (CONFIG_PHY_RAM_BASE_ADDRESS + 0x480)
47 51
48#define SAFE_USER_INSTRUCTION 0x480 52#define SAFE_USER_INSTRUCTION (CONFIG_PHY_RAM_BASE_ADDRESS + 0x480)
49 53
50#define FIXED_CODE_END 0x490 54#define FIXED_CODE_END (CONFIG_PHY_RAM_BASE_ADDRESS + 0x490)
51 55
52#endif 56#endif
diff --git a/arch/blackfin/include/asm/page.h b/arch/blackfin/include/asm/page.h
index 7202404966f6..b93474d5be75 100644
--- a/arch/blackfin/include/asm/page.h
+++ b/arch/blackfin/include/asm/page.h
@@ -7,14 +7,15 @@
7#ifndef _BLACKFIN_PAGE_H 7#ifndef _BLACKFIN_PAGE_H
8#define _BLACKFIN_PAGE_H 8#define _BLACKFIN_PAGE_H
9 9
10#include <asm-generic/page.h> 10#define ARCH_PFN_OFFSET (CONFIG_PHY_RAM_BASE_ADDRESS >> PAGE_SHIFT)
11#define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT) 11#define MAP_NR(addr) ((unsigned long)(addr) >> PAGE_SHIFT)
12 12
13#define VM_DATA_DEFAULT_FLAGS \ 13#define VM_DATA_DEFAULT_FLAGS \
14 (VM_READ | VM_WRITE | \ 14 (VM_READ | VM_WRITE | \
15 ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \ 15 ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
16 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 16 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
17 17
18#include <asm-generic/page.h>
18#include <asm-generic/memory_model.h> 19#include <asm-generic/memory_model.h>
19#include <asm-generic/getorder.h> 20#include <asm-generic/getorder.h>
20 21
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;
diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S
index 4698a9800522..84b5e3dbbcc8 100644
--- a/arch/blackfin/mach-common/entry.S
+++ b/arch/blackfin/mach-common/entry.S
@@ -1141,7 +1141,8 @@ ENTRY(_schedule_and_signal_from_int)
1141 sti r0; 1141 sti r0;
1142 1142
1143 /* finish the userspace "atomic" functions for it */ 1143 /* finish the userspace "atomic" functions for it */
1144 r1 = FIXED_CODE_END; 1144 r1.l = lo(FIXED_CODE_END);
1145 r1.h = hi(FIXED_CODE_END);
1145 r2 = [sp + PT_PC]; 1146 r2 = [sp + PT_PC];
1146 cc = r1 <= r2; 1147 cc = r1 <= r2;
1147 if cc jump .Lresume_userspace (bp); 1148 if cc jump .Lresume_userspace (bp);
diff --git a/arch/blackfin/mach-common/head.S b/arch/blackfin/mach-common/head.S
index 8b4d98854403..31515f0146f9 100644
--- a/arch/blackfin/mach-common/head.S
+++ b/arch/blackfin/mach-common/head.S
@@ -210,14 +210,12 @@ ENDPROC(__start)
210ENTRY(_real_start) 210ENTRY(_real_start)
211 /* Enable nested interrupts */ 211 /* Enable nested interrupts */
212 [--sp] = reti; 212 [--sp] = reti;
213
214 /* watchdog off for now */ 213 /* watchdog off for now */
215 p0.l = lo(WDOG_CTL); 214 p0.l = lo(WDOG_CTL);
216 p0.h = hi(WDOG_CTL); 215 p0.h = hi(WDOG_CTL);
217 r0 = 0xAD6(z); 216 r0 = 0xAD6(z);
218 w[p0] = r0; 217 w[p0] = r0;
219 ssync; 218 ssync;
220
221 /* Pass the u-boot arguments to the global value command line */ 219 /* Pass the u-boot arguments to the global value command line */
222 R0 = R7; 220 R0 = R7;
223 call _cmdline_init; 221 call _cmdline_init;
diff --git a/arch/blackfin/mm/init.c b/arch/blackfin/mm/init.c
index 78daae084915..9cb85537bd2b 100644
--- a/arch/blackfin/mm/init.c
+++ b/arch/blackfin/mm/init.c
@@ -48,7 +48,7 @@ void __init paging_init(void)
48 48
49 unsigned long zones_size[MAX_NR_ZONES] = { 49 unsigned long zones_size[MAX_NR_ZONES] = {
50 [0] = 0, 50 [0] = 0,
51 [ZONE_DMA] = (end_mem - PAGE_OFFSET) >> PAGE_SHIFT, 51 [ZONE_DMA] = (end_mem - CONFIG_PHY_RAM_BASE_ADDRESS) >> PAGE_SHIFT,
52 [ZONE_NORMAL] = 0, 52 [ZONE_NORMAL] = 0,
53#ifdef CONFIG_HIGHMEM 53#ifdef CONFIG_HIGHMEM
54 [ZONE_HIGHMEM] = 0, 54 [ZONE_HIGHMEM] = 0,
@@ -60,7 +60,8 @@ void __init paging_init(void)
60 60
61 pr_debug("free_area_init -> start_mem is %#lx virtual_end is %#lx\n", 61 pr_debug("free_area_init -> start_mem is %#lx virtual_end is %#lx\n",
62 PAGE_ALIGN(memory_start), end_mem); 62 PAGE_ALIGN(memory_start), end_mem);
63 free_area_init(zones_size); 63 free_area_init_node(0, zones_size,
64 CONFIG_PHY_RAM_BASE_ADDRESS >> PAGE_SHIFT, NULL);
64} 65}
65 66
66asmlinkage void __init init_pda(void) 67asmlinkage void __init init_pda(void)
@@ -75,9 +76,6 @@ asmlinkage void __init init_pda(void)
75 valid pointers to it. */ 76 valid pointers to it. */
76 memset(&cpu_pda[cpu], 0, sizeof(cpu_pda[cpu])); 77 memset(&cpu_pda[cpu], 0, sizeof(cpu_pda[cpu]));
77 78
78 cpu_pda[0].next = &cpu_pda[1];
79 cpu_pda[1].next = &cpu_pda[0];
80
81#ifdef CONFIG_EXCEPTION_L1_SCRATCH 79#ifdef CONFIG_EXCEPTION_L1_SCRATCH
82 cpu_pda[cpu].ex_stack = (unsigned long *)(L1_SCRATCH_START + \ 80 cpu_pda[cpu].ex_stack = (unsigned long *)(L1_SCRATCH_START + \
83 L1_SCRATCH_LENGTH); 81 L1_SCRATCH_LENGTH);
@@ -109,10 +107,10 @@ void __init mem_init(void)
109 totalram_pages = free_all_bootmem(); 107 totalram_pages = free_all_bootmem();
110 108
111 reservedpages = 0; 109 reservedpages = 0;
112 for (tmp = 0; tmp < max_mapnr; tmp++) 110 for (tmp = ARCH_PFN_OFFSET; tmp < max_mapnr; tmp++)
113 if (PageReserved(pfn_to_page(tmp))) 111 if (PageReserved(pfn_to_page(tmp)))
114 reservedpages++; 112 reservedpages++;
115 freepages = max_mapnr - reservedpages; 113 freepages = max_mapnr - ARCH_PFN_OFFSET - reservedpages;
116 114
117 /* do not count in kernel image between _rambase and _ramstart */ 115 /* do not count in kernel image between _rambase and _ramstart */
118 reservedpages -= (_ramstart - _rambase) >> PAGE_SHIFT; 116 reservedpages -= (_ramstart - _rambase) >> PAGE_SHIFT;
@@ -127,7 +125,7 @@ void __init mem_init(void)
127 printk(KERN_INFO 125 printk(KERN_INFO
128 "Memory available: %luk/%luk RAM, " 126 "Memory available: %luk/%luk RAM, "
129 "(%uk init code, %uk kernel code, %uk data, %uk dma, %uk reserved)\n", 127 "(%uk init code, %uk kernel code, %uk data, %uk dma, %uk reserved)\n",
130 (unsigned long) freepages << (PAGE_SHIFT-10), _ramend >> 10, 128 (unsigned long) freepages << (PAGE_SHIFT-10), (_ramend - CONFIG_PHY_RAM_BASE_ADDRESS) >> 10,
131 initk, codek, datak, DMA_UNCACHED_REGION >> 10, (reservedpages << (PAGE_SHIFT-10))); 129 initk, codek, datak, DMA_UNCACHED_REGION >> 10, (reservedpages << (PAGE_SHIFT-10)));
132} 130}
133 131