[brcm2708] adds target used by rapsberry pi
[openwrt.git] / target / linux / brcm2708 / patches-3.3 / 0500-rpi-patches-geaf792a-9efb4705.patch
1 --- a/arch/arm/configs/bcmrpi_cutdown_defconfig
2 +++ b/arch/arm/configs/bcmrpi_cutdown_defconfig
3 @@ -1,1307 +1,436 @@
4 -#
5 -# Automatically generated file; DO NOT EDIT.
6 -# Linux/arm 3.1.9 Kernel Configuration
7 -#
8 -CONFIG_ARM=y
9 -CONFIG_SYS_SUPPORTS_APM_EMULATION=y
10 -CONFIG_GENERIC_GPIO=y
11 -# CONFIG_ARCH_USES_GETTIMEOFFSET is not set
12 -CONFIG_GENERIC_CLOCKEVENTS=y
13 -CONFIG_KTIME_SCALAR=y
14 -CONFIG_HAVE_PROC_CPU=y
15 -CONFIG_STACKTRACE_SUPPORT=y
16 -CONFIG_HAVE_LATENCYTOP_SUPPORT=y
17 -CONFIG_LOCKDEP_SUPPORT=y
18 -CONFIG_TRACE_IRQFLAGS_SUPPORT=y
19 -CONFIG_HARDIRQS_SW_RESEND=y
20 -CONFIG_GENERIC_IRQ_PROBE=y
21 -CONFIG_RWSEM_GENERIC_SPINLOCK=y
22 -CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
23 -CONFIG_GENERIC_HWEIGHT=y
24 -CONFIG_GENERIC_CALIBRATE_DELAY=y
25 -CONFIG_NEED_DMA_MAP_STATE=y
26 -CONFIG_VECTORS_BASE=0xffff0000
27 -# CONFIG_ARM_PATCH_PHYS_VIRT is not set
28 -CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
29 -CONFIG_HAVE_IRQ_WORK=y
30 -
31 -#
32 -# General setup
33 -#
34  CONFIG_EXPERIMENTAL=y
35 -CONFIG_BROKEN_ON_SMP=y
36 -CONFIG_INIT_ENV_ARG_LIMIT=32
37 -CONFIG_CROSS_COMPILE=""
38 -CONFIG_LOCALVERSION=""
39  # CONFIG_LOCALVERSION_AUTO is not set
40 -CONFIG_HAVE_KERNEL_GZIP=y
41 -CONFIG_HAVE_KERNEL_LZMA=y
42 -CONFIG_HAVE_KERNEL_LZO=y
43 -CONFIG_KERNEL_GZIP=y
44 -# CONFIG_KERNEL_LZMA is not set
45 -# CONFIG_KERNEL_LZO is not set
46 -CONFIG_DEFAULT_HOSTNAME="(none)"
47 -CONFIG_SWAP=y
48  CONFIG_SYSVIPC=y
49 -CONFIG_SYSVIPC_SYSCTL=y
50  CONFIG_POSIX_MQUEUE=y
51 -CONFIG_POSIX_MQUEUE_SYSCTL=y
52 -# CONFIG_BSD_PROCESS_ACCT is not set
53 -# CONFIG_FHANDLE is not set
54 -# CONFIG_TASKSTATS is not set
55 -# CONFIG_AUDIT is not set
56 -CONFIG_HAVE_GENERIC_HARDIRQS=y
57 -
58 -#
59 -# IRQ subsystem
60 -#
61 -CONFIG_GENERIC_HARDIRQS=y
62 -CONFIG_HAVE_SPARSE_IRQ=y
63 -CONFIG_GENERIC_IRQ_SHOW=y
64 -# CONFIG_SPARSE_IRQ is not set
65 -
66 -#
67 -# RCU Subsystem
68 -#
69 -CONFIG_TINY_RCU=y
70 -# CONFIG_PREEMPT_RCU is not set
71 -# CONFIG_RCU_TRACE is not set
72 -# CONFIG_TREE_RCU_TRACE is not set
73  CONFIG_IKCONFIG=y
74  CONFIG_IKCONFIG_PROC=y
75 -CONFIG_LOG_BUF_SHIFT=17
76 -# CONFIG_CGROUPS is not set
77 -# CONFIG_NAMESPACES is not set
78 -# CONFIG_SCHED_AUTOGROUP is not set
79 -# CONFIG_SYSFS_DEPRECATED is not set
80 -# CONFIG_RELAY is not set
81 -# CONFIG_BLK_DEV_INITRD is not set
82 -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
83 -CONFIG_SYSCTL=y
84 -CONFIG_ANON_INODES=y
85 -CONFIG_EXPERT=y
86  # CONFIG_UID16 is not set
87 -CONFIG_SYSCTL_SYSCALL=y
88  # CONFIG_KALLSYMS is not set
89 -CONFIG_HOTPLUG=y
90 -CONFIG_PRINTK=y
91 -CONFIG_BUG=y
92 -# CONFIG_ELF_CORE is not set
93 -CONFIG_BASE_FULL=y
94 -CONFIG_FUTEX=y
95 -CONFIG_EPOLL=y
96 -CONFIG_SIGNALFD=y
97 -CONFIG_TIMERFD=y
98 -CONFIG_EVENTFD=y
99 -CONFIG_SHMEM=y
100 -CONFIG_AIO=y
101  CONFIG_EMBEDDED=y
102 -CONFIG_HAVE_PERF_EVENTS=y
103 -CONFIG_PERF_USE_VMALLOC=y
104 -
105 -#
106 -# Kernel Performance Events And Counters
107 -#
108 -# CONFIG_PERF_EVENTS is not set
109 -# CONFIG_PERF_COUNTERS is not set
110  # CONFIG_VM_EVENT_COUNTERS is not set
111  # CONFIG_COMPAT_BRK is not set
112  CONFIG_SLAB=y
113 -# CONFIG_SLUB is not set
114 -# CONFIG_SLOB is not set
115 -# CONFIG_PROFILING is not set
116 -CONFIG_HAVE_OPROFILE=y
117 -# CONFIG_KPROBES is not set
118 -CONFIG_HAVE_KPROBES=y
119 -CONFIG_HAVE_KRETPROBES=y
120 -CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
121 -CONFIG_HAVE_CLK=y
122 -CONFIG_HAVE_DMA_API_DEBUG=y
123 -
124 -#
125 -# GCOV-based kernel profiling
126 -#
127 -CONFIG_HAVE_GENERIC_DMA_COHERENT=y
128 -CONFIG_SLABINFO=y
129 -CONFIG_RT_MUTEXES=y
130 -CONFIG_BASE_SMALL=0
131  CONFIG_MODULES=y
132 -# CONFIG_MODULE_FORCE_LOAD is not set
133  CONFIG_MODULE_UNLOAD=y
134 -# CONFIG_MODULE_FORCE_UNLOAD is not set
135  CONFIG_MODVERSIONS=y
136  CONFIG_MODULE_SRCVERSION_ALL=y
137 -CONFIG_BLOCK=y
138 -CONFIG_LBDAF=y
139  # CONFIG_BLK_DEV_BSG is not set
140 -# CONFIG_BLK_DEV_BSGLIB is not set
141 -# CONFIG_BLK_DEV_INTEGRITY is not set
142 -
143 -#
144 -# IO Schedulers
145 -#
146 -CONFIG_IOSCHED_NOOP=y
147 -CONFIG_IOSCHED_DEADLINE=y
148 -CONFIG_IOSCHED_CFQ=y
149 -# CONFIG_DEFAULT_DEADLINE is not set
150 -CONFIG_DEFAULT_CFQ=y
151 -# CONFIG_DEFAULT_NOOP is not set
152 -CONFIG_DEFAULT_IOSCHED="cfq"
153 -# CONFIG_INLINE_SPIN_TRYLOCK is not set
154 -# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
155 -# CONFIG_INLINE_SPIN_LOCK is not set
156 -# CONFIG_INLINE_SPIN_LOCK_BH is not set
157 -# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
158 -# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
159 -CONFIG_INLINE_SPIN_UNLOCK=y
160 -# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
161 -CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
162 -# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
163 -# CONFIG_INLINE_READ_TRYLOCK is not set
164 -# CONFIG_INLINE_READ_LOCK is not set
165 -# CONFIG_INLINE_READ_LOCK_BH is not set
166 -# CONFIG_INLINE_READ_LOCK_IRQ is not set
167 -# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
168 -CONFIG_INLINE_READ_UNLOCK=y
169 -# CONFIG_INLINE_READ_UNLOCK_BH is not set
170 -CONFIG_INLINE_READ_UNLOCK_IRQ=y
171 -# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
172 -# CONFIG_INLINE_WRITE_TRYLOCK is not set
173 -# CONFIG_INLINE_WRITE_LOCK is not set
174 -# CONFIG_INLINE_WRITE_LOCK_BH is not set
175 -# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
176 -# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
177 -CONFIG_INLINE_WRITE_UNLOCK=y
178 -# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
179 -CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
180 -# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
181 -# CONFIG_MUTEX_SPIN_ON_OWNER is not set
182 -CONFIG_FREEZER=y
183 -
184 -#
185 -# System Type
186 -#
187 -CONFIG_MMU=y
188 -# CONFIG_ARCH_INTEGRATOR is not set
189 -# CONFIG_ARCH_REALVIEW is not set
190 -# CONFIG_ARCH_VERSATILE is not set
191 -# CONFIG_ARCH_VEXPRESS is not set
192 -# CONFIG_ARCH_AT91 is not set
193 -# CONFIG_ARCH_BCMRING is not set
194 -# CONFIG_ARCH_CLPS711X is not set
195 -# CONFIG_ARCH_CNS3XXX is not set
196 -# CONFIG_ARCH_GEMINI is not set
197 -# CONFIG_ARCH_PRIMA2 is not set
198 -# CONFIG_ARCH_EBSA110 is not set
199 -# CONFIG_ARCH_EP93XX is not set
200 -# CONFIG_ARCH_FOOTBRIDGE is not set
201 -# CONFIG_ARCH_MXC is not set
202 -# CONFIG_ARCH_MXS is not set
203 -# CONFIG_ARCH_NETX is not set
204 -# CONFIG_ARCH_H720X is not set
205 -# CONFIG_ARCH_IOP13XX is not set
206 -# CONFIG_ARCH_IOP32X is not set
207 -# CONFIG_ARCH_IOP33X is not set
208 -# CONFIG_ARCH_IXP23XX is not set
209 -# CONFIG_ARCH_IXP2000 is not set
210 -# CONFIG_ARCH_IXP4XX is not set
211 -# CONFIG_ARCH_DOVE is not set
212 -# CONFIG_ARCH_KIRKWOOD is not set
213 -# CONFIG_ARCH_LPC32XX is not set
214 -# CONFIG_ARCH_MV78XX0 is not set
215 -# CONFIG_ARCH_ORION5X is not set
216 -# CONFIG_ARCH_MMP is not set
217 -# CONFIG_ARCH_KS8695 is not set
218 -# CONFIG_ARCH_W90X900 is not set
219 -# CONFIG_ARCH_NUC93X is not set
220 -# CONFIG_ARCH_TEGRA is not set
221 -# CONFIG_ARCH_PNX4008 is not set
222 -# CONFIG_ARCH_PXA is not set
223 -# CONFIG_ARCH_MSM is not set
224 -# CONFIG_ARCH_SHMOBILE is not set
225 -# CONFIG_ARCH_RPC is not set
226 -# CONFIG_ARCH_SA1100 is not set
227 -# CONFIG_ARCH_S3C2410 is not set
228 -# CONFIG_ARCH_S3C64XX is not set
229 -# CONFIG_ARCH_S5P64X0 is not set
230 -# CONFIG_ARCH_S5PC100 is not set
231 -# CONFIG_ARCH_S5PV210 is not set
232 -# CONFIG_ARCH_EXYNOS4 is not set
233 -# CONFIG_ARCH_SHARK is not set
234 -# CONFIG_ARCH_TCC_926 is not set
235 -# CONFIG_ARCH_U300 is not set
236 -# CONFIG_ARCH_U8500 is not set
237 -# CONFIG_ARCH_NOMADIK is not set
238 -# CONFIG_ARCH_DAVINCI is not set
239 -# CONFIG_ARCH_OMAP is not set
240 -# CONFIG_PLAT_SPEAR is not set
241  CONFIG_ARCH_BCM2708=y
242 -# CONFIG_ARCH_VT8500 is not set
243 -# CONFIG_ARCH_ZYNQ is not set
244 -
245 -#
246 -# System MMU
247 -#
248 -
249 -#
250 -# Broadcom BCM2708 Implementations
251 -#
252 -CONFIG_MACH_BCM2708=y
253 -CONFIG_BCM2708_GPIO=y
254 -CONFIG_BCM2708_VCMEM=y
255 -
256 -#
257 -# Processor Type
258 -#
259 -CONFIG_CPU_V6=y
260 -CONFIG_CPU_32v6=y
261 -CONFIG_CPU_ABRT_EV6=y
262 -CONFIG_CPU_PABRT_V6=y
263 -CONFIG_CPU_CACHE_V6=y
264 -CONFIG_CPU_CACHE_VIPT=y
265 -CONFIG_CPU_COPY_V6=y
266 -CONFIG_CPU_TLB_V6=y
267 -CONFIG_CPU_HAS_ASID=y
268 -CONFIG_CPU_CP15=y
269 -CONFIG_CPU_CP15_MMU=y
270 -CONFIG_CPU_USE_DOMAINS=y
271 -
272 -#
273 -# Processor Features
274 -#
275 -CONFIG_ARM_THUMB=y
276 -# CONFIG_CPU_ICACHE_DISABLE is not set
277 -# CONFIG_CPU_DCACHE_DISABLE is not set
278 -# CONFIG_CPU_BPREDICT_DISABLE is not set
279 -CONFIG_ARM_L1_CACHE_SHIFT=5
280 -CONFIG_ARM_DMA_MEM_BUFFERABLE=y
281 -CONFIG_CPU_HAS_PMU=y
282 -CONFIG_ARM_ERRATA_411920=y
283 -# CONFIG_ARM_ERRATA_364296 is not set
284 -
285 -#
286 -# Bus support
287 -#
288 -CONFIG_ARM_AMBA=y
289 -# CONFIG_PCI_SYSCALL is not set
290 -# CONFIG_ARCH_SUPPORTS_MSI is not set
291 -# CONFIG_PCCARD is not set
292 -
293 -#
294 -# Kernel Features
295 -#
296 -CONFIG_TICK_ONESHOT=y
297  CONFIG_NO_HZ=y
298 -# CONFIG_HIGH_RES_TIMERS is not set
299 -CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
300 -CONFIG_VMSPLIT_3G=y
301 -# CONFIG_VMSPLIT_2G is not set
302 -# CONFIG_VMSPLIT_1G is not set
303 -CONFIG_PAGE_OFFSET=0xC0000000
304 -CONFIG_PREEMPT_NONE=y
305 -# CONFIG_PREEMPT_VOLUNTARY is not set
306 -# CONFIG_PREEMPT is not set
307 -CONFIG_HZ=100
308 +CONFIG_HIGH_RES_TIMERS=y
309  CONFIG_AEABI=y
310 -CONFIG_OABI_COMPAT=y
311 -# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
312 -# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
313 -CONFIG_HAVE_ARCH_PFN_VALID=y
314 -# CONFIG_HIGHMEM is not set
315 -CONFIG_SELECT_MEMORY_MODEL=y
316 -CONFIG_FLATMEM_MANUAL=y
317 -CONFIG_FLATMEM=y
318 -CONFIG_FLAT_NODE_MEM_MAP=y
319 -CONFIG_HAVE_MEMBLOCK=y
320 -CONFIG_PAGEFLAGS_EXTENDED=y
321 -CONFIG_SPLIT_PTLOCK_CPUS=4
322 -# CONFIG_COMPACTION is not set
323 -# CONFIG_PHYS_ADDR_T_64BIT is not set
324 -CONFIG_ZONE_DMA_FLAG=0
325 -CONFIG_VIRT_TO_BUS=y
326 -# CONFIG_KSM is not set
327 -CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
328 -CONFIG_NEED_PER_CPU_KM=y
329 -# CONFIG_CLEANCACHE is not set
330 -CONFIG_FORCE_MAX_ZONEORDER=11
331 -CONFIG_ALIGNMENT_TRAP=y
332 -# CONFIG_UACCESS_WITH_MEMCPY is not set
333 -# CONFIG_SECCOMP is not set
334 -# CONFIG_CC_STACKPROTECTOR is not set
335 -# CONFIG_DEPRECATED_PARAM_STRUCT is not set
336 -
337 -#
338 -# Boot options
339 -#
340 -# CONFIG_USE_OF is not set
341  CONFIG_ZBOOT_ROM_TEXT=0x0
342  CONFIG_ZBOOT_ROM_BSS=0x0
343  CONFIG_CMDLINE="dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext3 rootwait"
344 -CONFIG_CMDLINE_FROM_BOOTLOADER=y
345 -# CONFIG_CMDLINE_EXTEND is not set
346 -# CONFIG_CMDLINE_FORCE is not set
347 -# CONFIG_XIP_KERNEL is not set
348 -# CONFIG_KEXEC is not set
349 -# CONFIG_CRASH_DUMP is not set
350 -# CONFIG_AUTO_ZRELADDR is not set
351 -
352 -#
353 -# CPU Power Management
354 -#
355  CONFIG_CPU_IDLE=y
356 -CONFIG_CPU_IDLE_GOV_LADDER=y
357 -CONFIG_CPU_IDLE_GOV_MENU=y
358 -
359 -#
360 -# Floating point emulation
361 -#
362 -
363 -#
364 -# At least one emulation must be selected
365 -#
366 -# CONFIG_FPE_NWFPE is not set
367 -# CONFIG_FPE_FASTFPE is not set
368  CONFIG_VFP=y
369 -
370 -#
371 -# Userspace binary formats
372 -#
373 -CONFIG_BINFMT_ELF=y
374 -CONFIG_HAVE_AOUT=y
375 -# CONFIG_BINFMT_AOUT is not set
376 -# CONFIG_BINFMT_MISC is not set
377 -
378 -#
379 -# Power management options
380 -#
381 -CONFIG_SUSPEND=y
382 -CONFIG_SUSPEND_FREEZER=y
383 -CONFIG_PM_SLEEP=y
384 -# CONFIG_PM_RUNTIME is not set
385 -CONFIG_PM=y
386 -# CONFIG_PM_DEBUG is not set
387 -# CONFIG_APM_EMULATION is not set
388 -CONFIG_PM_CLK=y
389 -CONFIG_ARCH_SUSPEND_POSSIBLE=y
390 +CONFIG_BINFMT_MISC=m
391  CONFIG_NET=y
392 -
393 -#
394 -# Networking options
395 -#
396  CONFIG_PACKET=y
397  CONFIG_UNIX=y
398 -CONFIG_XFRM=y
399  CONFIG_XFRM_USER=y
400 -# CONFIG_XFRM_SUB_POLICY is not set
401 -# CONFIG_XFRM_MIGRATE is not set
402 -# CONFIG_XFRM_STATISTICS is not set
403  CONFIG_NET_KEY=m
404 -# CONFIG_NET_KEY_MIGRATE is not set
405  CONFIG_INET=y
406  CONFIG_IP_MULTICAST=y
407 -# CONFIG_IP_ADVANCED_ROUTER is not set
408  CONFIG_IP_PNP=y
409  CONFIG_IP_PNP_DHCP=y
410 -# CONFIG_IP_PNP_BOOTP is not set
411  CONFIG_IP_PNP_RARP=y
412 -# CONFIG_NET_IPIP is not set
413 -# CONFIG_NET_IPGRE_DEMUX is not set
414 -# CONFIG_IP_MROUTE is not set
415 -# CONFIG_ARPD is not set
416  CONFIG_SYN_COOKIES=y
417 -# CONFIG_INET_AH is not set
418 -# CONFIG_INET_ESP is not set
419 -# CONFIG_INET_IPCOMP is not set
420 -# CONFIG_INET_XFRM_TUNNEL is not set
421 -# CONFIG_INET_TUNNEL is not set
422  # CONFIG_INET_XFRM_MODE_TRANSPORT is not set
423  # CONFIG_INET_XFRM_MODE_TUNNEL is not set
424  # CONFIG_INET_XFRM_MODE_BEET is not set
425  # CONFIG_INET_LRO is not set
426  # CONFIG_INET_DIAG is not set
427 -# CONFIG_TCP_CONG_ADVANCED is not set
428 -CONFIG_TCP_CONG_CUBIC=y
429 -CONFIG_DEFAULT_TCP_CONG="cubic"
430 -# CONFIG_TCP_MD5SIG is not set
431  # CONFIG_IPV6 is not set
432 -# CONFIG_NETWORK_SECMARK is not set
433 -# CONFIG_NETWORK_PHY_TIMESTAMPING is not set
434 -# CONFIG_NETFILTER is not set
435 -# CONFIG_IP_DCCP is not set
436 -# CONFIG_IP_SCTP is not set
437 -# CONFIG_RDS is not set
438 -# CONFIG_TIPC is not set
439 -# CONFIG_ATM is not set
440 -# CONFIG_L2TP is not set
441 -# CONFIG_BRIDGE is not set
442 -# CONFIG_NET_DSA is not set
443 -# CONFIG_VLAN_8021Q is not set
444 -# CONFIG_DECNET is not set
445 -# CONFIG_LLC2 is not set
446 -# CONFIG_IPX is not set
447 -# CONFIG_ATALK is not set
448 -# CONFIG_X25 is not set
449 -# CONFIG_LAPB is not set
450 -# CONFIG_ECONET is not set
451 -# CONFIG_WAN_ROUTER is not set
452 -# CONFIG_PHONET is not set
453 -# CONFIG_IEEE802154 is not set
454 -# CONFIG_NET_SCHED is not set
455 -# CONFIG_DCB is not set
456 -CONFIG_DNS_RESOLVER=y
457 -# CONFIG_BATMAN_ADV is not set
458 -
459 -#
460 -# Network testing
461 -#
462  CONFIG_NET_PKTGEN=m
463 -# CONFIG_HAMRADIO is not set
464 -# CONFIG_CAN is not set
465 -# CONFIG_IRDA is not set
466 -# CONFIG_BT is not set
467 -# CONFIG_AF_RXRPC is not set
468 -CONFIG_WIRELESS=y
469 -CONFIG_WEXT_CORE=y
470 -CONFIG_WEXT_PROC=y
471 -CONFIG_CFG80211=y
472 -# CONFIG_NL80211_TESTMODE is not set
473 -# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set
474 -# CONFIG_CFG80211_REG_DEBUG is not set
475 -CONFIG_CFG80211_DEFAULT_PS=y
476 -# CONFIG_CFG80211_INTERNAL_REGDB is not set
477 -CONFIG_CFG80211_WEXT=y
478 -CONFIG_WIRELESS_EXT_SYSFS=y
479 -# CONFIG_LIB80211 is not set
480 -# CONFIG_MAC80211 is not set
481 -# CONFIG_WIMAX is not set
482 -# CONFIG_RFKILL is not set
483 -# CONFIG_NET_9P is not set
484 -# CONFIG_CAIF is not set
485 -# CONFIG_CEPH_LIB is not set
486 -# CONFIG_NFC is not set
487 -
488 -#
489 -# Device Drivers
490 -#
491 -
492 -#
493 -# Generic Driver Options
494 -#
495 -CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
496 -# CONFIG_DEVTMPFS is not set
497 -CONFIG_STANDALONE=y
498 -CONFIG_PREVENT_FIRMWARE_BUILD=y
499 -CONFIG_FW_LOADER=y
500 -CONFIG_FIRMWARE_IN_KERNEL=y
501 -CONFIG_EXTRA_FIRMWARE=""
502 -# CONFIG_DEBUG_DRIVER is not set
503 -# CONFIG_DEBUG_DEVRES is not set
504 -# CONFIG_SYS_HYPERVISOR is not set
505 -# CONFIG_CONNECTOR is not set
506 -# CONFIG_MTD is not set
507 -# CONFIG_PARPORT is not set
508 -CONFIG_BLK_DEV=y
509 -# CONFIG_BLK_DEV_COW_COMMON is not set
510 +CONFIG_IRDA=m
511 +CONFIG_IRLAN=m
512 +CONFIG_IRCOMM=m
513 +CONFIG_IRDA_ULTRA=y
514 +CONFIG_IRDA_CACHE_LAST_LSAP=y
515 +CONFIG_IRDA_FAST_RR=y
516 +CONFIG_IRTTY_SIR=m
517 +CONFIG_KINGSUN_DONGLE=m
518 +CONFIG_KSDAZZLE_DONGLE=m
519 +CONFIG_KS959_DONGLE=m
520 +CONFIG_USB_IRDA=m
521 +CONFIG_SIGMATEL_FIR=m
522 +CONFIG_MCS_FIR=m
523 +CONFIG_BT=m
524 +CONFIG_BT_L2CAP=y
525 +CONFIG_BT_SCO=y
526 +CONFIG_BT_RFCOMM=m
527 +CONFIG_BT_RFCOMM_TTY=y
528 +CONFIG_BT_BNEP=m
529 +CONFIG_BT_BNEP_MC_FILTER=y
530 +CONFIG_BT_BNEP_PROTO_FILTER=y
531 +CONFIG_BT_HIDP=m
532 +CONFIG_BT_HCIBTUSB=m
533 +CONFIG_BT_HCIBCM203X=m
534 +CONFIG_BT_HCIBPA10X=m
535 +CONFIG_BT_HCIBFUSB=m
536 +CONFIG_BT_HCIVHCI=m
537 +CONFIG_BT_MRVL=m
538 +CONFIG_BT_MRVL_SDIO=m
539 +CONFIG_BT_ATH3K=m
540 +CONFIG_CFG80211=m
541 +CONFIG_MAC80211=m
542 +CONFIG_MAC80211_RC_PID=y
543 +CONFIG_MAC80211_MESH=y
544 +CONFIG_WIMAX=m
545 +CONFIG_NET_9P=m
546 +CONFIG_NFC=m
547 +CONFIG_NFC_PN533=m
548 +CONFIG_DEVTMPFS=y
549  CONFIG_BLK_DEV_LOOP=y
550 -CONFIG_BLK_DEV_LOOP_MIN_COUNT=8
551 -# CONFIG_BLK_DEV_CRYPTOLOOP is not set
552 -
553 -#
554 -# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
555 -#
556 -# CONFIG_BLK_DEV_NBD is not set
557 -# CONFIG_BLK_DEV_UB is not set
558 +CONFIG_BLK_DEV_CRYPTOLOOP=m
559 +CONFIG_BLK_DEV_NBD=m
560  CONFIG_BLK_DEV_RAM=y
561 -CONFIG_BLK_DEV_RAM_COUNT=16
562 -CONFIG_BLK_DEV_RAM_SIZE=4096
563 -# CONFIG_BLK_DEV_XIP is not set
564 -# CONFIG_CDROM_PKTCDVD is not set
565 -# CONFIG_ATA_OVER_ETH is not set
566 -# CONFIG_MG_DISK is not set
567 -# CONFIG_BLK_DEV_RBD is not set
568 -# CONFIG_SENSORS_LIS3LV02D is not set
569 +CONFIG_CDROM_PKTCDVD=m
570  CONFIG_MISC_DEVICES=y
571 -# CONFIG_ENCLOSURE_SERVICES is not set
572 -# CONFIG_C2PORT is not set
573 -
574 -#
575 -# EEPROM support
576 -#
577 -# CONFIG_EEPROM_93CX6 is not set
578 -# CONFIG_IWMC3200TOP is not set
579 -
580 -#
581 -# Texas Instruments shared transport line discipline
582 -#
583 -# CONFIG_TI_ST is not set
584 -CONFIG_BCM2708_VCHIQ=y
585 -CONFIG_HAVE_IDE=y
586 -# CONFIG_IDE is not set
587 -
588 -#
589 -# SCSI device support
590 -#
591 -CONFIG_SCSI_MOD=y
592 -# CONFIG_RAID_ATTRS is not set
593  CONFIG_SCSI=y
594 -CONFIG_SCSI_DMA=y
595 -# CONFIG_SCSI_TGT is not set
596 -# CONFIG_SCSI_NETLINK is not set
597  # CONFIG_SCSI_PROC_FS is not set
598 -
599 -#
600 -# SCSI support type (disk, tape, CD-ROM)
601 -#
602 -CONFIG_BLK_DEV_SD=m
603 -# CONFIG_CHR_DEV_ST is not set
604 -# CONFIG_CHR_DEV_OSST is not set
605 +CONFIG_BLK_DEV_SD=y
606  CONFIG_BLK_DEV_SR=m
607 -# CONFIG_BLK_DEV_SR_VENDOR is not set
608 -# CONFIG_CHR_DEV_SG is not set
609 -# CONFIG_CHR_DEV_SCH is not set
610  CONFIG_SCSI_MULTI_LUN=y
611 -# CONFIG_SCSI_CONSTANTS is not set
612 -# CONFIG_SCSI_LOGGING is not set
613 -# CONFIG_SCSI_SCAN_ASYNC is not set
614 -CONFIG_SCSI_WAIT_SCAN=m
615 -
616 -#
617 -# SCSI Transports
618 -#
619 -# CONFIG_SCSI_SPI_ATTRS is not set
620 -# CONFIG_SCSI_FC_ATTRS is not set
621 -# CONFIG_SCSI_ISCSI_ATTRS is not set
622 -# CONFIG_SCSI_SAS_ATTRS is not set
623 -# CONFIG_SCSI_SAS_LIBSAS is not set
624 -# CONFIG_SCSI_SRP_ATTRS is not set
625  # CONFIG_SCSI_LOWLEVEL is not set
626 -# CONFIG_SCSI_DH is not set
627 -# CONFIG_SCSI_OSD_INITIATOR is not set
628 -# CONFIG_ATA is not set
629 -# CONFIG_MD is not set
630 -# CONFIG_TARGET_CORE is not set
631  CONFIG_NETDEVICES=y
632 -# CONFIG_DUMMY is not set
633 -# CONFIG_BONDING is not set
634 -# CONFIG_MACVLAN is not set
635 -# CONFIG_EQUALIZER is not set
636  CONFIG_TUN=m
637 -# CONFIG_VETH is not set
638 -CONFIG_MII=y
639  CONFIG_PHYLIB=m
640 -
641 -#
642 -# MII PHY device drivers
643 -#
644 -# CONFIG_MARVELL_PHY is not set
645 -# CONFIG_DAVICOM_PHY is not set
646 -# CONFIG_QSEMI_PHY is not set
647 -# CONFIG_LXT_PHY is not set
648 -# CONFIG_CICADA_PHY is not set
649 -# CONFIG_VITESSE_PHY is not set
650 -# CONFIG_SMSC_PHY is not set
651 -# CONFIG_BROADCOM_PHY is not set
652 -# CONFIG_ICPLUS_PHY is not set
653 -# CONFIG_REALTEK_PHY is not set
654 -# CONFIG_NATIONAL_PHY is not set
655 -# CONFIG_STE10XP is not set
656 -# CONFIG_LSI_ET1011C_PHY is not set
657 -# CONFIG_MICREL_PHY is not set
658  CONFIG_MDIO_BITBANG=m
659 -# CONFIG_MDIO_GPIO is not set
660  CONFIG_NET_ETHERNET=y
661 -CONFIG_AX88796=m
662 -# CONFIG_AX88796_93CX6 is not set
663 -# CONFIG_SMC91X is not set
664 -# CONFIG_DM9000 is not set
665 -# CONFIG_ETHOC is not set
666 -# CONFIG_SMC911X is not set
667 -# CONFIG_SMSC911X is not set
668 -# CONFIG_DNET is not set
669 -# CONFIG_IBM_NEW_EMAC_ZMII is not set
670 -# CONFIG_IBM_NEW_EMAC_RGMII is not set
671 -# CONFIG_IBM_NEW_EMAC_TAH is not set
672 -# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
673 -# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
674 -# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
675 -# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
676 -# CONFIG_B44 is not set
677 -# CONFIG_KS8851_MLL is not set
678 -# CONFIG_FTMAC100 is not set
679  # CONFIG_NETDEV_1000 is not set
680  # CONFIG_NETDEV_10000 is not set
681 -# CONFIG_WLAN is not set
682 -
683 -#
684 -# Enable WiMAX (Networking options) to see the WiMAX drivers
685 -#
686 -
687 -#
688 -# USB Network Adapters
689 -#
690 -# CONFIG_USB_CATC is not set
691 -# CONFIG_USB_KAWETH is not set
692 -# CONFIG_USB_PEGASUS is not set
693 -# CONFIG_USB_RTL8150 is not set
694 +CONFIG_LIBERTAS_THINFIRM=m
695 +CONFIG_LIBERTAS_THINFIRM_USB=m
696 +CONFIG_AT76C50X_USB=m
697 +CONFIG_USB_ZD1201=m
698 +CONFIG_USB_NET_RNDIS_WLAN=m
699 +CONFIG_RTL8187=m
700 +CONFIG_MAC80211_HWSIM=m
701 +CONFIG_ATH_COMMON=m
702 +CONFIG_ATH9K=m
703 +CONFIG_ATH9K_HTC=m
704 +CONFIG_CARL9170=m
705 +CONFIG_B43=m
706 +CONFIG_B43LEGACY=m
707 +CONFIG_HOSTAP=m
708 +CONFIG_IWM=m
709 +CONFIG_LIBERTAS=m
710 +CONFIG_LIBERTAS_USB=m
711 +CONFIG_LIBERTAS_SDIO=m
712 +CONFIG_P54_COMMON=m
713 +CONFIG_P54_USB=m
714 +CONFIG_RT2X00=m
715 +CONFIG_RT2500USB=m
716 +CONFIG_RT73USB=m
717 +CONFIG_RT2800USB=m
718 +CONFIG_RT2800USB_RT53XX=y
719 +CONFIG_RTL8192CU=m
720 +CONFIG_WL1251=m
721 +CONFIG_WL12XX_MENU=m
722 +CONFIG_ZD1211RW=m
723 +CONFIG_MWIFIEX=m
724 +CONFIG_MWIFIEX_SDIO=m
725 +CONFIG_WIMAX_I2400M_USB=m
726 +CONFIG_USB_CATC=m
727 +CONFIG_USB_KAWETH=m
728 +CONFIG_USB_PEGASUS=m
729 +CONFIG_USB_RTL8150=m
730  CONFIG_USB_USBNET=y
731  CONFIG_USB_NET_AX8817X=m
732 -# CONFIG_USB_NET_CDCETHER is not set
733 -# CONFIG_USB_NET_CDC_EEM is not set
734 -CONFIG_USB_NET_CDC_NCM=y
735 -# CONFIG_USB_NET_DM9601 is not set
736 -# CONFIG_USB_NET_SMSC75XX is not set
737 +CONFIG_USB_NET_CDCETHER=m
738 +CONFIG_USB_NET_CDC_EEM=m
739 +CONFIG_USB_NET_DM9601=m
740 +CONFIG_USB_NET_SMSC75XX=m
741  CONFIG_USB_NET_SMSC95XX=y
742 -# CONFIG_USB_NET_GL620A is not set
743 -# CONFIG_USB_NET_NET1080 is not set
744 -# CONFIG_USB_NET_PLUSB is not set
745 -# CONFIG_USB_NET_MCS7830 is not set
746 -# CONFIG_USB_NET_RNDIS_HOST is not set
747 -# CONFIG_USB_NET_CDC_SUBSET is not set
748 +CONFIG_USB_NET_GL620A=m
749 +CONFIG_USB_NET_NET1080=m
750 +CONFIG_USB_NET_PLUSB=m
751 +CONFIG_USB_NET_MCS7830=m
752 +CONFIG_USB_NET_CDC_SUBSET=m
753 +CONFIG_USB_ALI_M5632=y
754 +CONFIG_USB_AN2720=y
755 +CONFIG_USB_KC2190=y
756  # CONFIG_USB_NET_ZAURUS is not set
757 -# CONFIG_USB_NET_CX82310_ETH is not set
758 -# CONFIG_USB_NET_KALMIA is not set
759 -# CONFIG_USB_NET_INT51X1 is not set
760 -# CONFIG_USB_IPHETH is not set
761 -# CONFIG_USB_SIERRA_NET is not set
762 -# CONFIG_WAN is not set
763 -
764 -#
765 -# CAIF transport drivers
766 -#
767 -# CONFIG_PPP is not set
768 -# CONFIG_SLIP is not set
769 -# CONFIG_NETCONSOLE is not set
770 -# CONFIG_NETPOLL is not set
771 -# CONFIG_NET_POLL_CONTROLLER is not set
772 -# CONFIG_ISDN is not set
773 -# CONFIG_PHONE is not set
774 -
775 -#
776 -# Input device support
777 -#
778 -CONFIG_INPUT=y
779 -# CONFIG_INPUT_FF_MEMLESS is not set
780 -# CONFIG_INPUT_POLLDEV is not set
781 -# CONFIG_INPUT_SPARSEKMAP is not set
782 -
783 -#
784 -# Userland interfaces
785 -#
786 -CONFIG_INPUT_MOUSEDEV=y
787 +CONFIG_USB_NET_CX82310_ETH=m
788 +CONFIG_USB_NET_KALMIA=m
789 +CONFIG_USB_NET_INT51X1=m
790 +CONFIG_USB_IPHETH=m
791 +CONFIG_USB_SIERRA_NET=m
792 +CONFIG_USB_VL600=m
793 +CONFIG_PPP=m
794 +CONFIG_PPP_ASYNC=m
795 +CONFIG_PPP_SYNC_TTY=m
796 +CONFIG_PPP_DEFLATE=m
797 +CONFIG_PPP_BSDCOMP=m
798 +CONFIG_SLIP=m
799 +CONFIG_SLIP_COMPRESSED=y
800 +CONFIG_NETCONSOLE=m
801 +CONFIG_INPUT_POLLDEV=m
802  # CONFIG_INPUT_MOUSEDEV_PSAUX is not set
803 -CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
804 -CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
805 -# CONFIG_INPUT_JOYDEV is not set
806 +CONFIG_INPUT_JOYDEV=m
807  CONFIG_INPUT_EVDEV=m
808 -# CONFIG_INPUT_EVBUG is not set
809 -
810 -#
811 -# Input Device Drivers
812 -#
813  # CONFIG_INPUT_KEYBOARD is not set
814  # CONFIG_INPUT_MOUSE is not set
815 -# CONFIG_INPUT_JOYSTICK is not set
816 -# CONFIG_INPUT_TABLET is not set
817 -# CONFIG_INPUT_TOUCHSCREEN is not set
818  CONFIG_INPUT_MISC=y
819 -# CONFIG_INPUT_AD714X is not set
820 -# CONFIG_INPUT_ATI_REMOTE is not set
821 -# CONFIG_INPUT_ATI_REMOTE2 is not set
822 -# CONFIG_INPUT_KEYSPAN_REMOTE is not set
823 -# CONFIG_INPUT_POWERMATE is not set
824 -# CONFIG_INPUT_YEALINK is not set
825 -# CONFIG_INPUT_CM109 is not set
826 +CONFIG_INPUT_AD714X=m
827 +CONFIG_INPUT_ATI_REMOTE=m
828 +CONFIG_INPUT_ATI_REMOTE2=m
829 +CONFIG_INPUT_KEYSPAN_REMOTE=m
830 +CONFIG_INPUT_POWERMATE=m
831 +CONFIG_INPUT_YEALINK=m
832 +CONFIG_INPUT_CM109=m
833  CONFIG_INPUT_UINPUT=m
834 -# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set
835 -# CONFIG_INPUT_ADXL34X is not set
836 -# CONFIG_INPUT_CMA3000 is not set
837 -
838 -#
839 -# Hardware I/O ports
840 -#
841 +CONFIG_INPUT_GPIO_ROTARY_ENCODER=m
842 +CONFIG_INPUT_ADXL34X=m
843 +CONFIG_INPUT_CMA3000=m
844  CONFIG_SERIO=m
845 -CONFIG_SERIO_SERPORT=m
846 -# CONFIG_SERIO_AMBAKMI is not set
847 -# CONFIG_SERIO_LIBPS2 is not set
848  CONFIG_SERIO_RAW=m
849 -# CONFIG_SERIO_ALTERA_PS2 is not set
850 -# CONFIG_SERIO_PS2MULT is not set
851  CONFIG_GAMEPORT=m
852  CONFIG_GAMEPORT_NS558=m
853  CONFIG_GAMEPORT_L4=m
854 -
855 -#
856 -# Character devices
857 -#
858 -CONFIG_VT=y
859 -CONFIG_CONSOLE_TRANSLATIONS=y
860 -CONFIG_VT_CONSOLE=y
861 -CONFIG_HW_CONSOLE=y
862  CONFIG_VT_HW_CONSOLE_BINDING=y
863 -CONFIG_UNIX98_PTYS=y
864 -# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
865  # CONFIG_LEGACY_PTYS is not set
866 -# CONFIG_SERIAL_NONSTANDARD is not set
867 -# CONFIG_N_GSM is not set
868 -# CONFIG_TRACE_SINK is not set
869  # CONFIG_DEVKMEM is not set
870 -
871 -#
872 -# Serial drivers
873 -#
874 -# CONFIG_SERIAL_8250 is not set
875 -
876 -#
877 -# Non-8250 serial port support
878 -#
879 -# CONFIG_SERIAL_AMBA_PL010 is not set
880  CONFIG_SERIAL_AMBA_PL011=y
881  CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
882 -CONFIG_SERIAL_CORE=y
883 -CONFIG_SERIAL_CORE_CONSOLE=y
884 -# CONFIG_SERIAL_TIMBERDALE is not set
885 -# CONFIG_SERIAL_ALTERA_JTAGUART is not set
886 -# CONFIG_SERIAL_ALTERA_UART is not set
887 -# CONFIG_SERIAL_XILINX_PS_UART is not set
888 -# CONFIG_TTY_PRINTK is not set
889 -# CONFIG_HVC_DCC is not set
890 -# CONFIG_IPMI_HANDLER is not set
891  # CONFIG_HW_RANDOM is not set
892 -# CONFIG_R3964 is not set
893  CONFIG_RAW_DRIVER=y
894 -CONFIG_MAX_RAW_DEVS=256
895 -# CONFIG_TCG_TPM is not set
896 -# CONFIG_RAMOOPS is not set
897 -# CONFIG_I2C is not set
898 -# CONFIG_SPI is not set
899 -
900 -#
901 -# PPS support
902 -#
903 -# CONFIG_PPS is not set
904 -
905 -#
906 -# PPS generators support
907 -#
908 -
909 -#
910 -# PTP clock support
911 -#
912 -
913 -#
914 -# Enable Device Drivers -> PPS to see the PTP clock options.
915 -#
916 -CONFIG_ARCH_REQUIRE_GPIOLIB=y
917 -CONFIG_GPIOLIB=y
918 -# CONFIG_DEBUG_GPIO is not set
919  CONFIG_GPIO_SYSFS=y
920 -
921 -#
922 -# Memory mapped GPIO drivers:
923 -#
924 -# CONFIG_GPIO_GENERIC_PLATFORM is not set
925 -# CONFIG_GPIO_IT8761E is not set
926 -# CONFIG_GPIO_PL061 is not set
927 -
928 -#
929 -# I2C GPIO expanders:
930 -#
931 -
932 -#
933 -# PCI GPIO expanders:
934 -#
935 -
936 -#
937 -# SPI GPIO expanders:
938 -#
939 -
940 -#
941 -# AC97 GPIO expanders:
942 -#
943 -
944 -#
945 -# MODULbus GPIO expanders:
946 -#
947 -# CONFIG_W1 is not set
948 -# CONFIG_POWER_SUPPLY is not set
949  # CONFIG_HWMON is not set
950 -# CONFIG_THERMAL is not set
951 -# CONFIG_WATCHDOG is not set
952 -CONFIG_SSB_POSSIBLE=y
953 -
954 -#
955 -# Sonics Silicon Backplane
956 -#
957 -# CONFIG_SSB is not set
958 -CONFIG_BCMA_POSSIBLE=y
959 -
960 -#
961 -# Broadcom specific AMBA
962 -#
963 -# CONFIG_BCMA is not set
964 +CONFIG_WATCHDOG=y
965 +CONFIG_BCM2708_WDT=m
966  # CONFIG_MFD_SUPPORT is not set
967 -# CONFIG_REGULATOR is not set
968 -# CONFIG_MEDIA_SUPPORT is not set
969 -
970 -#
971 -# Graphics support
972 -#
973 -# CONFIG_DRM is not set
974 -# CONFIG_VGASTATE is not set
975 -# CONFIG_VIDEO_OUTPUT_CONTROL is not set
976  CONFIG_FB=y
977 -# CONFIG_FIRMWARE_EDID is not set
978 -# CONFIG_FB_DDC is not set
979 -# CONFIG_FB_BOOT_VESA_SUPPORT is not set
980 -CONFIG_FB_CFB_FILLRECT=y
981 -CONFIG_FB_CFB_COPYAREA=y
982 -CONFIG_FB_CFB_IMAGEBLIT=y
983 -# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
984 -# CONFIG_FB_SYS_FILLRECT is not set
985 -# CONFIG_FB_SYS_COPYAREA is not set
986 -# CONFIG_FB_SYS_IMAGEBLIT is not set
987 -# CONFIG_FB_FOREIGN_ENDIAN is not set
988 -# CONFIG_FB_SYS_FOPS is not set
989 -# CONFIG_FB_WMT_GE_ROPS is not set
990 -# CONFIG_FB_SVGALIB is not set
991 -# CONFIG_FB_MACMODES is not set
992 -# CONFIG_FB_BACKLIGHT is not set
993 -# CONFIG_FB_MODE_HELPERS is not set
994 -# CONFIG_FB_TILEBLITTING is not set
995 -
996 -#
997 -# Frame buffer hardware drivers
998 -#
999  CONFIG_FB_BCM2708=y
1000 -# CONFIG_FB_ARMCLCD is not set
1001 -# CONFIG_FB_S1D13XXX is not set
1002 -# CONFIG_FB_UDL is not set
1003 -# CONFIG_FB_VIRTUAL is not set
1004 -# CONFIG_FB_METRONOME is not set
1005 -# CONFIG_FB_BROADSHEET is not set
1006 -# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
1007 -
1008 -#
1009 -# Display device support
1010 -#
1011 -# CONFIG_DISPLAY_SUPPORT is not set
1012 -
1013 -#
1014 -# Console display driver support
1015 -#
1016 -CONFIG_DUMMY_CONSOLE=y
1017  CONFIG_FRAMEBUFFER_CONSOLE=y
1018 -# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
1019 -# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
1020 -# CONFIG_FONTS is not set
1021 -CONFIG_FONT_8x8=y
1022 -CONFIG_FONT_8x16=y
1023  CONFIG_LOGO=y
1024  # CONFIG_LOGO_LINUX_MONO is not set
1025  # CONFIG_LOGO_LINUX_VGA16 is not set
1026 -CONFIG_LOGO_LINUX_CLUT224=y
1027 -# CONFIG_SOUND is not set
1028 -CONFIG_HID_SUPPORT=y
1029 -CONFIG_HID=y
1030 -# CONFIG_HIDRAW is not set
1031 -
1032 -#
1033 -# USB Input Devices
1034 -#
1035 -CONFIG_USB_HID=y
1036 +CONFIG_SOUND=y
1037 +CONFIG_SND=m
1038 +CONFIG_SND_SEQUENCER=m
1039 +CONFIG_SND_SEQ_DUMMY=m
1040 +CONFIG_SND_MIXER_OSS=m
1041 +CONFIG_SND_PCM_OSS=m
1042 +CONFIG_SND_SEQUENCER_OSS=y
1043 +CONFIG_SND_HRTIMER=m
1044 +CONFIG_SND_DUMMY=m
1045 +CONFIG_SND_ALOOP=m
1046 +CONFIG_SND_VIRMIDI=m
1047 +CONFIG_SND_MTPAV=m
1048 +CONFIG_SND_SERIAL_U16550=m
1049 +CONFIG_SND_MPU401=m
1050 +CONFIG_SND_BCM2835=m
1051 +CONFIG_SND_USB_AUDIO=m
1052 +CONFIG_SND_USB_UA101=m
1053 +CONFIG_SND_USB_CAIAQ=m
1054 +CONFIG_SND_USB_6FIRE=m
1055 +CONFIG_SOUND_PRIME=m
1056  CONFIG_HID_PID=y
1057  CONFIG_USB_HIDDEV=y
1058 -
1059 -#
1060 -# Special HID drivers
1061 -#
1062  CONFIG_HID_A4TECH=m
1063 -# CONFIG_HID_ACRUX is not set
1064 +CONFIG_HID_ACRUX=m
1065  CONFIG_HID_APPLE=m
1066  CONFIG_HID_BELKIN=m
1067  CONFIG_HID_CHERRY=m
1068  CONFIG_HID_CHICONY=m
1069  CONFIG_HID_CYPRESS=m
1070  CONFIG_HID_DRAGONRISE=m
1071 -# CONFIG_DRAGONRISE_FF is not set
1072 -# CONFIG_HID_EMS_FF is not set
1073 +CONFIG_HID_EMS_FF=m
1074 +CONFIG_HID_ELECOM=m
1075  CONFIG_HID_EZKEY=m
1076 -# CONFIG_HID_HOLTEK is not set
1077 -# CONFIG_HID_KEYTOUCH is not set
1078 +CONFIG_HID_HOLTEK=m
1079 +CONFIG_HID_KEYTOUCH=m
1080  CONFIG_HID_KYE=m
1081 -# CONFIG_HID_UCLOGIC is not set
1082 -# CONFIG_HID_WALTOP is not set
1083 +CONFIG_HID_UCLOGIC=m
1084 +CONFIG_HID_WALTOP=m
1085  CONFIG_HID_GYRATION=m
1086  CONFIG_HID_TWINHAN=m
1087  CONFIG_HID_KENSINGTON=m
1088 -# CONFIG_HID_LCPOWER is not set
1089 +CONFIG_HID_LCPOWER=m
1090  CONFIG_HID_LOGITECH=m
1091 -# CONFIG_LOGITECH_FF is not set
1092 -# CONFIG_LOGIRUMBLEPAD2_FF is not set
1093 -# CONFIG_LOGIG940_FF is not set
1094 -# CONFIG_LOGIWII_FF is not set
1095 +CONFIG_HID_MAGICMOUSE=m
1096  CONFIG_HID_MICROSOFT=m
1097  CONFIG_HID_MONTEREY=m
1098 -# CONFIG_HID_MULTITOUCH is not set
1099 -# CONFIG_HID_NTRIG is not set
1100 +CONFIG_HID_MULTITOUCH=m
1101 +CONFIG_HID_NTRIG=m
1102  CONFIG_HID_ORTEK=m
1103  CONFIG_HID_PANTHERLORD=m
1104 -# CONFIG_PANTHERLORD_FF is not set
1105  CONFIG_HID_PETALYNX=m
1106 -# CONFIG_HID_PICOLCD is not set
1107 -# CONFIG_HID_QUANTA is not set
1108 -# CONFIG_HID_ROCCAT is not set
1109 +CONFIG_HID_PICOLCD=m
1110 +CONFIG_HID_QUANTA=m
1111 +CONFIG_HID_ROCCAT=m
1112  CONFIG_HID_SAMSUNG=m
1113  CONFIG_HID_SONY=m
1114 -# CONFIG_HID_SPEEDLINK is not set
1115 +CONFIG_HID_SPEEDLINK=m
1116  CONFIG_HID_SUNPLUS=m
1117  CONFIG_HID_GREENASIA=m
1118 -# CONFIG_GREENASIA_FF is not set
1119  CONFIG_HID_SMARTJOYPLUS=m
1120 -# CONFIG_SMARTJOYPLUS_FF is not set
1121  CONFIG_HID_TOPSEED=m
1122  CONFIG_HID_THRUSTMASTER=m
1123 -# CONFIG_THRUSTMASTER_FF is not set
1124 +CONFIG_HID_WACOM=m
1125 +CONFIG_HID_WIIMOTE=m
1126  CONFIG_HID_ZEROPLUS=m
1127 -# CONFIG_ZEROPLUS_FF is not set
1128 -# CONFIG_HID_ZYDACRON is not set
1129 -CONFIG_USB_SUPPORT=y
1130 -CONFIG_USB_ARCH_HAS_HCD=y
1131 -# CONFIG_USB_ARCH_HAS_OHCI is not set
1132 -# CONFIG_USB_ARCH_HAS_EHCI is not set
1133 +CONFIG_HID_ZYDACRON=m
1134  CONFIG_USB=y
1135 -# CONFIG_USB_DEBUG is not set
1136  CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
1137 -
1138 -#
1139 -# Miscellaneous USB options
1140 -#
1141 -# CONFIG_USB_DEVICEFS is not set
1142 -CONFIG_USB_DEVICE_CLASS=y
1143 -# CONFIG_USB_DYNAMIC_MINORS is not set
1144 -# CONFIG_USB_OTG_WHITELIST is not set
1145 -# CONFIG_USB_OTG_BLACKLIST_HUB is not set
1146  CONFIG_USB_MON=m
1147 -# CONFIG_USB_WUSB is not set
1148 -# CONFIG_USB_WUSB_CBAF is not set
1149 -
1150 -#
1151 -# USB Host Controller Drivers
1152 -#
1153 -# CONFIG_USB_C67X00_HCD is not set
1154 -# CONFIG_USB_OXU210HP_HCD is not set
1155 -# CONFIG_USB_ISP116X_HCD is not set
1156 -# CONFIG_USB_ISP1760_HCD is not set
1157 -# CONFIG_USB_ISP1362_HCD is not set
1158 -# CONFIG_USB_SL811_HCD is not set
1159 -# CONFIG_USB_R8A66597_HCD is not set
1160 -# CONFIG_USB_HWA_HCD is not set
1161  CONFIG_USB_DWCOTG=y
1162 -
1163 -#
1164 -# USB Device Class drivers
1165 -#
1166 -# CONFIG_USB_ACM is not set
1167 -# CONFIG_USB_PRINTER is not set
1168 -# CONFIG_USB_WDM is not set
1169 -# CONFIG_USB_TMC is not set
1170 -
1171 -#
1172 -# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
1173 -#
1174 -
1175 -#
1176 -# also be needed; see USB_STORAGE Help for more info
1177 -#
1178  CONFIG_USB_STORAGE=y
1179 -# CONFIG_USB_STORAGE_DEBUG is not set
1180 -# CONFIG_USB_STORAGE_REALTEK is not set
1181 -# CONFIG_USB_STORAGE_DATAFAB is not set
1182 -# CONFIG_USB_STORAGE_FREECOM is not set
1183 -# CONFIG_USB_STORAGE_ISD200 is not set
1184 -# CONFIG_USB_STORAGE_USBAT is not set
1185 -# CONFIG_USB_STORAGE_SDDR09 is not set
1186 -# CONFIG_USB_STORAGE_SDDR55 is not set
1187 -# CONFIG_USB_STORAGE_JUMPSHOT is not set
1188 -# CONFIG_USB_STORAGE_ALAUDA is not set
1189 -# CONFIG_USB_STORAGE_ONETOUCH is not set
1190 -# CONFIG_USB_STORAGE_KARMA is not set
1191 -# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1192 -# CONFIG_USB_STORAGE_ENE_UB6250 is not set
1193 -# CONFIG_USB_UAS is not set
1194 +CONFIG_USB_STORAGE_REALTEK=m
1195 +CONFIG_USB_STORAGE_DATAFAB=m
1196 +CONFIG_USB_STORAGE_FREECOM=m
1197 +CONFIG_USB_STORAGE_ISD200=m
1198 +CONFIG_USB_STORAGE_USBAT=m
1199 +CONFIG_USB_STORAGE_SDDR09=m
1200 +CONFIG_USB_STORAGE_SDDR55=m
1201 +CONFIG_USB_STORAGE_JUMPSHOT=m
1202 +CONFIG_USB_STORAGE_ALAUDA=m
1203 +CONFIG_USB_STORAGE_ONETOUCH=m
1204 +CONFIG_USB_STORAGE_KARMA=m
1205 +CONFIG_USB_STORAGE_CYPRESS_ATACB=m
1206 +CONFIG_USB_STORAGE_ENE_UB6250=m
1207 +CONFIG_USB_UAS=y
1208  CONFIG_USB_LIBUSUAL=y
1209 -
1210 -#
1211 -# USB Imaging devices
1212 -#
1213 -# CONFIG_USB_MDC800 is not set
1214 -# CONFIG_USB_MICROTEK is not set
1215 -
1216 -#
1217 -# USB port drivers
1218 -#
1219 -# CONFIG_USB_SERIAL is not set
1220 -
1221 -#
1222 -# USB Miscellaneous drivers
1223 -#
1224 -# CONFIG_USB_EMI62 is not set
1225 -# CONFIG_USB_EMI26 is not set
1226 -# CONFIG_USB_ADUTUX is not set
1227 -# CONFIG_USB_SEVSEG is not set
1228 -# CONFIG_USB_RIO500 is not set
1229 -# CONFIG_USB_LEGOTOWER is not set
1230 -# CONFIG_USB_LCD is not set
1231 -# CONFIG_USB_LED is not set
1232 -# CONFIG_USB_CYPRESS_CY7C63 is not set
1233 -# CONFIG_USB_CYTHERM is not set
1234 -# CONFIG_USB_IDMOUSE is not set
1235 -# CONFIG_USB_FTDI_ELAN is not set
1236 -# CONFIG_USB_APPLEDISPLAY is not set
1237 -# CONFIG_USB_LD is not set
1238 -# CONFIG_USB_TRANCEVIBRATOR is not set
1239 -# CONFIG_USB_IOWARRIOR is not set
1240 -# CONFIG_USB_TEST is not set
1241 -# CONFIG_USB_ISIGHTFW is not set
1242 -# CONFIG_USB_YUREX is not set
1243 -# CONFIG_USB_GADGET is not set
1244 -
1245 -#
1246 -# OTG and related infrastructure
1247 -#
1248 -# CONFIG_USB_GPIO_VBUS is not set
1249 -# CONFIG_USB_ULPI is not set
1250 -# CONFIG_NOP_USB_XCEIV is not set
1251 +CONFIG_USB_MDC800=m
1252 +CONFIG_USB_MICROTEK=m
1253 +CONFIG_USB_SERIAL=m
1254 +CONFIG_USB_SERIAL_GENERIC=y
1255 +CONFIG_USB_SERIAL_AIRCABLE=m
1256 +CONFIG_USB_SERIAL_ARK3116=m
1257 +CONFIG_USB_SERIAL_BELKIN=m
1258 +CONFIG_USB_SERIAL_CH341=m
1259 +CONFIG_USB_SERIAL_WHITEHEAT=m
1260 +CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
1261 +CONFIG_USB_SERIAL_CP210X=m
1262 +CONFIG_USB_SERIAL_CYPRESS_M8=m
1263 +CONFIG_USB_SERIAL_EMPEG=m
1264 +CONFIG_USB_SERIAL_FTDI_SIO=m
1265 +CONFIG_USB_SERIAL_FUNSOFT=m
1266 +CONFIG_USB_SERIAL_VISOR=m
1267 +CONFIG_USB_SERIAL_IPAQ=m
1268 +CONFIG_USB_SERIAL_IR=m
1269 +CONFIG_USB_SERIAL_EDGEPORT=m
1270 +CONFIG_USB_SERIAL_EDGEPORT_TI=m
1271 +CONFIG_USB_SERIAL_GARMIN=m
1272 +CONFIG_USB_SERIAL_IPW=m
1273 +CONFIG_USB_SERIAL_IUU=m
1274 +CONFIG_USB_SERIAL_KEYSPAN_PDA=m
1275 +CONFIG_USB_SERIAL_KEYSPAN=m
1276 +CONFIG_USB_SERIAL_KLSI=m
1277 +CONFIG_USB_SERIAL_KOBIL_SCT=m
1278 +CONFIG_USB_SERIAL_MCT_U232=m
1279 +CONFIG_USB_SERIAL_MOS7720=m
1280 +CONFIG_USB_SERIAL_MOS7840=m
1281 +CONFIG_USB_SERIAL_MOTOROLA=m
1282 +CONFIG_USB_SERIAL_NAVMAN=m
1283 +CONFIG_USB_SERIAL_PL2303=m
1284 +CONFIG_USB_SERIAL_OTI6858=m
1285 +CONFIG_USB_SERIAL_QCAUX=m
1286 +CONFIG_USB_SERIAL_QUALCOMM=m
1287 +CONFIG_USB_SERIAL_SPCP8X5=m
1288 +CONFIG_USB_SERIAL_HP4X=m
1289 +CONFIG_USB_SERIAL_SAFE=m
1290 +CONFIG_USB_SERIAL_SIEMENS_MPI=m
1291 +CONFIG_USB_SERIAL_SIERRAWIRELESS=m
1292 +CONFIG_USB_SERIAL_SYMBOL=m
1293 +CONFIG_USB_SERIAL_TI=m
1294 +CONFIG_USB_SERIAL_CYBERJACK=m
1295 +CONFIG_USB_SERIAL_XIRCOM=m
1296 +CONFIG_USB_SERIAL_OPTION=m
1297 +CONFIG_USB_SERIAL_OMNINET=m
1298 +CONFIG_USB_SERIAL_OPTICON=m
1299 +CONFIG_USB_SERIAL_VIVOPAY_SERIAL=m
1300 +CONFIG_USB_SERIAL_ZIO=m
1301 +CONFIG_USB_SERIAL_SSU100=m
1302 +CONFIG_USB_SERIAL_DEBUG=m
1303 +CONFIG_USB_EMI62=m
1304 +CONFIG_USB_EMI26=m
1305 +CONFIG_USB_ADUTUX=m
1306 +CONFIG_USB_SEVSEG=m
1307 +CONFIG_USB_RIO500=m
1308 +CONFIG_USB_LEGOTOWER=m
1309 +CONFIG_USB_LCD=m
1310 +CONFIG_USB_LED=m
1311 +CONFIG_USB_CYPRESS_CY7C63=m
1312 +CONFIG_USB_CYTHERM=m
1313 +CONFIG_USB_IDMOUSE=m
1314 +CONFIG_USB_FTDI_ELAN=m
1315 +CONFIG_USB_APPLEDISPLAY=m
1316 +CONFIG_USB_LD=m
1317 +CONFIG_USB_TRANCEVIBRATOR=m
1318 +CONFIG_USB_IOWARRIOR=m
1319 +CONFIG_USB_TEST=m
1320 +CONFIG_USB_ISIGHTFW=m
1321 +CONFIG_USB_YUREX=m
1322  CONFIG_MMC=y
1323 -# CONFIG_MMC_DEBUG is not set
1324 -# CONFIG_MMC_UNSAFE_RESUME is not set
1325 -# CONFIG_MMC_CLKGATE is not set
1326 -
1327 -#
1328 -# MMC/SD/SDIO Card Drivers
1329 -#
1330 -CONFIG_MMC_BLOCK=y
1331 -CONFIG_MMC_BLOCK_MINORS=8
1332 -CONFIG_MMC_BLOCK_BOUNCE=y
1333 -# CONFIG_SDIO_UART is not set
1334 -# CONFIG_MMC_TEST is not set
1335 -
1336 -#
1337 -# MMC/SD/SDIO Host Controller Drivers
1338 -#
1339 -# CONFIG_MMC_ARMMMCI is not set
1340  CONFIG_MMC_SDHCI=y
1341 -CONFIG_MMC_SDHCI_IO_ACCESSORS=y
1342  CONFIG_MMC_SDHCI_PLTFM=y
1343 -# CONFIG_MMC_SDHCI_PXAV3 is not set
1344 -# CONFIG_MMC_SDHCI_PXAV2 is not set
1345  CONFIG_MMC_SDHCI_BCM2708=y
1346  CONFIG_MMC_SDHCI_BCM2708_DMA=y
1347 -# CONFIG_MMC_BCM2708 is not set
1348 -# CONFIG_MMC_DW is not set
1349 -# CONFIG_MMC_VUB300 is not set
1350 -# CONFIG_MMC_USHC is not set
1351 -# CONFIG_MEMSTICK is not set
1352 -CONFIG_NEW_LEDS=y
1353 -CONFIG_LEDS_CLASS=y
1354 -
1355 -#
1356 -# LED drivers
1357 -#
1358  CONFIG_LEDS_GPIO=y
1359 -# CONFIG_LEDS_LT3593 is not set
1360 -CONFIG_LEDS_TRIGGERS=y
1361 -
1362 -#
1363 -# LED Triggers
1364 -#
1365  CONFIG_LEDS_TRIGGER_TIMER=m
1366  CONFIG_LEDS_TRIGGER_HEARTBEAT=m
1367 -# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
1368 -# CONFIG_LEDS_TRIGGER_GPIO is not set
1369  CONFIG_LEDS_TRIGGER_DEFAULT_ON=m
1370 -
1371 -#
1372 -# iptables trigger is under Netfilter config (LED target)
1373 -#
1374 -# CONFIG_ACCESSIBILITY is not set
1375 -CONFIG_RTC_LIB=y
1376 -# CONFIG_RTC_CLASS is not set
1377 -# CONFIG_DMADEVICES is not set
1378 -# CONFIG_AUXDISPLAY is not set
1379 -# CONFIG_UIO is not set
1380 -
1381 -#
1382 -# Virtio drivers
1383 -#
1384 -# CONFIG_VIRTIO_BALLOON is not set
1385 -# CONFIG_STAGING is not set
1386 -CONFIG_CLKDEV_LOOKUP=y
1387 +CONFIG_UIO=m
1388 +CONFIG_UIO_PDRV=m
1389 +CONFIG_UIO_PDRV_GENIRQ=m
1390  # CONFIG_IOMMU_SUPPORT is not set
1391 -# CONFIG_VIRT_DRIVERS is not set
1392 -
1393 -#
1394 -# File systems
1395 -#
1396 -CONFIG_EXT2_FS=m
1397 -CONFIG_EXT2_FS_XATTR=y
1398 -CONFIG_EXT2_FS_POSIX_ACL=y
1399 -CONFIG_EXT2_FS_SECURITY=y
1400 -CONFIG_EXT2_FS_XIP=y
1401 -CONFIG_EXT3_FS=y
1402 -# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
1403 -CONFIG_EXT3_FS_XATTR=y
1404 -CONFIG_EXT3_FS_POSIX_ACL=y
1405 -CONFIG_EXT3_FS_SECURITY=y
1406 -CONFIG_EXT4_FS=m
1407 -CONFIG_EXT4_FS_XATTR=y
1408 +CONFIG_EXT4_FS=y
1409  CONFIG_EXT4_FS_POSIX_ACL=y
1410  CONFIG_EXT4_FS_SECURITY=y
1411 -# CONFIG_EXT4_DEBUG is not set
1412 -CONFIG_FS_XIP=y
1413 -CONFIG_JBD=y
1414 -CONFIG_JBD2=m
1415 -CONFIG_FS_MBCACHE=y
1416 -# CONFIG_REISERFS_FS is not set
1417 -# CONFIG_JFS_FS is not set
1418 -# CONFIG_XFS_FS is not set
1419 -# CONFIG_GFS2_FS is not set
1420 -# CONFIG_OCFS2_FS is not set
1421 -# CONFIG_BTRFS_FS is not set
1422 -# CONFIG_NILFS2_FS is not set
1423 -CONFIG_FS_POSIX_ACL=y
1424 -CONFIG_FILE_LOCKING=y
1425 -CONFIG_FSNOTIFY=y
1426 -CONFIG_DNOTIFY=y
1427 -CONFIG_INOTIFY_USER=y
1428 -# CONFIG_FANOTIFY is not set
1429 -# CONFIG_QUOTA is not set
1430 -# CONFIG_QUOTACTL is not set
1431 +CONFIG_REISERFS_FS=m
1432 +CONFIG_REISERFS_FS_XATTR=y
1433 +CONFIG_REISERFS_FS_POSIX_ACL=y
1434 +CONFIG_REISERFS_FS_SECURITY=y
1435 +CONFIG_JFS_FS=m
1436 +CONFIG_JFS_POSIX_ACL=y
1437 +CONFIG_JFS_SECURITY=y
1438 +CONFIG_XFS_FS=m
1439 +CONFIG_XFS_QUOTA=y
1440 +CONFIG_XFS_POSIX_ACL=y
1441 +CONFIG_XFS_RT=y
1442 +CONFIG_GFS2_FS=m
1443 +CONFIG_OCFS2_FS=m
1444 +CONFIG_BTRFS_FS=m
1445 +CONFIG_BTRFS_FS_POSIX_ACL=y
1446 +CONFIG_NILFS2_FS=m
1447  CONFIG_AUTOFS4_FS=y
1448  CONFIG_FUSE_FS=m
1449  CONFIG_CUSE=m
1450 -
1451 -#
1452 -# Caches
1453 -#
1454  CONFIG_FSCACHE=y
1455 -# CONFIG_FSCACHE_STATS is not set
1456 -# CONFIG_FSCACHE_HISTOGRAM is not set
1457 -# CONFIG_FSCACHE_DEBUG is not set
1458 -# CONFIG_FSCACHE_OBJECT_LIST is not set
1459  CONFIG_CACHEFILES=y
1460 -# CONFIG_CACHEFILES_DEBUG is not set
1461 -# CONFIG_CACHEFILES_HISTOGRAM is not set
1462 -
1463 -#
1464 -# CD-ROM/DVD Filesystems
1465 -#
1466  CONFIG_ISO9660_FS=m
1467  CONFIG_JOLIET=y
1468  CONFIG_ZISOFS=y
1469  CONFIG_UDF_FS=m
1470 -CONFIG_UDF_NLS=y
1471 -
1472 -#
1473 -# DOS/FAT/NT Filesystems
1474 -#
1475 -CONFIG_FAT_FS=y
1476  CONFIG_MSDOS_FS=y
1477  CONFIG_VFAT_FS=y
1478 -CONFIG_FAT_DEFAULT_CODEPAGE=437
1479  CONFIG_FAT_DEFAULT_IOCHARSET="ascii"
1480  CONFIG_NTFS_FS=m
1481 -# CONFIG_NTFS_DEBUG is not set
1482 -# CONFIG_NTFS_RW is not set
1483 -
1484 -#
1485 -# Pseudo filesystems
1486 -#
1487 -CONFIG_PROC_FS=y
1488 -CONFIG_PROC_SYSCTL=y
1489 -CONFIG_PROC_PAGE_MONITOR=y
1490 -CONFIG_SYSFS=y
1491  CONFIG_TMPFS=y
1492 -# CONFIG_TMPFS_POSIX_ACL is not set
1493 -# CONFIG_TMPFS_XATTR is not set
1494 -# CONFIG_HUGETLB_PAGE is not set
1495 +CONFIG_TMPFS_POSIX_ACL=y
1496  CONFIG_CONFIGFS_FS=y
1497 -CONFIG_MISC_FILESYSTEMS=y
1498 -# CONFIG_ADFS_FS is not set
1499 -# CONFIG_AFFS_FS is not set
1500 -# CONFIG_ECRYPT_FS is not set
1501 -# CONFIG_HFS_FS is not set
1502 -# CONFIG_HFSPLUS_FS is not set
1503 -# CONFIG_BEFS_FS is not set
1504 -# CONFIG_BFS_FS is not set
1505 -# CONFIG_EFS_FS is not set
1506 -# CONFIG_LOGFS is not set
1507 -# CONFIG_CRAMFS is not set
1508 -# CONFIG_SQUASHFS is not set
1509 -# CONFIG_VXFS_FS is not set
1510 -# CONFIG_MINIX_FS is not set
1511 -# CONFIG_OMFS_FS is not set
1512 -# CONFIG_HPFS_FS is not set
1513 -# CONFIG_QNX4FS_FS is not set
1514 -# CONFIG_ROMFS_FS is not set
1515 -# CONFIG_PSTORE is not set
1516 -# CONFIG_SYSV_FS is not set
1517 -# CONFIG_UFS_FS is not set
1518 -CONFIG_NETWORK_FILESYSTEMS=y
1519 +CONFIG_SQUASHFS=m
1520 +CONFIG_SQUASHFS_XATTR=y
1521 +CONFIG_SQUASHFS_LZO=y
1522 +CONFIG_SQUASHFS_XZ=y
1523  CONFIG_NFS_FS=y
1524  CONFIG_NFS_V3=y
1525  CONFIG_NFS_V3_ACL=y
1526  CONFIG_NFS_V4=y
1527 -# CONFIG_NFS_V4_1 is not set
1528  CONFIG_ROOT_NFS=y
1529  CONFIG_NFS_FSCACHE=y
1530 -# CONFIG_NFS_USE_LEGACY_DNS is not set
1531 -CONFIG_NFS_USE_KERNEL_DNS=y
1532 -# CONFIG_NFS_USE_NEW_IDMAPPER is not set
1533 -# CONFIG_NFSD is not set
1534 -CONFIG_LOCKD=y
1535 -CONFIG_LOCKD_V4=y
1536 -CONFIG_NFS_ACL_SUPPORT=y
1537 -CONFIG_NFS_COMMON=y
1538 -CONFIG_SUNRPC=y
1539 -CONFIG_SUNRPC_GSS=y
1540 -# CONFIG_CEPH_FS is not set
1541  CONFIG_CIFS=m
1542 -# CONFIG_CIFS_STATS is not set
1543  CONFIG_CIFS_WEAK_PW_HASH=y
1544 -# CONFIG_CIFS_UPCALL is not set
1545  CONFIG_CIFS_XATTR=y
1546  CONFIG_CIFS_POSIX=y
1547 -# CONFIG_CIFS_DEBUG2 is not set
1548 -# CONFIG_CIFS_DFS_UPCALL is not set
1549 -# CONFIG_CIFS_FSCACHE is not set
1550 -# CONFIG_CIFS_ACL is not set
1551 -# CONFIG_NCP_FS is not set
1552 -# CONFIG_CODA_FS is not set
1553 -# CONFIG_AFS_FS is not set
1554 -
1555 -#
1556 -# Partition Types
1557 -#
1558 +CONFIG_9P_FS=m
1559  CONFIG_PARTITION_ADVANCED=y
1560 -# CONFIG_ACORN_PARTITION is not set
1561 -# CONFIG_OSF_PARTITION is not set
1562 -# CONFIG_AMIGA_PARTITION is not set
1563 -# CONFIG_ATARI_PARTITION is not set
1564  CONFIG_MAC_PARTITION=y
1565 -CONFIG_MSDOS_PARTITION=y
1566 -# CONFIG_BSD_DISKLABEL is not set
1567 -# CONFIG_MINIX_SUBPARTITION is not set
1568 -# CONFIG_SOLARIS_X86_PARTITION is not set
1569 -# CONFIG_UNIXWARE_DISKLABEL is not set
1570 -# CONFIG_LDM_PARTITION is not set
1571 -# CONFIG_SGI_PARTITION is not set
1572 -# CONFIG_ULTRIX_PARTITION is not set
1573 -# CONFIG_SUN_PARTITION is not set
1574 -# CONFIG_KARMA_PARTITION is not set
1575  CONFIG_EFI_PARTITION=y
1576 -# CONFIG_SYSV68_PARTITION is not set
1577 -CONFIG_NLS=y
1578  CONFIG_NLS_DEFAULT="utf8"
1579  CONFIG_NLS_CODEPAGE_437=y
1580  CONFIG_NLS_CODEPAGE_737=m
1581 @@ -1341,218 +470,25 @@ CONFIG_NLS_ISO8859_15=m
1582  CONFIG_NLS_KOI8_R=m
1583  CONFIG_NLS_KOI8_U=m
1584  CONFIG_NLS_UTF8=m
1585 -# CONFIG_DLM is not set
1586 -
1587 -#
1588 -# Kernel hacking
1589 -#
1590 -# CONFIG_PRINTK_TIME is not set
1591 -CONFIG_DEFAULT_MESSAGE_LOGLEVEL=4
1592 -CONFIG_ENABLE_WARN_DEPRECATED=y
1593 -CONFIG_ENABLE_MUST_CHECK=y
1594 -CONFIG_FRAME_WARN=1024
1595 -# CONFIG_MAGIC_SYSRQ is not set
1596 -# CONFIG_STRIP_ASM_SYMS is not set
1597 -# CONFIG_UNUSED_SYMBOLS is not set
1598 -# CONFIG_DEBUG_FS is not set
1599 -# CONFIG_HEADERS_CHECK is not set
1600 -# CONFIG_DEBUG_SECTION_MISMATCH is not set
1601 -CONFIG_DEBUG_KERNEL=y
1602 -# CONFIG_DEBUG_SHIRQ is not set
1603 -# CONFIG_LOCKUP_DETECTOR is not set
1604 -# CONFIG_HARDLOCKUP_DETECTOR is not set
1605 -# CONFIG_DETECT_HUNG_TASK is not set
1606  # CONFIG_SCHED_DEBUG is not set
1607 -# CONFIG_SCHEDSTATS is not set
1608 -# CONFIG_TIMER_STATS is not set
1609 -# CONFIG_DEBUG_OBJECTS is not set
1610 -# CONFIG_DEBUG_SLAB is not set
1611 -# CONFIG_DEBUG_KMEMLEAK is not set
1612 -# CONFIG_DEBUG_RT_MUTEXES is not set
1613 -# CONFIG_RT_MUTEX_TESTER is not set
1614 -# CONFIG_DEBUG_SPINLOCK is not set
1615 -# CONFIG_DEBUG_MUTEXES is not set
1616 -# CONFIG_DEBUG_LOCK_ALLOC is not set
1617 -# CONFIG_PROVE_LOCKING is not set
1618 -# CONFIG_SPARSE_RCU_POINTER is not set
1619 -# CONFIG_LOCK_STAT is not set
1620 -# CONFIG_DEBUG_ATOMIC_SLEEP is not set
1621 -# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1622 -# CONFIG_DEBUG_STACK_USAGE is not set
1623 -# CONFIG_DEBUG_KOBJECT is not set
1624  # CONFIG_DEBUG_BUGVERBOSE is not set
1625 -# CONFIG_DEBUG_INFO is not set
1626 -# CONFIG_DEBUG_VM is not set
1627 -# CONFIG_DEBUG_WRITECOUNT is not set
1628 -# CONFIG_DEBUG_MEMORY_INIT is not set
1629 -# CONFIG_DEBUG_LIST is not set
1630 -# CONFIG_TEST_LIST_SORT is not set
1631 -# CONFIG_DEBUG_SG is not set
1632 -# CONFIG_DEBUG_NOTIFIERS is not set
1633 -# CONFIG_DEBUG_CREDENTIALS is not set
1634 -CONFIG_FRAME_POINTER=y
1635 -# CONFIG_BOOT_PRINTK_DELAY is not set
1636 -# CONFIG_RCU_TORTURE_TEST is not set
1637 -# CONFIG_BACKTRACE_SELF_TEST is not set
1638 -# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1639 -# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
1640 -# CONFIG_FAULT_INJECTION is not set
1641 -# CONFIG_LATENCYTOP is not set
1642 -# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1643 -# CONFIG_DEBUG_PAGEALLOC is not set
1644 -CONFIG_HAVE_FUNCTION_TRACER=y
1645 -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
1646 -CONFIG_HAVE_DYNAMIC_FTRACE=y
1647 -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
1648 -CONFIG_HAVE_C_RECORDMCOUNT=y
1649 -CONFIG_TRACING_SUPPORT=y
1650  # CONFIG_FTRACE is not set
1651 -# CONFIG_DMA_API_DEBUG is not set
1652 -# CONFIG_ATOMIC64_SELFTEST is not set
1653 -# CONFIG_SAMPLES is not set
1654 -CONFIG_HAVE_ARCH_KGDB=y
1655 -# CONFIG_KGDB is not set
1656 -# CONFIG_TEST_KSTRTOX is not set
1657 -# CONFIG_STRICT_DEVMEM is not set
1658  # CONFIG_ARM_UNWIND is not set
1659 -# CONFIG_DEBUG_USER is not set
1660 -# CONFIG_DEBUG_LL is not set
1661 -# CONFIG_OC_ETM is not set
1662 -
1663 -#
1664 -# Security options
1665 -#
1666 -CONFIG_KEYS=y
1667 -# CONFIG_KEYS_DEBUG_PROC_KEYS is not set
1668 -# CONFIG_SECURITY_DMESG_RESTRICT is not set
1669 -# CONFIG_SECURITY is not set
1670 -# CONFIG_SECURITYFS is not set
1671 -CONFIG_DEFAULT_SECURITY_DAC=y
1672 -CONFIG_DEFAULT_SECURITY=""
1673 -CONFIG_CRYPTO=y
1674 -
1675 -#
1676 -# Crypto core or helper
1677 -#
1678 -CONFIG_CRYPTO_ALGAPI=y
1679 -CONFIG_CRYPTO_ALGAPI2=y
1680 -CONFIG_CRYPTO_AEAD=m
1681 -CONFIG_CRYPTO_AEAD2=y
1682 -CONFIG_CRYPTO_BLKCIPHER=y
1683 -CONFIG_CRYPTO_BLKCIPHER2=y
1684 -CONFIG_CRYPTO_HASH=y
1685 -CONFIG_CRYPTO_HASH2=y
1686 -CONFIG_CRYPTO_RNG=m
1687 -CONFIG_CRYPTO_RNG2=y
1688 -CONFIG_CRYPTO_PCOMP2=y
1689 -CONFIG_CRYPTO_MANAGER=y
1690 -CONFIG_CRYPTO_MANAGER2=y
1691 -CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y
1692 -# CONFIG_CRYPTO_GF128MUL is not set
1693 -# CONFIG_CRYPTO_NULL is not set
1694 -CONFIG_CRYPTO_WORKQUEUE=y
1695 -# CONFIG_CRYPTO_CRYPTD is not set
1696  CONFIG_CRYPTO_AUTHENC=m
1697 -# CONFIG_CRYPTO_TEST is not set
1698 -
1699 -#
1700 -# Authenticated Encryption with Associated Data
1701 -#
1702 -# CONFIG_CRYPTO_CCM is not set
1703 -# CONFIG_CRYPTO_GCM is not set
1704  CONFIG_CRYPTO_SEQIV=m
1705 -
1706 -#
1707 -# Block modes
1708 -#
1709  CONFIG_CRYPTO_CBC=y
1710 -# CONFIG_CRYPTO_CTR is not set
1711 -# CONFIG_CRYPTO_CTS is not set
1712 -CONFIG_CRYPTO_ECB=m
1713 -# CONFIG_CRYPTO_LRW is not set
1714 -# CONFIG_CRYPTO_PCBC is not set
1715 -# CONFIG_CRYPTO_XTS is not set
1716 -
1717 -#
1718 -# Hash modes
1719 -#
1720  CONFIG_CRYPTO_HMAC=y
1721  CONFIG_CRYPTO_XCBC=m
1722 -# CONFIG_CRYPTO_VMAC is not set
1723 -
1724 -#
1725 -# Digest
1726 -#
1727 -CONFIG_CRYPTO_CRC32C=y
1728 -# CONFIG_CRYPTO_GHASH is not set
1729 -CONFIG_CRYPTO_MD4=m
1730  CONFIG_CRYPTO_MD5=y
1731 -CONFIG_CRYPTO_MICHAEL_MIC=m
1732 -# CONFIG_CRYPTO_RMD128 is not set
1733 -# CONFIG_CRYPTO_RMD160 is not set
1734 -# CONFIG_CRYPTO_RMD256 is not set
1735 -# CONFIG_CRYPTO_RMD320 is not set
1736  CONFIG_CRYPTO_SHA1=y
1737  CONFIG_CRYPTO_SHA256=m
1738  CONFIG_CRYPTO_SHA512=m
1739  CONFIG_CRYPTO_TGR192=m
1740  CONFIG_CRYPTO_WP512=m
1741 -
1742 -#
1743 -# Ciphers
1744 -#
1745 -# CONFIG_CRYPTO_AES is not set
1746 -# CONFIG_CRYPTO_ANUBIS is not set
1747 -CONFIG_CRYPTO_ARC4=m
1748 -# CONFIG_CRYPTO_BLOWFISH is not set
1749 -# CONFIG_CRYPTO_CAMELLIA is not set
1750  CONFIG_CRYPTO_CAST5=m
1751 -# CONFIG_CRYPTO_CAST6 is not set
1752  CONFIG_CRYPTO_DES=y
1753 -# CONFIG_CRYPTO_FCRYPT is not set
1754 -# CONFIG_CRYPTO_KHAZAD is not set
1755 -# CONFIG_CRYPTO_SALSA20 is not set
1756 -# CONFIG_CRYPTO_SEED is not set
1757 -# CONFIG_CRYPTO_SERPENT is not set
1758 -# CONFIG_CRYPTO_TEA is not set
1759 -# CONFIG_CRYPTO_TWOFISH is not set
1760 -
1761 -#
1762 -# Compression
1763 -#
1764  CONFIG_CRYPTO_DEFLATE=m
1765 -# CONFIG_CRYPTO_ZLIB is not set
1766 -# CONFIG_CRYPTO_LZO is not set
1767 -
1768 -#
1769 -# Random Number Generation
1770 -#
1771  # CONFIG_CRYPTO_ANSI_CPRNG is not set
1772 -# CONFIG_CRYPTO_USER_API_HASH is not set
1773 -# CONFIG_CRYPTO_USER_API_SKCIPHER is not set
1774  # CONFIG_CRYPTO_HW is not set
1775 -# CONFIG_BINARY_PRINTF is not set
1776 -
1777 -#
1778 -# Library routines
1779 -#
1780 -CONFIG_BITREVERSE=y
1781 -CONFIG_CRC_CCITT=m
1782 -CONFIG_CRC16=y
1783 -# CONFIG_CRC_T10DIF is not set
1784  CONFIG_CRC_ITU_T=y
1785 -CONFIG_CRC32=y
1786 -# CONFIG_CRC7 is not set
1787  CONFIG_LIBCRC32C=y
1788 -# CONFIG_CRC8 is not set
1789 -CONFIG_ZLIB_INFLATE=m
1790 -CONFIG_ZLIB_DEFLATE=m
1791 -# CONFIG_XZ_DEC is not set
1792 -# CONFIG_XZ_DEC_BCJ is not set
1793 -CONFIG_HAS_IOMEM=y
1794 -CONFIG_HAS_IOPORT=y
1795 -CONFIG_HAS_DMA=y
1796 -CONFIG_NLATTR=y
1797 -CONFIG_GENERIC_ATOMIC64=y
1798 -# CONFIG_AVERAGE is not set
1799 -# CONFIG_CORDIC is not set
1800 --- /dev/null
1801 +++ b/arch/arm/configs/bcmrpi_defconfig
1802 @@ -0,0 +1,530 @@
1803 +CONFIG_EXPERIMENTAL=y
1804 +# CONFIG_LOCALVERSION_AUTO is not set
1805 +CONFIG_SYSVIPC=y
1806 +CONFIG_POSIX_MQUEUE=y
1807 +CONFIG_BSD_PROCESS_ACCT=y
1808 +CONFIG_BSD_PROCESS_ACCT_V3=y
1809 +CONFIG_FHANDLE=y
1810 +CONFIG_AUDIT=y
1811 +CONFIG_IKCONFIG=y
1812 +CONFIG_IKCONFIG_PROC=y
1813 +CONFIG_CGROUP_FREEZER=y
1814 +CONFIG_CGROUP_DEVICE=y
1815 +CONFIG_CGROUP_CPUACCT=y
1816 +CONFIG_RESOURCE_COUNTERS=y
1817 +CONFIG_BLK_CGROUP=y
1818 +CONFIG_NAMESPACES=y
1819 +CONFIG_SCHED_AUTOGROUP=y
1820 +CONFIG_EMBEDDED=y
1821 +# CONFIG_COMPAT_BRK is not set
1822 +CONFIG_SLAB=y
1823 +CONFIG_PROFILING=y
1824 +CONFIG_OPROFILE=m
1825 +CONFIG_KPROBES=y
1826 +CONFIG_MODULES=y
1827 +CONFIG_MODULE_UNLOAD=y
1828 +CONFIG_MODVERSIONS=y
1829 +CONFIG_MODULE_SRCVERSION_ALL=y
1830 +# CONFIG_BLK_DEV_BSG is not set
1831 +CONFIG_BLK_DEV_THROTTLING=y
1832 +CONFIG_CFQ_GROUP_IOSCHED=y
1833 +CONFIG_ARCH_BCM2708=y
1834 +CONFIG_NO_HZ=y
1835 +CONFIG_HIGH_RES_TIMERS=y
1836 +CONFIG_AEABI=y
1837 +CONFIG_SECCOMP=y
1838 +CONFIG_CC_STACKPROTECTOR=y
1839 +CONFIG_ZBOOT_ROM_TEXT=0x0
1840 +CONFIG_ZBOOT_ROM_BSS=0x0
1841 +CONFIG_CMDLINE="dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext3 rootwait"
1842 +CONFIG_KEXEC=y
1843 +CONFIG_CPU_IDLE=y
1844 +CONFIG_VFP=y
1845 +CONFIG_BINFMT_MISC=m
1846 +CONFIG_NET=y
1847 +CONFIG_PACKET=y
1848 +CONFIG_UNIX=y
1849 +CONFIG_XFRM_USER=y
1850 +CONFIG_NET_KEY=m
1851 +CONFIG_INET=y
1852 +CONFIG_IP_MULTICAST=y
1853 +CONFIG_IP_PNP=y
1854 +CONFIG_IP_PNP_DHCP=y
1855 +CONFIG_IP_PNP_RARP=y
1856 +CONFIG_SYN_COOKIES=y
1857 +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
1858 +# CONFIG_INET_XFRM_MODE_TUNNEL is not set
1859 +# CONFIG_INET_XFRM_MODE_BEET is not set
1860 +# CONFIG_INET_LRO is not set
1861 +# CONFIG_INET_DIAG is not set
1862 +# CONFIG_IPV6 is not set
1863 +CONFIG_NET_PKTGEN=m
1864 +CONFIG_IRDA=m
1865 +CONFIG_IRLAN=m
1866 +CONFIG_IRCOMM=m
1867 +CONFIG_IRDA_ULTRA=y
1868 +CONFIG_IRDA_CACHE_LAST_LSAP=y
1869 +CONFIG_IRDA_FAST_RR=y
1870 +CONFIG_IRTTY_SIR=m
1871 +CONFIG_KINGSUN_DONGLE=m
1872 +CONFIG_KSDAZZLE_DONGLE=m
1873 +CONFIG_KS959_DONGLE=m
1874 +CONFIG_USB_IRDA=m
1875 +CONFIG_SIGMATEL_FIR=m
1876 +CONFIG_MCS_FIR=m
1877 +CONFIG_BT=m
1878 +CONFIG_BT_L2CAP=y
1879 +CONFIG_BT_SCO=y
1880 +CONFIG_BT_RFCOMM=m
1881 +CONFIG_BT_RFCOMM_TTY=y
1882 +CONFIG_BT_BNEP=m
1883 +CONFIG_BT_BNEP_MC_FILTER=y
1884 +CONFIG_BT_BNEP_PROTO_FILTER=y
1885 +CONFIG_BT_HIDP=m
1886 +CONFIG_BT_HCIBTUSB=m
1887 +CONFIG_BT_HCIBCM203X=m
1888 +CONFIG_BT_HCIBPA10X=m
1889 +CONFIG_BT_HCIBFUSB=m
1890 +CONFIG_BT_HCIVHCI=m
1891 +CONFIG_BT_MRVL=m
1892 +CONFIG_BT_MRVL_SDIO=m
1893 +CONFIG_BT_ATH3K=m
1894 +CONFIG_CFG80211=m
1895 +CONFIG_MAC80211=m
1896 +CONFIG_MAC80211_RC_PID=y
1897 +CONFIG_MAC80211_MESH=y
1898 +CONFIG_WIMAX=m
1899 +CONFIG_NET_9P=m
1900 +CONFIG_NFC=m
1901 +CONFIG_NFC_PN533=m
1902 +CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
1903 +CONFIG_BLK_DEV_LOOP=y
1904 +CONFIG_BLK_DEV_CRYPTOLOOP=m
1905 +CONFIG_BLK_DEV_NBD=m
1906 +CONFIG_BLK_DEV_RAM=y
1907 +CONFIG_CDROM_PKTCDVD=m
1908 +CONFIG_MISC_DEVICES=y
1909 +CONFIG_SCSI=y
1910 +# CONFIG_SCSI_PROC_FS is not set
1911 +CONFIG_BLK_DEV_SD=y
1912 +CONFIG_BLK_DEV_SR=m
1913 +CONFIG_SCSI_MULTI_LUN=y
1914 +# CONFIG_SCSI_LOWLEVEL is not set
1915 +CONFIG_MD=y
1916 +CONFIG_NETDEVICES=y
1917 +CONFIG_TUN=m
1918 +CONFIG_PHYLIB=m
1919 +CONFIG_MDIO_BITBANG=m
1920 +CONFIG_NET_ETHERNET=y
1921 +# CONFIG_NETDEV_1000 is not set
1922 +# CONFIG_NETDEV_10000 is not set
1923 +CONFIG_LIBERTAS_THINFIRM=m
1924 +CONFIG_LIBERTAS_THINFIRM_USB=m
1925 +CONFIG_AT76C50X_USB=m
1926 +CONFIG_USB_ZD1201=m
1927 +CONFIG_USB_NET_RNDIS_WLAN=m
1928 +CONFIG_RTL8187=m
1929 +CONFIG_MAC80211_HWSIM=m
1930 +CONFIG_ATH_COMMON=m
1931 +CONFIG_ATH9K=m
1932 +CONFIG_ATH9K_HTC=m
1933 +CONFIG_CARL9170=m
1934 +CONFIG_B43=m
1935 +CONFIG_B43LEGACY=m
1936 +CONFIG_HOSTAP=m
1937 +CONFIG_IWM=m
1938 +CONFIG_LIBERTAS=m
1939 +CONFIG_LIBERTAS_USB=m
1940 +CONFIG_LIBERTAS_SDIO=m
1941 +CONFIG_P54_COMMON=m
1942 +CONFIG_P54_USB=m
1943 +CONFIG_RT2X00=m
1944 +CONFIG_RT2500USB=m
1945 +CONFIG_RT73USB=m
1946 +CONFIG_RT2800USB=m
1947 +CONFIG_RT2800USB_RT53XX=y
1948 +CONFIG_RTL8192CU=m
1949 +CONFIG_WL1251=m
1950 +CONFIG_WL12XX_MENU=m
1951 +CONFIG_ZD1211RW=m
1952 +CONFIG_MWIFIEX=m
1953 +CONFIG_MWIFIEX_SDIO=m
1954 +CONFIG_WIMAX_I2400M_USB=m
1955 +CONFIG_USB_CATC=m
1956 +CONFIG_USB_KAWETH=m
1957 +CONFIG_USB_PEGASUS=m
1958 +CONFIG_USB_RTL8150=m
1959 +CONFIG_USB_USBNET=y
1960 +CONFIG_USB_NET_AX8817X=m
1961 +CONFIG_USB_NET_CDCETHER=m
1962 +CONFIG_USB_NET_CDC_EEM=m
1963 +CONFIG_USB_NET_DM9601=m
1964 +CONFIG_USB_NET_SMSC75XX=m
1965 +CONFIG_USB_NET_SMSC95XX=y
1966 +CONFIG_USB_NET_GL620A=m
1967 +CONFIG_USB_NET_NET1080=m
1968 +CONFIG_USB_NET_PLUSB=m
1969 +CONFIG_USB_NET_MCS7830=m
1970 +CONFIG_USB_NET_CDC_SUBSET=m
1971 +CONFIG_USB_ALI_M5632=y
1972 +CONFIG_USB_AN2720=y
1973 +CONFIG_USB_KC2190=y
1974 +# CONFIG_USB_NET_ZAURUS is not set
1975 +CONFIG_USB_NET_CX82310_ETH=m
1976 +CONFIG_USB_NET_KALMIA=m
1977 +CONFIG_USB_NET_INT51X1=m
1978 +CONFIG_USB_IPHETH=m
1979 +CONFIG_USB_SIERRA_NET=m
1980 +CONFIG_USB_VL600=m
1981 +CONFIG_PPP=m
1982 +CONFIG_PPP_ASYNC=m
1983 +CONFIG_PPP_SYNC_TTY=m
1984 +CONFIG_PPP_DEFLATE=m
1985 +CONFIG_PPP_BSDCOMP=m
1986 +CONFIG_SLIP=m
1987 +CONFIG_SLIP_COMPRESSED=y
1988 +CONFIG_NETCONSOLE=m
1989 +CONFIG_INPUT_POLLDEV=m
1990 +# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
1991 +CONFIG_INPUT_JOYDEV=m
1992 +CONFIG_INPUT_EVDEV=m
1993 +# CONFIG_INPUT_KEYBOARD is not set
1994 +# CONFIG_INPUT_MOUSE is not set
1995 +CONFIG_INPUT_MISC=y
1996 +CONFIG_INPUT_AD714X=m
1997 +CONFIG_INPUT_ATI_REMOTE=m
1998 +CONFIG_INPUT_ATI_REMOTE2=m
1999 +CONFIG_INPUT_KEYSPAN_REMOTE=m
2000 +CONFIG_INPUT_POWERMATE=m
2001 +CONFIG_INPUT_YEALINK=m
2002 +CONFIG_INPUT_CM109=m
2003 +CONFIG_INPUT_UINPUT=m
2004 +CONFIG_INPUT_GPIO_ROTARY_ENCODER=m
2005 +CONFIG_INPUT_ADXL34X=m
2006 +CONFIG_INPUT_CMA3000=m
2007 +CONFIG_SERIO=m
2008 +CONFIG_SERIO_RAW=m
2009 +CONFIG_GAMEPORT=m
2010 +CONFIG_GAMEPORT_NS558=m
2011 +CONFIG_GAMEPORT_L4=m
2012 +CONFIG_VT_HW_CONSOLE_BINDING=y
2013 +# CONFIG_LEGACY_PTYS is not set
2014 +# CONFIG_DEVKMEM is not set
2015 +CONFIG_SERIAL_AMBA_PL011=y
2016 +CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
2017 +# CONFIG_HW_RANDOM is not set
2018 +CONFIG_RAW_DRIVER=y
2019 +CONFIG_GPIO_SYSFS=y
2020 +# CONFIG_HWMON is not set
2021 +CONFIG_WATCHDOG=y
2022 +CONFIG_BCM2708_WDT=m
2023 +# CONFIG_MFD_SUPPORT is not set
2024 +CONFIG_FB=y
2025 +CONFIG_FB_BCM2708=y
2026 +CONFIG_FRAMEBUFFER_CONSOLE=y
2027 +CONFIG_LOGO=y
2028 +# CONFIG_LOGO_LINUX_MONO is not set
2029 +# CONFIG_LOGO_LINUX_VGA16 is not set
2030 +CONFIG_SOUND=y
2031 +CONFIG_SND=m
2032 +CONFIG_SND_SEQUENCER=m
2033 +CONFIG_SND_SEQ_DUMMY=m
2034 +CONFIG_SND_MIXER_OSS=m
2035 +CONFIG_SND_PCM_OSS=m
2036 +CONFIG_SND_SEQUENCER_OSS=y
2037 +CONFIG_SND_HRTIMER=m
2038 +CONFIG_SND_DUMMY=m
2039 +CONFIG_SND_ALOOP=m
2040 +CONFIG_SND_VIRMIDI=m
2041 +CONFIG_SND_MTPAV=m
2042 +CONFIG_SND_SERIAL_U16550=m
2043 +CONFIG_SND_MPU401=m
2044 +CONFIG_SND_BCM2835=m
2045 +CONFIG_SND_USB_AUDIO=m
2046 +CONFIG_SND_USB_UA101=m
2047 +CONFIG_SND_USB_CAIAQ=m
2048 +CONFIG_SND_USB_6FIRE=m
2049 +CONFIG_SOUND_PRIME=m
2050 +CONFIG_HID_PID=y
2051 +CONFIG_USB_HIDDEV=y
2052 +CONFIG_HID_A4TECH=m
2053 +CONFIG_HID_ACRUX=m
2054 +CONFIG_HID_APPLE=m
2055 +CONFIG_HID_BELKIN=m
2056 +CONFIG_HID_CHERRY=m
2057 +CONFIG_HID_CHICONY=m
2058 +CONFIG_HID_CYPRESS=m
2059 +CONFIG_HID_DRAGONRISE=m
2060 +CONFIG_HID_EMS_FF=m
2061 +CONFIG_HID_ELECOM=m
2062 +CONFIG_HID_EZKEY=m
2063 +CONFIG_HID_HOLTEK=m
2064 +CONFIG_HID_KEYTOUCH=m
2065 +CONFIG_HID_KYE=m
2066 +CONFIG_HID_UCLOGIC=m
2067 +CONFIG_HID_WALTOP=m
2068 +CONFIG_HID_GYRATION=m
2069 +CONFIG_HID_TWINHAN=m
2070 +CONFIG_HID_KENSINGTON=m
2071 +CONFIG_HID_LCPOWER=m
2072 +CONFIG_HID_LOGITECH=m
2073 +CONFIG_HID_MAGICMOUSE=m
2074 +CONFIG_HID_MICROSOFT=m
2075 +CONFIG_HID_MONTEREY=m
2076 +CONFIG_HID_MULTITOUCH=m
2077 +CONFIG_HID_NTRIG=m
2078 +CONFIG_HID_ORTEK=m
2079 +CONFIG_HID_PANTHERLORD=m
2080 +CONFIG_HID_PETALYNX=m
2081 +CONFIG_HID_PICOLCD=m
2082 +CONFIG_HID_QUANTA=m
2083 +CONFIG_HID_ROCCAT=m
2084 +CONFIG_HID_SAMSUNG=m
2085 +CONFIG_HID_SONY=m
2086 +CONFIG_HID_SPEEDLINK=m
2087 +CONFIG_HID_SUNPLUS=m
2088 +CONFIG_HID_GREENASIA=m
2089 +CONFIG_HID_SMARTJOYPLUS=m
2090 +CONFIG_HID_TOPSEED=m
2091 +CONFIG_HID_THRUSTMASTER=m
2092 +CONFIG_HID_WACOM=m
2093 +CONFIG_HID_WIIMOTE=m
2094 +CONFIG_HID_ZEROPLUS=m
2095 +CONFIG_HID_ZYDACRON=m
2096 +CONFIG_USB=y
2097 +CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
2098 +CONFIG_USB_MON=m
2099 +CONFIG_USB_DWCOTG=y
2100 +CONFIG_USB_STORAGE=y
2101 +CONFIG_USB_STORAGE_REALTEK=m
2102 +CONFIG_USB_STORAGE_DATAFAB=m
2103 +CONFIG_USB_STORAGE_FREECOM=m
2104 +CONFIG_USB_STORAGE_ISD200=m
2105 +CONFIG_USB_STORAGE_USBAT=m
2106 +CONFIG_USB_STORAGE_SDDR09=m
2107 +CONFIG_USB_STORAGE_SDDR55=m
2108 +CONFIG_USB_STORAGE_JUMPSHOT=m
2109 +CONFIG_USB_STORAGE_ALAUDA=m
2110 +CONFIG_USB_STORAGE_ONETOUCH=m
2111 +CONFIG_USB_STORAGE_KARMA=m
2112 +CONFIG_USB_STORAGE_CYPRESS_ATACB=m
2113 +CONFIG_USB_STORAGE_ENE_UB6250=m
2114 +CONFIG_USB_UAS=y
2115 +CONFIG_USB_LIBUSUAL=y
2116 +CONFIG_USB_MDC800=m
2117 +CONFIG_USB_MICROTEK=m
2118 +CONFIG_USB_SERIAL=m
2119 +CONFIG_USB_SERIAL_GENERIC=y
2120 +CONFIG_USB_SERIAL_AIRCABLE=m
2121 +CONFIG_USB_SERIAL_ARK3116=m
2122 +CONFIG_USB_SERIAL_BELKIN=m
2123 +CONFIG_USB_SERIAL_CH341=m
2124 +CONFIG_USB_SERIAL_WHITEHEAT=m
2125 +CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
2126 +CONFIG_USB_SERIAL_CP210X=m
2127 +CONFIG_USB_SERIAL_CYPRESS_M8=m
2128 +CONFIG_USB_SERIAL_EMPEG=m
2129 +CONFIG_USB_SERIAL_FTDI_SIO=m
2130 +CONFIG_USB_SERIAL_FUNSOFT=m
2131 +CONFIG_USB_SERIAL_VISOR=m
2132 +CONFIG_USB_SERIAL_IPAQ=m
2133 +CONFIG_USB_SERIAL_IR=m
2134 +CONFIG_USB_SERIAL_EDGEPORT=m
2135 +CONFIG_USB_SERIAL_EDGEPORT_TI=m
2136 +CONFIG_USB_SERIAL_GARMIN=m
2137 +CONFIG_USB_SERIAL_IPW=m
2138 +CONFIG_USB_SERIAL_IUU=m
2139 +CONFIG_USB_SERIAL_KEYSPAN_PDA=m
2140 +CONFIG_USB_SERIAL_KEYSPAN=m
2141 +CONFIG_USB_SERIAL_KLSI=m
2142 +CONFIG_USB_SERIAL_KOBIL_SCT=m
2143 +CONFIG_USB_SERIAL_MCT_U232=m
2144 +CONFIG_USB_SERIAL_MOS7720=m
2145 +CONFIG_USB_SERIAL_MOS7840=m
2146 +CONFIG_USB_SERIAL_MOTOROLA=m
2147 +CONFIG_USB_SERIAL_NAVMAN=m
2148 +CONFIG_USB_SERIAL_PL2303=m
2149 +CONFIG_USB_SERIAL_OTI6858=m
2150 +CONFIG_USB_SERIAL_QCAUX=m
2151 +CONFIG_USB_SERIAL_QUALCOMM=m
2152 +CONFIG_USB_SERIAL_SPCP8X5=m
2153 +CONFIG_USB_SERIAL_HP4X=m
2154 +CONFIG_USB_SERIAL_SAFE=m
2155 +CONFIG_USB_SERIAL_SIEMENS_MPI=m
2156 +CONFIG_USB_SERIAL_SIERRAWIRELESS=m
2157 +CONFIG_USB_SERIAL_SYMBOL=m
2158 +CONFIG_USB_SERIAL_TI=m
2159 +CONFIG_USB_SERIAL_CYBERJACK=m
2160 +CONFIG_USB_SERIAL_XIRCOM=m
2161 +CONFIG_USB_SERIAL_OPTION=m
2162 +CONFIG_USB_SERIAL_OMNINET=m
2163 +CONFIG_USB_SERIAL_OPTICON=m
2164 +CONFIG_USB_SERIAL_VIVOPAY_SERIAL=m
2165 +CONFIG_USB_SERIAL_ZIO=m
2166 +CONFIG_USB_SERIAL_SSU100=m
2167 +CONFIG_USB_SERIAL_DEBUG=m
2168 +CONFIG_USB_EMI62=m
2169 +CONFIG_USB_EMI26=m
2170 +CONFIG_USB_ADUTUX=m
2171 +CONFIG_USB_SEVSEG=m
2172 +CONFIG_USB_RIO500=m
2173 +CONFIG_USB_LEGOTOWER=m
2174 +CONFIG_USB_LCD=m
2175 +CONFIG_USB_LED=m
2176 +CONFIG_USB_CYPRESS_CY7C63=m
2177 +CONFIG_USB_CYTHERM=m
2178 +CONFIG_USB_IDMOUSE=m
2179 +CONFIG_USB_FTDI_ELAN=m
2180 +CONFIG_USB_APPLEDISPLAY=m
2181 +CONFIG_USB_LD=m
2182 +CONFIG_USB_TRANCEVIBRATOR=m
2183 +CONFIG_USB_IOWARRIOR=m
2184 +CONFIG_USB_TEST=m
2185 +CONFIG_USB_ISIGHTFW=m
2186 +CONFIG_USB_YUREX=m
2187 +CONFIG_MMC=y
2188 +CONFIG_MMC_SDHCI=y
2189 +CONFIG_MMC_SDHCI_PLTFM=y
2190 +CONFIG_MMC_SDHCI_BCM2708=y
2191 +CONFIG_MMC_SDHCI_BCM2708_DMA=y
2192 +CONFIG_LEDS_GPIO=y
2193 +CONFIG_LEDS_TRIGGER_TIMER=m
2194 +CONFIG_LEDS_TRIGGER_HEARTBEAT=m
2195 +CONFIG_LEDS_TRIGGER_DEFAULT_ON=m
2196 +CONFIG_UIO=m
2197 +CONFIG_UIO_PDRV=m
2198 +CONFIG_UIO_PDRV_GENIRQ=m
2199 +# CONFIG_IOMMU_SUPPORT is not set
2200 +CONFIG_EXT4_FS=y
2201 +CONFIG_EXT4_FS_POSIX_ACL=y
2202 +CONFIG_EXT4_FS_SECURITY=y
2203 +CONFIG_REISERFS_FS=m
2204 +CONFIG_REISERFS_FS_XATTR=y
2205 +CONFIG_REISERFS_FS_POSIX_ACL=y
2206 +CONFIG_REISERFS_FS_SECURITY=y
2207 +CONFIG_JFS_FS=m
2208 +CONFIG_JFS_POSIX_ACL=y
2209 +CONFIG_JFS_SECURITY=y
2210 +CONFIG_JFS_STATISTICS=y
2211 +CONFIG_XFS_FS=m
2212 +CONFIG_XFS_QUOTA=y
2213 +CONFIG_XFS_POSIX_ACL=y
2214 +CONFIG_XFS_RT=y
2215 +CONFIG_GFS2_FS=m
2216 +CONFIG_OCFS2_FS=m
2217 +CONFIG_BTRFS_FS=m
2218 +CONFIG_BTRFS_FS_POSIX_ACL=y
2219 +CONFIG_NILFS2_FS=m
2220 +CONFIG_FANOTIFY=y
2221 +CONFIG_AUTOFS4_FS=y
2222 +CONFIG_FUSE_FS=m
2223 +CONFIG_CUSE=m
2224 +CONFIG_FSCACHE=y
2225 +CONFIG_FSCACHE_STATS=y
2226 +CONFIG_FSCACHE_HISTOGRAM=y
2227 +CONFIG_CACHEFILES=y
2228 +CONFIG_ISO9660_FS=m
2229 +CONFIG_JOLIET=y
2230 +CONFIG_ZISOFS=y
2231 +CONFIG_UDF_FS=m
2232 +CONFIG_MSDOS_FS=y
2233 +CONFIG_VFAT_FS=y
2234 +CONFIG_FAT_DEFAULT_IOCHARSET="ascii"
2235 +CONFIG_NTFS_FS=m
2236 +CONFIG_TMPFS=y
2237 +CONFIG_TMPFS_POSIX_ACL=y
2238 +CONFIG_CONFIGFS_FS=y
2239 +CONFIG_SQUASHFS=m
2240 +CONFIG_SQUASHFS_XATTR=y
2241 +CONFIG_SQUASHFS_LZO=y
2242 +CONFIG_SQUASHFS_XZ=y
2243 +CONFIG_NFS_FS=y
2244 +CONFIG_NFS_V3=y
2245 +CONFIG_NFS_V3_ACL=y
2246 +CONFIG_NFS_V4=y
2247 +CONFIG_ROOT_NFS=y
2248 +CONFIG_NFS_FSCACHE=y
2249 +CONFIG_CIFS=m
2250 +CONFIG_CIFS_WEAK_PW_HASH=y
2251 +CONFIG_CIFS_XATTR=y
2252 +CONFIG_CIFS_POSIX=y
2253 +CONFIG_9P_FS=m
2254 +CONFIG_9P_FS_POSIX_ACL=y
2255 +CONFIG_PARTITION_ADVANCED=y
2256 +CONFIG_MAC_PARTITION=y
2257 +CONFIG_EFI_PARTITION=y
2258 +CONFIG_NLS_DEFAULT="utf8"
2259 +CONFIG_NLS_CODEPAGE_437=y
2260 +CONFIG_NLS_CODEPAGE_737=m
2261 +CONFIG_NLS_CODEPAGE_775=m
2262 +CONFIG_NLS_CODEPAGE_850=m
2263 +CONFIG_NLS_CODEPAGE_852=m
2264 +CONFIG_NLS_CODEPAGE_855=m
2265 +CONFIG_NLS_CODEPAGE_857=m
2266 +CONFIG_NLS_CODEPAGE_860=m
2267 +CONFIG_NLS_CODEPAGE_861=m
2268 +CONFIG_NLS_CODEPAGE_862=m
2269 +CONFIG_NLS_CODEPAGE_863=m
2270 +CONFIG_NLS_CODEPAGE_864=m
2271 +CONFIG_NLS_CODEPAGE_865=m
2272 +CONFIG_NLS_CODEPAGE_866=m
2273 +CONFIG_NLS_CODEPAGE_869=m
2274 +CONFIG_NLS_CODEPAGE_936=m
2275 +CONFIG_NLS_CODEPAGE_950=m
2276 +CONFIG_NLS_CODEPAGE_932=m
2277 +CONFIG_NLS_CODEPAGE_949=m
2278 +CONFIG_NLS_CODEPAGE_874=m
2279 +CONFIG_NLS_ISO8859_8=m
2280 +CONFIG_NLS_CODEPAGE_1250=m
2281 +CONFIG_NLS_CODEPAGE_1251=m
2282 +CONFIG_NLS_ASCII=y
2283 +CONFIG_NLS_ISO8859_1=m
2284 +CONFIG_NLS_ISO8859_2=m
2285 +CONFIG_NLS_ISO8859_3=m
2286 +CONFIG_NLS_ISO8859_4=m
2287 +CONFIG_NLS_ISO8859_5=m
2288 +CONFIG_NLS_ISO8859_6=m
2289 +CONFIG_NLS_ISO8859_7=m
2290 +CONFIG_NLS_ISO8859_9=m
2291 +CONFIG_NLS_ISO8859_13=m
2292 +CONFIG_NLS_ISO8859_14=m
2293 +CONFIG_NLS_ISO8859_15=m
2294 +CONFIG_NLS_KOI8_R=m
2295 +CONFIG_NLS_KOI8_U=m
2296 +CONFIG_NLS_UTF8=m
2297 +CONFIG_PRINTK_TIME=y
2298 +CONFIG_DETECT_HUNG_TASK=y
2299 +CONFIG_TIMER_STATS=y
2300 +CONFIG_DEBUG_STACK_USAGE=y
2301 +CONFIG_DEBUG_INFO=y
2302 +CONFIG_DEBUG_MEMORY_INIT=y
2303 +CONFIG_BOOT_PRINTK_DELAY=y
2304 +CONFIG_LATENCYTOP=y
2305 +CONFIG_SYSCTL_SYSCALL_CHECK=y
2306 +CONFIG_IRQSOFF_TRACER=y
2307 +CONFIG_SCHED_TRACER=y
2308 +CONFIG_STACK_TRACER=y
2309 +CONFIG_BLK_DEV_IO_TRACE=y
2310 +CONFIG_FUNCTION_PROFILER=y
2311 +CONFIG_KGDB=y
2312 +CONFIG_KGDB_KDB=y
2313 +CONFIG_KDB_KEYBOARD=y
2314 +CONFIG_STRICT_DEVMEM=y
2315 +CONFIG_CRYPTO_AUTHENC=m
2316 +CONFIG_CRYPTO_SEQIV=m
2317 +CONFIG_CRYPTO_CBC=y
2318 +CONFIG_CRYPTO_HMAC=y
2319 +CONFIG_CRYPTO_XCBC=m
2320 +CONFIG_CRYPTO_MD5=y
2321 +CONFIG_CRYPTO_SHA1=y
2322 +CONFIG_CRYPTO_SHA256=m
2323 +CONFIG_CRYPTO_SHA512=m
2324 +CONFIG_CRYPTO_TGR192=m
2325 +CONFIG_CRYPTO_WP512=m
2326 +CONFIG_CRYPTO_CAST5=m
2327 +CONFIG_CRYPTO_DES=y
2328 +CONFIG_CRYPTO_DEFLATE=m
2329 +# CONFIG_CRYPTO_ANSI_CPRNG is not set
2330 +# CONFIG_CRYPTO_HW is not set
2331 +CONFIG_CRC_ITU_T=y
2332 +CONFIG_LIBCRC32C=y
2333 --- /dev/null
2334 +++ b/arch/arm/configs/bcmrpi_emergency_defconfig
2335 @@ -0,0 +1,532 @@
2336 +CONFIG_EXPERIMENTAL=y
2337 +# CONFIG_LOCALVERSION_AUTO is not set
2338 +CONFIG_SYSVIPC=y
2339 +CONFIG_POSIX_MQUEUE=y
2340 +CONFIG_BSD_PROCESS_ACCT=y
2341 +CONFIG_BSD_PROCESS_ACCT_V3=y
2342 +CONFIG_FHANDLE=y
2343 +CONFIG_AUDIT=y
2344 +CONFIG_IKCONFIG=y
2345 +CONFIG_IKCONFIG_PROC=y
2346 +CONFIG_BLK_DEV_INITRD=y
2347 +CONFIG_INITRAMFS_SOURCE="../target_fs"
2348 +CONFIG_CGROUP_FREEZER=y
2349 +CONFIG_CGROUP_DEVICE=y
2350 +CONFIG_CGROUP_CPUACCT=y
2351 +CONFIG_RESOURCE_COUNTERS=y
2352 +CONFIG_BLK_CGROUP=y
2353 +CONFIG_NAMESPACES=y
2354 +CONFIG_SCHED_AUTOGROUP=y
2355 +CONFIG_EMBEDDED=y
2356 +# CONFIG_COMPAT_BRK is not set
2357 +CONFIG_SLAB=y
2358 +CONFIG_PROFILING=y
2359 +CONFIG_OPROFILE=m
2360 +CONFIG_KPROBES=y
2361 +CONFIG_MODULES=y
2362 +CONFIG_MODULE_UNLOAD=y
2363 +CONFIG_MODVERSIONS=y
2364 +CONFIG_MODULE_SRCVERSION_ALL=y
2365 +# CONFIG_BLK_DEV_BSG is not set
2366 +CONFIG_BLK_DEV_THROTTLING=y
2367 +CONFIG_CFQ_GROUP_IOSCHED=y
2368 +CONFIG_ARCH_BCM2708=y
2369 +CONFIG_NO_HZ=y
2370 +CONFIG_HIGH_RES_TIMERS=y
2371 +CONFIG_AEABI=y
2372 +CONFIG_SECCOMP=y
2373 +CONFIG_CC_STACKPROTECTOR=y
2374 +CONFIG_ZBOOT_ROM_TEXT=0x0
2375 +CONFIG_ZBOOT_ROM_BSS=0x0
2376 +CONFIG_CMDLINE="dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext3 rootwait"
2377 +CONFIG_KEXEC=y
2378 +CONFIG_CPU_IDLE=y
2379 +CONFIG_VFP=y
2380 +CONFIG_BINFMT_MISC=m
2381 +CONFIG_NET=y
2382 +CONFIG_PACKET=y
2383 +CONFIG_UNIX=y
2384 +CONFIG_XFRM_USER=y
2385 +CONFIG_NET_KEY=m
2386 +CONFIG_INET=y
2387 +CONFIG_IP_MULTICAST=y
2388 +CONFIG_IP_PNP=y
2389 +CONFIG_IP_PNP_DHCP=y
2390 +CONFIG_IP_PNP_RARP=y
2391 +CONFIG_SYN_COOKIES=y
2392 +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
2393 +# CONFIG_INET_XFRM_MODE_TUNNEL is not set
2394 +# CONFIG_INET_XFRM_MODE_BEET is not set
2395 +# CONFIG_INET_LRO is not set
2396 +# CONFIG_INET_DIAG is not set
2397 +# CONFIG_IPV6 is not set
2398 +CONFIG_NET_PKTGEN=m
2399 +CONFIG_IRDA=m
2400 +CONFIG_IRLAN=m
2401 +CONFIG_IRCOMM=m
2402 +CONFIG_IRDA_ULTRA=y
2403 +CONFIG_IRDA_CACHE_LAST_LSAP=y
2404 +CONFIG_IRDA_FAST_RR=y
2405 +CONFIG_IRTTY_SIR=m
2406 +CONFIG_KINGSUN_DONGLE=m
2407 +CONFIG_KSDAZZLE_DONGLE=m
2408 +CONFIG_KS959_DONGLE=m
2409 +CONFIG_USB_IRDA=m
2410 +CONFIG_SIGMATEL_FIR=m
2411 +CONFIG_MCS_FIR=m
2412 +CONFIG_BT=m
2413 +CONFIG_BT_L2CAP=y
2414 +CONFIG_BT_SCO=y
2415 +CONFIG_BT_RFCOMM=m
2416 +CONFIG_BT_RFCOMM_TTY=y
2417 +CONFIG_BT_BNEP=m
2418 +CONFIG_BT_BNEP_MC_FILTER=y
2419 +CONFIG_BT_BNEP_PROTO_FILTER=y
2420 +CONFIG_BT_HIDP=m
2421 +CONFIG_BT_HCIBTUSB=m
2422 +CONFIG_BT_HCIBCM203X=m
2423 +CONFIG_BT_HCIBPA10X=m
2424 +CONFIG_BT_HCIBFUSB=m
2425 +CONFIG_BT_HCIVHCI=m
2426 +CONFIG_BT_MRVL=m
2427 +CONFIG_BT_MRVL_SDIO=m
2428 +CONFIG_BT_ATH3K=m
2429 +CONFIG_CFG80211=m
2430 +CONFIG_MAC80211=m
2431 +CONFIG_MAC80211_RC_PID=y
2432 +CONFIG_MAC80211_MESH=y
2433 +CONFIG_WIMAX=m
2434 +CONFIG_NET_9P=m
2435 +CONFIG_NFC=m
2436 +CONFIG_NFC_PN533=m
2437 +CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
2438 +CONFIG_BLK_DEV_LOOP=y
2439 +CONFIG_BLK_DEV_CRYPTOLOOP=m
2440 +CONFIG_BLK_DEV_NBD=m
2441 +CONFIG_BLK_DEV_RAM=y
2442 +CONFIG_CDROM_PKTCDVD=m
2443 +CONFIG_MISC_DEVICES=y
2444 +CONFIG_SCSI=y
2445 +# CONFIG_SCSI_PROC_FS is not set
2446 +CONFIG_BLK_DEV_SD=y
2447 +CONFIG_BLK_DEV_SR=m
2448 +CONFIG_SCSI_MULTI_LUN=y
2449 +# CONFIG_SCSI_LOWLEVEL is not set
2450 +CONFIG_MD=y
2451 +CONFIG_NETDEVICES=y
2452 +CONFIG_TUN=m
2453 +CONFIG_PHYLIB=m
2454 +CONFIG_MDIO_BITBANG=m
2455 +CONFIG_NET_ETHERNET=y
2456 +# CONFIG_NETDEV_1000 is not set
2457 +# CONFIG_NETDEV_10000 is not set
2458 +CONFIG_LIBERTAS_THINFIRM=m
2459 +CONFIG_LIBERTAS_THINFIRM_USB=m
2460 +CONFIG_AT76C50X_USB=m
2461 +CONFIG_USB_ZD1201=m
2462 +CONFIG_USB_NET_RNDIS_WLAN=m
2463 +CONFIG_RTL8187=m
2464 +CONFIG_MAC80211_HWSIM=m
2465 +CONFIG_ATH_COMMON=m
2466 +CONFIG_ATH9K=m
2467 +CONFIG_ATH9K_HTC=m
2468 +CONFIG_CARL9170=m
2469 +CONFIG_B43=m
2470 +CONFIG_B43LEGACY=m
2471 +CONFIG_HOSTAP=m
2472 +CONFIG_IWM=m
2473 +CONFIG_LIBERTAS=m
2474 +CONFIG_LIBERTAS_USB=m
2475 +CONFIG_LIBERTAS_SDIO=m
2476 +CONFIG_P54_COMMON=m
2477 +CONFIG_P54_USB=m
2478 +CONFIG_RT2X00=m
2479 +CONFIG_RT2500USB=m
2480 +CONFIG_RT73USB=m
2481 +CONFIG_RT2800USB=m
2482 +CONFIG_RT2800USB_RT53XX=y
2483 +CONFIG_RTL8192CU=m
2484 +CONFIG_WL1251=m
2485 +CONFIG_WL12XX_MENU=m
2486 +CONFIG_ZD1211RW=m
2487 +CONFIG_MWIFIEX=m
2488 +CONFIG_MWIFIEX_SDIO=m
2489 +CONFIG_WIMAX_I2400M_USB=m
2490 +CONFIG_USB_CATC=m
2491 +CONFIG_USB_KAWETH=m
2492 +CONFIG_USB_PEGASUS=m
2493 +CONFIG_USB_RTL8150=m
2494 +CONFIG_USB_USBNET=y
2495 +CONFIG_USB_NET_AX8817X=m
2496 +CONFIG_USB_NET_CDCETHER=m
2497 +CONFIG_USB_NET_CDC_EEM=m
2498 +CONFIG_USB_NET_DM9601=m
2499 +CONFIG_USB_NET_SMSC75XX=m
2500 +CONFIG_USB_NET_SMSC95XX=y
2501 +CONFIG_USB_NET_GL620A=m
2502 +CONFIG_USB_NET_NET1080=m
2503 +CONFIG_USB_NET_PLUSB=m
2504 +CONFIG_USB_NET_MCS7830=m
2505 +CONFIG_USB_NET_CDC_SUBSET=m
2506 +CONFIG_USB_ALI_M5632=y
2507 +CONFIG_USB_AN2720=y
2508 +CONFIG_USB_KC2190=y
2509 +# CONFIG_USB_NET_ZAURUS is not set
2510 +CONFIG_USB_NET_CX82310_ETH=m
2511 +CONFIG_USB_NET_KALMIA=m
2512 +CONFIG_USB_NET_INT51X1=m
2513 +CONFIG_USB_IPHETH=m
2514 +CONFIG_USB_SIERRA_NET=m
2515 +CONFIG_USB_VL600=m
2516 +CONFIG_PPP=m
2517 +CONFIG_PPP_ASYNC=m
2518 +CONFIG_PPP_SYNC_TTY=m
2519 +CONFIG_PPP_DEFLATE=m
2520 +CONFIG_PPP_BSDCOMP=m
2521 +CONFIG_SLIP=m
2522 +CONFIG_SLIP_COMPRESSED=y
2523 +CONFIG_NETCONSOLE=m
2524 +CONFIG_INPUT_POLLDEV=m
2525 +# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
2526 +CONFIG_INPUT_JOYDEV=m
2527 +CONFIG_INPUT_EVDEV=m
2528 +# CONFIG_INPUT_KEYBOARD is not set
2529 +# CONFIG_INPUT_MOUSE is not set
2530 +CONFIG_INPUT_MISC=y
2531 +CONFIG_INPUT_AD714X=m
2532 +CONFIG_INPUT_ATI_REMOTE=m
2533 +CONFIG_INPUT_ATI_REMOTE2=m
2534 +CONFIG_INPUT_KEYSPAN_REMOTE=m
2535 +CONFIG_INPUT_POWERMATE=m
2536 +CONFIG_INPUT_YEALINK=m
2537 +CONFIG_INPUT_CM109=m
2538 +CONFIG_INPUT_UINPUT=m
2539 +CONFIG_INPUT_GPIO_ROTARY_ENCODER=m
2540 +CONFIG_INPUT_ADXL34X=m
2541 +CONFIG_INPUT_CMA3000=m
2542 +CONFIG_SERIO=m
2543 +CONFIG_SERIO_RAW=m
2544 +CONFIG_GAMEPORT=m
2545 +CONFIG_GAMEPORT_NS558=m
2546 +CONFIG_GAMEPORT_L4=m
2547 +CONFIG_VT_HW_CONSOLE_BINDING=y
2548 +# CONFIG_LEGACY_PTYS is not set
2549 +# CONFIG_DEVKMEM is not set
2550 +CONFIG_SERIAL_AMBA_PL011=y
2551 +CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
2552 +# CONFIG_HW_RANDOM is not set
2553 +CONFIG_RAW_DRIVER=y
2554 +CONFIG_GPIO_SYSFS=y
2555 +# CONFIG_HWMON is not set
2556 +CONFIG_WATCHDOG=y
2557 +CONFIG_BCM2708_WDT=m
2558 +# CONFIG_MFD_SUPPORT is not set
2559 +CONFIG_FB=y
2560 +CONFIG_FB_BCM2708=y
2561 +CONFIG_FRAMEBUFFER_CONSOLE=y
2562 +CONFIG_LOGO=y
2563 +# CONFIG_LOGO_LINUX_MONO is not set
2564 +# CONFIG_LOGO_LINUX_VGA16 is not set
2565 +CONFIG_SOUND=y
2566 +CONFIG_SND=m
2567 +CONFIG_SND_SEQUENCER=m
2568 +CONFIG_SND_SEQ_DUMMY=m
2569 +CONFIG_SND_MIXER_OSS=m
2570 +CONFIG_SND_PCM_OSS=m
2571 +CONFIG_SND_SEQUENCER_OSS=y
2572 +CONFIG_SND_HRTIMER=m
2573 +CONFIG_SND_DUMMY=m
2574 +CONFIG_SND_ALOOP=m
2575 +CONFIG_SND_VIRMIDI=m
2576 +CONFIG_SND_MTPAV=m
2577 +CONFIG_SND_SERIAL_U16550=m
2578 +CONFIG_SND_MPU401=m
2579 +CONFIG_SND_BCM2835=m
2580 +CONFIG_SND_USB_AUDIO=m
2581 +CONFIG_SND_USB_UA101=m
2582 +CONFIG_SND_USB_CAIAQ=m
2583 +CONFIG_SND_USB_6FIRE=m
2584 +CONFIG_SOUND_PRIME=m
2585 +CONFIG_HID_PID=y
2586 +CONFIG_USB_HIDDEV=y
2587 +CONFIG_HID_A4TECH=m
2588 +CONFIG_HID_ACRUX=m
2589 +CONFIG_HID_APPLE=m
2590 +CONFIG_HID_BELKIN=m
2591 +CONFIG_HID_CHERRY=m
2592 +CONFIG_HID_CHICONY=m
2593 +CONFIG_HID_CYPRESS=m
2594 +CONFIG_HID_DRAGONRISE=m
2595 +CONFIG_HID_EMS_FF=m
2596 +CONFIG_HID_ELECOM=m
2597 +CONFIG_HID_EZKEY=m
2598 +CONFIG_HID_HOLTEK=m
2599 +CONFIG_HID_KEYTOUCH=m
2600 +CONFIG_HID_KYE=m
2601 +CONFIG_HID_UCLOGIC=m
2602 +CONFIG_HID_WALTOP=m
2603 +CONFIG_HID_GYRATION=m
2604 +CONFIG_HID_TWINHAN=m
2605 +CONFIG_HID_KENSINGTON=m
2606 +CONFIG_HID_LCPOWER=m
2607 +CONFIG_HID_LOGITECH=m
2608 +CONFIG_HID_MAGICMOUSE=m
2609 +CONFIG_HID_MICROSOFT=m
2610 +CONFIG_HID_MONTEREY=m
2611 +CONFIG_HID_MULTITOUCH=m
2612 +CONFIG_HID_NTRIG=m
2613 +CONFIG_HID_ORTEK=m
2614 +CONFIG_HID_PANTHERLORD=m
2615 +CONFIG_HID_PETALYNX=m
2616 +CONFIG_HID_PICOLCD=m
2617 +CONFIG_HID_QUANTA=m
2618 +CONFIG_HID_ROCCAT=m
2619 +CONFIG_HID_SAMSUNG=m
2620 +CONFIG_HID_SONY=m
2621 +CONFIG_HID_SPEEDLINK=m
2622 +CONFIG_HID_SUNPLUS=m
2623 +CONFIG_HID_GREENASIA=m
2624 +CONFIG_HID_SMARTJOYPLUS=m
2625 +CONFIG_HID_TOPSEED=m
2626 +CONFIG_HID_THRUSTMASTER=m
2627 +CONFIG_HID_WACOM=m
2628 +CONFIG_HID_WIIMOTE=m
2629 +CONFIG_HID_ZEROPLUS=m
2630 +CONFIG_HID_ZYDACRON=m
2631 +CONFIG_USB=y
2632 +CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
2633 +CONFIG_USB_MON=m
2634 +CONFIG_USB_DWCOTG=y
2635 +CONFIG_USB_STORAGE=y
2636 +CONFIG_USB_STORAGE_REALTEK=m
2637 +CONFIG_USB_STORAGE_DATAFAB=m
2638 +CONFIG_USB_STORAGE_FREECOM=m
2639 +CONFIG_USB_STORAGE_ISD200=m
2640 +CONFIG_USB_STORAGE_USBAT=m
2641 +CONFIG_USB_STORAGE_SDDR09=m
2642 +CONFIG_USB_STORAGE_SDDR55=m
2643 +CONFIG_USB_STORAGE_JUMPSHOT=m
2644 +CONFIG_USB_STORAGE_ALAUDA=m
2645 +CONFIG_USB_STORAGE_ONETOUCH=m
2646 +CONFIG_USB_STORAGE_KARMA=m
2647 +CONFIG_USB_STORAGE_CYPRESS_ATACB=m
2648 +CONFIG_USB_STORAGE_ENE_UB6250=m
2649 +CONFIG_USB_UAS=y
2650 +CONFIG_USB_LIBUSUAL=y
2651 +CONFIG_USB_MDC800=m
2652 +CONFIG_USB_MICROTEK=m
2653 +CONFIG_USB_SERIAL=m
2654 +CONFIG_USB_SERIAL_GENERIC=y
2655 +CONFIG_USB_SERIAL_AIRCABLE=m
2656 +CONFIG_USB_SERIAL_ARK3116=m
2657 +CONFIG_USB_SERIAL_BELKIN=m
2658 +CONFIG_USB_SERIAL_CH341=m
2659 +CONFIG_USB_SERIAL_WHITEHEAT=m
2660 +CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
2661 +CONFIG_USB_SERIAL_CP210X=m
2662 +CONFIG_USB_SERIAL_CYPRESS_M8=m
2663 +CONFIG_USB_SERIAL_EMPEG=m
2664 +CONFIG_USB_SERIAL_FTDI_SIO=m
2665 +CONFIG_USB_SERIAL_FUNSOFT=m
2666 +CONFIG_USB_SERIAL_VISOR=m
2667 +CONFIG_USB_SERIAL_IPAQ=m
2668 +CONFIG_USB_SERIAL_IR=m
2669 +CONFIG_USB_SERIAL_EDGEPORT=m
2670 +CONFIG_USB_SERIAL_EDGEPORT_TI=m
2671 +CONFIG_USB_SERIAL_GARMIN=m
2672 +CONFIG_USB_SERIAL_IPW=m
2673 +CONFIG_USB_SERIAL_IUU=m
2674 +CONFIG_USB_SERIAL_KEYSPAN_PDA=m
2675 +CONFIG_USB_SERIAL_KEYSPAN=m
2676 +CONFIG_USB_SERIAL_KLSI=m
2677 +CONFIG_USB_SERIAL_KOBIL_SCT=m
2678 +CONFIG_USB_SERIAL_MCT_U232=m
2679 +CONFIG_USB_SERIAL_MOS7720=m
2680 +CONFIG_USB_SERIAL_MOS7840=m
2681 +CONFIG_USB_SERIAL_MOTOROLA=m
2682 +CONFIG_USB_SERIAL_NAVMAN=m
2683 +CONFIG_USB_SERIAL_PL2303=m
2684 +CONFIG_USB_SERIAL_OTI6858=m
2685 +CONFIG_USB_SERIAL_QCAUX=m
2686 +CONFIG_USB_SERIAL_QUALCOMM=m
2687 +CONFIG_USB_SERIAL_SPCP8X5=m
2688 +CONFIG_USB_SERIAL_HP4X=m
2689 +CONFIG_USB_SERIAL_SAFE=m
2690 +CONFIG_USB_SERIAL_SIEMENS_MPI=m
2691 +CONFIG_USB_SERIAL_SIERRAWIRELESS=m
2692 +CONFIG_USB_SERIAL_SYMBOL=m
2693 +CONFIG_USB_SERIAL_TI=m
2694 +CONFIG_USB_SERIAL_CYBERJACK=m
2695 +CONFIG_USB_SERIAL_XIRCOM=m
2696 +CONFIG_USB_SERIAL_OPTION=m
2697 +CONFIG_USB_SERIAL_OMNINET=m
2698 +CONFIG_USB_SERIAL_OPTICON=m
2699 +CONFIG_USB_SERIAL_VIVOPAY_SERIAL=m
2700 +CONFIG_USB_SERIAL_ZIO=m
2701 +CONFIG_USB_SERIAL_SSU100=m
2702 +CONFIG_USB_SERIAL_DEBUG=m
2703 +CONFIG_USB_EMI62=m
2704 +CONFIG_USB_EMI26=m
2705 +CONFIG_USB_ADUTUX=m
2706 +CONFIG_USB_SEVSEG=m
2707 +CONFIG_USB_RIO500=m
2708 +CONFIG_USB_LEGOTOWER=m
2709 +CONFIG_USB_LCD=m
2710 +CONFIG_USB_LED=m
2711 +CONFIG_USB_CYPRESS_CY7C63=m
2712 +CONFIG_USB_CYTHERM=m
2713 +CONFIG_USB_IDMOUSE=m
2714 +CONFIG_USB_FTDI_ELAN=m
2715 +CONFIG_USB_APPLEDISPLAY=m
2716 +CONFIG_USB_LD=m
2717 +CONFIG_USB_TRANCEVIBRATOR=m
2718 +CONFIG_USB_IOWARRIOR=m
2719 +CONFIG_USB_TEST=m
2720 +CONFIG_USB_ISIGHTFW=m
2721 +CONFIG_USB_YUREX=m
2722 +CONFIG_MMC=y
2723 +CONFIG_MMC_SDHCI=y
2724 +CONFIG_MMC_SDHCI_PLTFM=y
2725 +CONFIG_MMC_SDHCI_BCM2708=y
2726 +CONFIG_MMC_SDHCI_BCM2708_DMA=y
2727 +CONFIG_LEDS_GPIO=y
2728 +CONFIG_LEDS_TRIGGER_TIMER=m
2729 +CONFIG_LEDS_TRIGGER_HEARTBEAT=m
2730 +CONFIG_LEDS_TRIGGER_DEFAULT_ON=m
2731 +CONFIG_UIO=m
2732 +CONFIG_UIO_PDRV=m
2733 +CONFIG_UIO_PDRV_GENIRQ=m
2734 +# CONFIG_IOMMU_SUPPORT is not set
2735 +CONFIG_EXT4_FS=y
2736 +CONFIG_EXT4_FS_POSIX_ACL=y
2737 +CONFIG_EXT4_FS_SECURITY=y
2738 +CONFIG_REISERFS_FS=m
2739 +CONFIG_REISERFS_FS_XATTR=y
2740 +CONFIG_REISERFS_FS_POSIX_ACL=y
2741 +CONFIG_REISERFS_FS_SECURITY=y
2742 +CONFIG_JFS_FS=m
2743 +CONFIG_JFS_POSIX_ACL=y
2744 +CONFIG_JFS_SECURITY=y
2745 +CONFIG_JFS_STATISTICS=y
2746 +CONFIG_XFS_FS=m
2747 +CONFIG_XFS_QUOTA=y
2748 +CONFIG_XFS_POSIX_ACL=y
2749 +CONFIG_XFS_RT=y
2750 +CONFIG_GFS2_FS=m
2751 +CONFIG_OCFS2_FS=m
2752 +CONFIG_BTRFS_FS=m
2753 +CONFIG_BTRFS_FS_POSIX_ACL=y
2754 +CONFIG_NILFS2_FS=m
2755 +CONFIG_FANOTIFY=y
2756 +CONFIG_AUTOFS4_FS=y
2757 +CONFIG_FUSE_FS=m
2758 +CONFIG_CUSE=m
2759 +CONFIG_FSCACHE=y
2760 +CONFIG_FSCACHE_STATS=y
2761 +CONFIG_FSCACHE_HISTOGRAM=y
2762 +CONFIG_CACHEFILES=y
2763 +CONFIG_ISO9660_FS=m
2764 +CONFIG_JOLIET=y
2765 +CONFIG_ZISOFS=y
2766 +CONFIG_UDF_FS=m
2767 +CONFIG_MSDOS_FS=y
2768 +CONFIG_VFAT_FS=y
2769 +CONFIG_FAT_DEFAULT_IOCHARSET="ascii"
2770 +CONFIG_NTFS_FS=m
2771 +CONFIG_TMPFS=y
2772 +CONFIG_TMPFS_POSIX_ACL=y
2773 +CONFIG_CONFIGFS_FS=y
2774 +CONFIG_SQUASHFS=m
2775 +CONFIG_SQUASHFS_XATTR=y
2776 +CONFIG_SQUASHFS_LZO=y
2777 +CONFIG_SQUASHFS_XZ=y
2778 +CONFIG_NFS_FS=y
2779 +CONFIG_NFS_V3=y
2780 +CONFIG_NFS_V3_ACL=y
2781 +CONFIG_NFS_V4=y
2782 +CONFIG_ROOT_NFS=y
2783 +CONFIG_NFS_FSCACHE=y
2784 +CONFIG_CIFS=m
2785 +CONFIG_CIFS_WEAK_PW_HASH=y
2786 +CONFIG_CIFS_XATTR=y
2787 +CONFIG_CIFS_POSIX=y
2788 +CONFIG_9P_FS=m
2789 +CONFIG_9P_FS_POSIX_ACL=y
2790 +CONFIG_PARTITION_ADVANCED=y
2791 +CONFIG_MAC_PARTITION=y
2792 +CONFIG_EFI_PARTITION=y
2793 +CONFIG_NLS_DEFAULT="utf8"
2794 +CONFIG_NLS_CODEPAGE_437=y
2795 +CONFIG_NLS_CODEPAGE_737=m
2796 +CONFIG_NLS_CODEPAGE_775=m
2797 +CONFIG_NLS_CODEPAGE_850=m
2798 +CONFIG_NLS_CODEPAGE_852=m
2799 +CONFIG_NLS_CODEPAGE_855=m
2800 +CONFIG_NLS_CODEPAGE_857=m
2801 +CONFIG_NLS_CODEPAGE_860=m
2802 +CONFIG_NLS_CODEPAGE_861=m
2803 +CONFIG_NLS_CODEPAGE_862=m
2804 +CONFIG_NLS_CODEPAGE_863=m
2805 +CONFIG_NLS_CODEPAGE_864=m
2806 +CONFIG_NLS_CODEPAGE_865=m
2807 +CONFIG_NLS_CODEPAGE_866=m
2808 +CONFIG_NLS_CODEPAGE_869=m
2809 +CONFIG_NLS_CODEPAGE_936=m
2810 +CONFIG_NLS_CODEPAGE_950=m
2811 +CONFIG_NLS_CODEPAGE_932=m
2812 +CONFIG_NLS_CODEPAGE_949=m
2813 +CONFIG_NLS_CODEPAGE_874=m
2814 +CONFIG_NLS_ISO8859_8=m
2815 +CONFIG_NLS_CODEPAGE_1250=m
2816 +CONFIG_NLS_CODEPAGE_1251=m
2817 +CONFIG_NLS_ASCII=y
2818 +CONFIG_NLS_ISO8859_1=m
2819 +CONFIG_NLS_ISO8859_2=m
2820 +CONFIG_NLS_ISO8859_3=m
2821 +CONFIG_NLS_ISO8859_4=m
2822 +CONFIG_NLS_ISO8859_5=m
2823 +CONFIG_NLS_ISO8859_6=m
2824 +CONFIG_NLS_ISO8859_7=m
2825 +CONFIG_NLS_ISO8859_9=m
2826 +CONFIG_NLS_ISO8859_13=m
2827 +CONFIG_NLS_ISO8859_14=m
2828 +CONFIG_NLS_ISO8859_15=m
2829 +CONFIG_NLS_KOI8_R=m
2830 +CONFIG_NLS_KOI8_U=m
2831 +CONFIG_NLS_UTF8=m
2832 +CONFIG_PRINTK_TIME=y
2833 +CONFIG_DETECT_HUNG_TASK=y
2834 +CONFIG_TIMER_STATS=y
2835 +CONFIG_DEBUG_STACK_USAGE=y
2836 +CONFIG_DEBUG_INFO=y
2837 +CONFIG_DEBUG_MEMORY_INIT=y
2838 +CONFIG_BOOT_PRINTK_DELAY=y
2839 +CONFIG_LATENCYTOP=y
2840 +CONFIG_SYSCTL_SYSCALL_CHECK=y
2841 +CONFIG_IRQSOFF_TRACER=y
2842 +CONFIG_SCHED_TRACER=y
2843 +CONFIG_STACK_TRACER=y
2844 +CONFIG_BLK_DEV_IO_TRACE=y
2845 +CONFIG_FUNCTION_PROFILER=y
2846 +CONFIG_KGDB=y
2847 +CONFIG_KGDB_KDB=y
2848 +CONFIG_KDB_KEYBOARD=y
2849 +CONFIG_STRICT_DEVMEM=y
2850 +CONFIG_CRYPTO_AUTHENC=m
2851 +CONFIG_CRYPTO_SEQIV=m
2852 +CONFIG_CRYPTO_CBC=y
2853 +CONFIG_CRYPTO_HMAC=y
2854 +CONFIG_CRYPTO_XCBC=m
2855 +CONFIG_CRYPTO_MD5=y
2856 +CONFIG_CRYPTO_SHA1=y
2857 +CONFIG_CRYPTO_SHA256=m
2858 +CONFIG_CRYPTO_SHA512=m
2859 +CONFIG_CRYPTO_TGR192=m
2860 +CONFIG_CRYPTO_WP512=m
2861 +CONFIG_CRYPTO_CAST5=m
2862 +CONFIG_CRYPTO_DES=y
2863 +CONFIG_CRYPTO_DEFLATE=m
2864 +# CONFIG_CRYPTO_ANSI_CPRNG is not set
2865 +# CONFIG_CRYPTO_HW is not set
2866 +CONFIG_CRC_ITU_T=y
2867 +CONFIG_LIBCRC32C=y
2868 --- a/arch/arm/mach-bcm2708/Kconfig
2869 +++ b/arch/arm/mach-bcm2708/Kconfig
2870 @@ -22,4 +22,11 @@ config BCM2708_VCMEM
2871          help
2872            Helper for videocore memory access and total size allocation.           
2873  
2874 +config BCM2708_NOL2CACHE
2875 +       bool "Videocore L2 cache disable"
2876 +       depends on MACH_BCM2708
2877 +        default n
2878 +        help
2879 +          Do not allow ARM to use GPU's L2 cache. Requires disable_l2cache in config.txt.
2880 +
2881  endmenu
2882 --- a/arch/arm/mach-bcm2708/bcm2708.c
2883 +++ b/arch/arm/mach-bcm2708/bcm2708.c
2884 @@ -29,6 +29,7 @@
2885  #include <linux/clockchips.h>
2886  #include <linux/cnt32_to_63.h>
2887  #include <linux/io.h>
2888 +#include <linux/module.h>
2889  
2890  #include <linux/version.h>
2891  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
2892 @@ -68,6 +69,9 @@
2893   */
2894  #define DMA_MASK_BITS_COMMON 32
2895  
2896 +/* command line parameters */
2897 +static unsigned boardrev, serial;
2898 +
2899  static void __init bcm2708_init_led(void);
2900  
2901  void __init bcm2708_init_irq(void)
2902 @@ -77,58 +81,57 @@ void __init bcm2708_init_irq(void)
2903  
2904  static struct map_desc bcm2708_io_desc[] __initdata = {
2905         {
2906 -               .virtual        = IO_ADDRESS(ARMCTRL_BASE),
2907 -               .pfn            = __phys_to_pfn(ARMCTRL_BASE),
2908 -               .length         = SZ_4K,
2909 -               .type           = MT_DEVICE
2910 -       }, {
2911 -               .virtual        = IO_ADDRESS(UART0_BASE),
2912 -               .pfn            = __phys_to_pfn(UART0_BASE),
2913 -               .length         = SZ_4K,
2914 -               .type           = MT_DEVICE
2915 -       }, {
2916 -               .virtual        = IO_ADDRESS(UART1_BASE),
2917 -               .pfn            = __phys_to_pfn(UART1_BASE),
2918 -               .length         = SZ_4K,
2919 -               .type           = MT_DEVICE
2920 -       }, {
2921 -#ifdef CONFIG_MMC_BCM2708 /* broadcom legacy SD */
2922 -               .virtual        = IO_ADDRESS(MMCI0_BASE),
2923 -               .pfn            = __phys_to_pfn(MMCI0_BASE),
2924 -               .length         = SZ_4K,
2925 -               .type           = MT_DEVICE
2926 -       }, {
2927 -#endif
2928 -               .virtual        = IO_ADDRESS(DMA_BASE),
2929 -               .pfn            = __phys_to_pfn(DMA_BASE),
2930 -               .length         = SZ_4K,
2931 -               .type           = MT_DEVICE
2932 -       }, {
2933 -               .virtual        = IO_ADDRESS(MCORE_BASE),
2934 -               .pfn            = __phys_to_pfn(MCORE_BASE),
2935 -               .length         = SZ_4K,
2936 -               .type           = MT_DEVICE
2937 -       }, {
2938 -               .virtual        = IO_ADDRESS(ST_BASE),
2939 -               .pfn            = __phys_to_pfn(ST_BASE),
2940 -               .length         = SZ_4K,
2941 -               .type           = MT_DEVICE
2942 -        }, {
2943 -               .virtual        = IO_ADDRESS(USB_BASE),
2944 -               .pfn            = __phys_to_pfn(USB_BASE),
2945 -               .length         = SZ_128K,
2946 -               .type           = MT_DEVICE
2947 -        }, {
2948 -               .virtual        = IO_ADDRESS(PM_BASE),
2949 -               .pfn            = __phys_to_pfn(PM_BASE),
2950 -               .length         = SZ_4K,
2951 -               .type           = MT_DEVICE
2952 -       }, {
2953 -               .virtual        = IO_ADDRESS(GPIO_BASE),
2954 -               .pfn            = __phys_to_pfn(GPIO_BASE),
2955 -               .length         = SZ_4K,
2956 -               .type           = MT_DEVICE
2957 -        }
2958 +        .virtual = IO_ADDRESS(ARMCTRL_BASE),
2959 +        .pfn = __phys_to_pfn(ARMCTRL_BASE),
2960 +        .length = SZ_4K,
2961 +        .type = MT_DEVICE},
2962 +       {
2963 +        .virtual = IO_ADDRESS(UART0_BASE),
2964 +        .pfn = __phys_to_pfn(UART0_BASE),
2965 +        .length = SZ_4K,
2966 +        .type = MT_DEVICE},
2967 +       {
2968 +        .virtual = IO_ADDRESS(UART1_BASE),
2969 +        .pfn = __phys_to_pfn(UART1_BASE),
2970 +        .length = SZ_4K,
2971 +        .type = MT_DEVICE},
2972 +#ifdef CONFIG_MMC_BCM2708      /* broadcom legacy SD */
2973 +       {
2974 +        .virtual = IO_ADDRESS(MMCI0_BASE),
2975 +        .pfn = __phys_to_pfn(MMCI0_BASE),
2976 +        .length = SZ_4K,
2977 +        .type = MT_DEVICE},
2978 +#endif
2979 +       {
2980 +        .virtual = IO_ADDRESS(DMA_BASE),
2981 +        .pfn = __phys_to_pfn(DMA_BASE),
2982 +        .length = SZ_4K,
2983 +        .type = MT_DEVICE},
2984 +       {
2985 +        .virtual = IO_ADDRESS(MCORE_BASE),
2986 +        .pfn = __phys_to_pfn(MCORE_BASE),
2987 +        .length = SZ_4K,
2988 +        .type = MT_DEVICE},
2989 +       {
2990 +        .virtual = IO_ADDRESS(ST_BASE),
2991 +        .pfn = __phys_to_pfn(ST_BASE),
2992 +        .length = SZ_4K,
2993 +        .type = MT_DEVICE},
2994 +       {
2995 +        .virtual = IO_ADDRESS(USB_BASE),
2996 +        .pfn = __phys_to_pfn(USB_BASE),
2997 +        .length = SZ_128K,
2998 +        .type = MT_DEVICE},
2999 +       {
3000 +        .virtual = IO_ADDRESS(PM_BASE),
3001 +        .pfn = __phys_to_pfn(PM_BASE),
3002 +        .length = SZ_4K,
3003 +        .type = MT_DEVICE},
3004 +       {
3005 +        .virtual = IO_ADDRESS(GPIO_BASE),
3006 +        .pfn = __phys_to_pfn(GPIO_BASE),
3007 +        .length = SZ_4K,
3008 +        .type = MT_DEVICE}
3009  };
3010  
3011  void __init bcm2708_map_io(void)
3012 @@ -136,74 +139,91 @@ void __init bcm2708_map_io(void)
3013         iotable_init(bcm2708_io_desc, ARRAY_SIZE(bcm2708_io_desc));
3014  }
3015  
3016 -unsigned long frc_clock_ticks32(void)
3017 +// The STC is a free running counter that increments at the rate of 1MHz
3018 +#define STC_FREQ_HZ 1000000
3019 +
3020 +static cycle_t stc_read_cycles(struct clocksource *cs)
3021  {
3022         /* STC: a free running counter that increments at the rate of 1MHz */
3023 -       return readl(__io_address(ST_BASE+0x04));
3024 +       return (cycle_t) readl(__io_address(ST_BASE + 0x04));
3025  }
3026  
3027 -unsigned long long frc_clock_ticks63(void)
3028 +static struct clocksource clocksource_stc = {
3029 +       .name = "stc",
3030 +       .rating = 300,
3031 +       .read = stc_read_cycles,
3032 +       .mask = CLOCKSOURCE_MASK(32),
3033 +       .flags = CLOCK_SOURCE_IS_CONTINUOUS,
3034 +};
3035 +
3036 +unsigned long frc_clock_ticks32(void)
3037  {
3038 -       unsigned long t = frc_clock_ticks32();
3039 -       /* For cnt32_to_63 to work correctly we MUST call this routine
3040 -        * at least once every half-32-bit-wraparound period - that's once
3041 -        * every 35minutes or so - using it in sched_clock() should ensure this
3042 -        */
3043 -       return cnt32_to_63(t);
3044 +       return (unsigned long)stc_read_cycles(&clocksource_stc);
3045 +}
3046 +
3047 +static void __init bcm2708_clocksource_init(void)
3048 +{
3049 +       // calculate .shift and .mult values and register clocksource
3050 +       if (clocksource_register_hz(&clocksource_stc, STC_FREQ_HZ)) {
3051 +               printk(KERN_ERR "timer: failed to initialize clock "
3052 +                      "source %s\n", clocksource_stc.name);
3053 +       }
3054  }
3055  
3056  unsigned long long sched_clock(void)
3057  {
3058 -       return 1000ull * frc_clock_ticks63();
3059 +       return clocksource_cyc2ns(clocksource_stc.read(&clocksource_stc),
3060 +                                 clocksource_stc.mult, clocksource_stc.shift);
3061  }
3062  
3063  /*
3064   * These are fixed clocks.
3065   */
3066  static struct clk ref24_clk = {
3067 -       .rate   = 3000000,  /* The UART is clocked at 3MHz via APB_CLK */
3068 +       .rate = 3000000,        /* The UART is clocked at 3MHz via APB_CLK */
3069  };
3070 +
3071  static struct clk osc_clk = {
3072  #ifdef CONFIG_ARCH_BCM2708_CHIPIT
3073 -       .rate   = 27000000,
3074 +       .rate = 27000000,
3075  #else
3076 -       .rate   = 500000000,  /* ARM clock is set from the VideoCore booter */
3077 +       .rate = 500000000,      /* ARM clock is set from the VideoCore booter */
3078  #endif
3079  };
3080 +
3081  /* warning - the USB needs a clock > 34MHz */
3082  
3083  #ifdef CONFIG_MMC_BCM2708
3084  static struct clk sdhost_clk = {
3085  #ifdef CONFIG_ARCH_BCM2708_CHIPIT
3086 -       .rate   =   4000000, /* 4MHz */
3087 +       .rate = 4000000,        /* 4MHz */
3088  #else
3089 -       .rate   = 250000000, /* 250MHz */
3090 +       .rate = 250000000,      /* 250MHz */
3091  #endif
3092  };
3093  #endif
3094  
3095  static struct clk_lookup lookups[] = {
3096 -       {       /* UART0 */
3097 -               .dev_id         = "dev:f1",
3098 -               .clk            = &ref24_clk,
3099 -       },
3100 -       {       /* USB */
3101 -               .dev_id         = "bcm2708_usb",
3102 -               .clk            = &osc_clk,
3103 +       {                       /* UART0 */
3104 +        .dev_id = "dev:f1",
3105 +        .clk = &ref24_clk,
3106 +        },
3107 +       {                       /* USB */
3108 +        .dev_id = "bcm2708_usb",
3109 +        .clk = &osc_clk,
3110  #ifdef CONFIG_MMC_BCM2708
3111 -       },
3112 -       {       /* MCI */
3113 -               .dev_id         = "bcm2708_mci.0",
3114 -               .clk            = &sdhost_clk,
3115 +        },
3116 +       {                       /* MCI */
3117 +        .dev_id = "bcm2708_mci.0",
3118 +        .clk = &sdhost_clk,
3119  #endif
3120 -       }
3121 +        }
3122  };
3123  
3124 -
3125  #define UART0_IRQ      { IRQ_UART, NO_IRQ }
3126  #define UART0_DMA      { 15, 14 }
3127  
3128 -AMBA_DEVICE(uart0, "dev:f1",  UART0,    NULL);
3129 +AMBA_DEVICE(uart0, "dev:f1", UART0, NULL);
3130  
3131  static struct amba_device *amba_devs[] __initdata = {
3132         &uart0_device,
3133 @@ -211,262 +231,232 @@ static struct amba_device *amba_devs[] _
3134  
3135  static struct resource bcm2708_dmaman_resources[] = {
3136         {
3137 -               .start                  = DMA_BASE,
3138 -               .end                    = DMA_BASE + SZ_4K - 1,
3139 -               .flags                  = IORESOURCE_MEM,
3140 -       }
3141 +        .start = DMA_BASE,
3142 +        .end = DMA_BASE + SZ_4K - 1,
3143 +        .flags = IORESOURCE_MEM,
3144 +        }
3145  };
3146  
3147  static struct platform_device bcm2708_dmaman_device = {
3148 -   .name                       = BCM_DMAMAN_DRIVER_NAME,
3149 -       .id                     = 0, /* first bcm2708_dma */
3150 -       .resource               = bcm2708_dmaman_resources,
3151 -       .num_resources          = ARRAY_SIZE(bcm2708_dmaman_resources),
3152 +       .name = BCM_DMAMAN_DRIVER_NAME,
3153 +       .id = 0,                /* first bcm2708_dma */
3154 +       .resource = bcm2708_dmaman_resources,
3155 +       .num_resources = ARRAY_SIZE(bcm2708_dmaman_resources),
3156  };
3157  
3158  #ifdef CONFIG_MMC_BCM2708
3159  static struct resource bcm2708_mci_resources[] = {
3160         {
3161 -               .start                  = MMCI0_BASE,
3162 -               .end                    = MMCI0_BASE + SZ_4K - 1,
3163 -               .flags                  = IORESOURCE_MEM,
3164 -       }, {
3165 -               .start                  = IRQ_SDIO,
3166 -               .end                    = IRQ_SDIO,
3167 -               .flags                  = IORESOURCE_IRQ,
3168 -       }
3169 +        .start = MMCI0_BASE,
3170 +        .end = MMCI0_BASE + SZ_4K - 1,
3171 +        .flags = IORESOURCE_MEM,
3172 +        },
3173 +       {
3174 +        .start = IRQ_SDIO,
3175 +        .end = IRQ_SDIO,
3176 +        .flags = IORESOURCE_IRQ,
3177 +        }
3178  };
3179  
3180 -
3181  static struct platform_device bcm2708_mci_device = {
3182 -       .name                   = "bcm2708_mci",
3183 -       .id                     = 0, /* first bcm2708_mci */
3184 -       .resource               = bcm2708_mci_resources,
3185 -       .num_resources          = ARRAY_SIZE(bcm2708_mci_resources),
3186 -       .dev                    = {
3187 -       .coherent_dma_mask      = DMA_BIT_MASK(DMA_MASK_BITS_COMMON),
3188 -       },
3189 +       .name = "bcm2708_mci",
3190 +       .id = 0,                /* first bcm2708_mci */
3191 +       .resource = bcm2708_mci_resources,
3192 +       .num_resources = ARRAY_SIZE(bcm2708_mci_resources),
3193 +       .dev = {
3194 +               .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON),
3195 +               },
3196  };
3197  #endif /* CONFIG_MMC_BCM2708 */
3198  
3199 -
3200  static u64 fb_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
3201  
3202  static struct platform_device bcm2708_fb_device = {
3203 -       .name                   = "bcm2708_fb",
3204 -       .id                     = -1,  /* only one bcm2708_fb */
3205 -       .resource               = NULL,
3206 -       .num_resources          = 0,
3207 -       .dev                    = {
3208 -               .dma_mask               = &fb_dmamask,
3209 -               .coherent_dma_mask      = DMA_BIT_MASK(DMA_MASK_BITS_COMMON),
3210 -       },
3211 +       .name = "bcm2708_fb",
3212 +       .id = -1,               /* only one bcm2708_fb */
3213 +       .resource = NULL,
3214 +       .num_resources = 0,
3215 +       .dev = {
3216 +               .dma_mask = &fb_dmamask,
3217 +               .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON),
3218 +               },
3219  };
3220  
3221  static struct plat_serial8250_port bcm2708_uart1_platform_data[] = {
3222         {
3223 -               .mapbase        = UART1_BASE + 0x40,
3224 -               .irq            = IRQ_AUX,
3225 -               .uartclk        = 125000000,
3226 -               .regshift       = 2,
3227 -               .iotype         = UPIO_MEM,
3228 -               .flags          = UPF_FIXED_TYPE | UPF_IOREMAP | UPF_SKIP_TEST,
3229 -               .type           = PORT_8250,
3230 -       },
3231 -       { },
3232 +        .mapbase = UART1_BASE + 0x40,
3233 +        .irq = IRQ_AUX,
3234 +        .uartclk = 125000000,
3235 +        .regshift = 2,
3236 +        .iotype = UPIO_MEM,
3237 +        .flags = UPF_FIXED_TYPE | UPF_IOREMAP | UPF_SKIP_TEST,
3238 +        .type = PORT_8250,
3239 +        },
3240 +       {},
3241  };
3242  
3243  static struct platform_device bcm2708_uart1_device = {
3244 -       .name                   = "serial8250",
3245 -       .id                     = PLAT8250_DEV_PLATFORM,
3246 -       .dev                    = {
3247 -               .platform_data  = bcm2708_uart1_platform_data,
3248 -       },
3249 +       .name = "serial8250",
3250 +       .id = PLAT8250_DEV_PLATFORM,
3251 +       .dev = {
3252 +               .platform_data = bcm2708_uart1_platform_data,
3253 +               },
3254  };
3255  
3256  static struct resource bcm2708_usb_resources[] = {
3257 -       [0] =   {
3258 -               .start                  = USB_BASE,
3259 -               .end                    = USB_BASE + SZ_128K - 1,
3260 -               .flags                  = IORESOURCE_MEM,
3261 -               },
3262 -       [1] =   {
3263 -               .start                  = IRQ_USB,
3264 -               .end                    = IRQ_USB,
3265 -               .flags                  = IORESOURCE_IRQ,
3266 -               },
3267 +       [0] = {
3268 +              .start = USB_BASE,
3269 +              .end = USB_BASE + SZ_128K - 1,
3270 +              .flags = IORESOURCE_MEM,
3271 +              },
3272 +       [1] = {
3273 +              .start = IRQ_USB,
3274 +              .end = IRQ_USB,
3275 +              .flags = IORESOURCE_IRQ,
3276 +              },
3277  };
3278  
3279  static u64 usb_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
3280  
3281  static struct platform_device bcm2708_usb_device = {
3282 -       .name                   = "bcm2708_usb",
3283 -       .id                     = -1, /* only one bcm2708_usb */
3284 -       .resource               = bcm2708_usb_resources,
3285 -       .num_resources          = ARRAY_SIZE(bcm2708_usb_resources),
3286 -       .dev                    = {
3287 -               .dma_mask               = &usb_dmamask,
3288 -               .coherent_dma_mask      = DMA_BIT_MASK(DMA_MASK_BITS_COMMON),
3289 -       },
3290 +       .name = "bcm2708_usb",
3291 +       .id = -1,               /* only one bcm2708_usb */
3292 +       .resource = bcm2708_usb_resources,
3293 +       .num_resources = ARRAY_SIZE(bcm2708_usb_resources),
3294 +       .dev = {
3295 +               .dma_mask = &usb_dmamask,
3296 +               .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON),
3297 +               },
3298  };
3299  
3300  static struct resource bcm2708_vcio_resources[] = {
3301 -       [0] =   {                       /* mailbox/semaphore/doorbell access */
3302 -               .start                  = MCORE_BASE,
3303 -               .end                    = MCORE_BASE + SZ_4K - 1,
3304 -               .flags                  = IORESOURCE_MEM,
3305 -       },
3306 +       [0] = {                 /* mailbox/semaphore/doorbell access */
3307 +              .start = MCORE_BASE,
3308 +              .end = MCORE_BASE + SZ_4K - 1,
3309 +              .flags = IORESOURCE_MEM,
3310 +              },
3311  };
3312  
3313  static u64 vcio_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
3314  
3315  static struct platform_device bcm2708_vcio_device = {
3316 -       .name                   = BCM_VCIO_DRIVER_NAME,
3317 -       .id                     = -1, /* only one VideoCore I/O area */
3318 -       .resource               = bcm2708_vcio_resources,
3319 -       .num_resources          = ARRAY_SIZE(bcm2708_vcio_resources),
3320 -       .dev                    = {
3321 -               .dma_mask               = &vcio_dmamask,
3322 -               .coherent_dma_mask      = DMA_BIT_MASK(DMA_MASK_BITS_COMMON),
3323 -       },
3324 +       .name = BCM_VCIO_DRIVER_NAME,
3325 +       .id = -1,               /* only one VideoCore I/O area */
3326 +       .resource = bcm2708_vcio_resources,
3327 +       .num_resources = ARRAY_SIZE(bcm2708_vcio_resources),
3328 +       .dev = {
3329 +               .dma_mask = &vcio_dmamask,
3330 +               .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON),
3331 +               },
3332  };
3333  
3334  #ifdef CONFIG_BCM2708_GPIO
3335  #define BCM_GPIO_DRIVER_NAME "bcm2708_gpio"
3336  
3337  static struct resource bcm2708_gpio_resources[] = {
3338 -       [0] =   {                       /* general purpose I/O */
3339 -               .start                  = GPIO_BASE,
3340 -               .end                    = GPIO_BASE + SZ_4K - 1,
3341 -               .flags                  = IORESOURCE_MEM,
3342 -       },
3343 +       [0] = {                 /* general purpose I/O */
3344 +              .start = GPIO_BASE,
3345 +              .end = GPIO_BASE + SZ_4K - 1,
3346 +              .flags = IORESOURCE_MEM,
3347 +              },
3348  };
3349  
3350  static u64 gpio_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
3351  
3352  static struct platform_device bcm2708_gpio_device = {
3353 -       .name                   = BCM_GPIO_DRIVER_NAME,
3354 -       .id                     = -1, /* only one VideoCore I/O area */
3355 -       .resource               = bcm2708_gpio_resources,
3356 -       .num_resources          = ARRAY_SIZE(bcm2708_gpio_resources),
3357 -       .dev                    = {
3358 -               .dma_mask               = &gpio_dmamask,
3359 -               .coherent_dma_mask      = DMA_BIT_MASK(DMA_MASK_BITS_COMMON),
3360 -       },
3361 -};
3362 -#endif
3363 -
3364 -#ifdef CONFIG_BCM2708_BUTTONS
3365 -static struct resource bcm2708_vcbuttons_resources[] = {
3366 -};
3367 -
3368 -static u64 vcbuttons_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
3369 -
3370 -static struct platform_device bcm2708_vcbuttons_device = {
3371 -       .name                   = "bcm2708_vcbuttons",
3372 -       .id                     = -1, /* only one VideoCore I/O area */
3373 -       .resource               = bcm2708_vcbuttons_resources,
3374 -       .num_resources          = ARRAY_SIZE(bcm2708_vcbuttons_resources),
3375 -       .dev                    = {
3376 -               .dma_mask               = &vcbuttons_dmamask,
3377 -               .coherent_dma_mask      = DMA_BIT_MASK(DMA_MASK_BITS_COMMON),
3378 -       },
3379 -};
3380 -#endif
3381 -
3382 -#ifdef CONFIG_BCM2708_TOUCHSCREEN
3383 -static struct resource bcm2708_vctouch_resources[] = {
3384 -};
3385 -
3386 -static u64 vctouch_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
3387 -
3388 -static struct platform_device bcm2708_vctouch_device = {
3389 -       .name                   = "bcm2708_vctouch",
3390 -       .id                     = -1, /* only one VideoCore I/O area */
3391 -       .resource               = bcm2708_vctouch_resources,
3392 -       .num_resources          = ARRAY_SIZE(bcm2708_vctouch_resources),
3393 -       .dev                    = {
3394 -               .dma_mask               = &vctouch_dmamask,
3395 -               .coherent_dma_mask      = DMA_BIT_MASK(DMA_MASK_BITS_COMMON),
3396 -       },
3397 +       .name = BCM_GPIO_DRIVER_NAME,
3398 +       .id = -1,               /* only one VideoCore I/O area */
3399 +       .resource = bcm2708_gpio_resources,
3400 +       .num_resources = ARRAY_SIZE(bcm2708_gpio_resources),
3401 +       .dev = {
3402 +               .dma_mask = &gpio_dmamask,
3403 +               .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON),
3404 +               },
3405  };
3406  #endif
3407  
3408  static struct resource bcm2708_systemtimer_resources[] = {
3409 -       [0] =   {                       /* system timer access */
3410 -               .start                  = ST_BASE,
3411 -               .end                    = ST_BASE + SZ_4K - 1,
3412 -               .flags                  = IORESOURCE_MEM,
3413 -       }, {
3414 -               .start                  = IRQ_TIMER3,
3415 -               .end                    = IRQ_TIMER3,
3416 -               .flags                  = IORESOURCE_IRQ,
3417 -       }
3418 -
3419 +       [0] = {                 /* system timer access */
3420 +              .start = ST_BASE,
3421 +              .end = ST_BASE + SZ_4K - 1,
3422 +              .flags = IORESOURCE_MEM,
3423 +              },
3424 +       {
3425 +        .start = IRQ_TIMER3,
3426 +        .end = IRQ_TIMER3,
3427 +        .flags = IORESOURCE_IRQ,
3428 +        }
3429  
3430  };
3431  
3432  static u64 systemtimer_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
3433  
3434  static struct platform_device bcm2708_systemtimer_device = {
3435 -       .name                   = "bcm2708_systemtimer",
3436 -       .id                     = -1, /* only one VideoCore I/O area */
3437 -       .resource               = bcm2708_systemtimer_resources,
3438 -       .num_resources          = ARRAY_SIZE(bcm2708_systemtimer_resources),
3439 -       .dev                    = {
3440 -               .dma_mask               = &systemtimer_dmamask,
3441 -               .coherent_dma_mask      = DMA_BIT_MASK(DMA_MASK_BITS_COMMON),
3442 -       },
3443 +       .name = "bcm2708_systemtimer",
3444 +       .id = -1,               /* only one VideoCore I/O area */
3445 +       .resource = bcm2708_systemtimer_resources,
3446 +       .num_resources = ARRAY_SIZE(bcm2708_systemtimer_resources),
3447 +       .dev = {
3448 +               .dma_mask = &systemtimer_dmamask,
3449 +               .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON),
3450 +               },
3451  };
3452  
3453 -#ifdef CONFIG_MMC_SDHCI_BCM2708 /* Arasan emmc SD */
3454 +#ifdef CONFIG_MMC_SDHCI_BCM2708        /* Arasan emmc SD */
3455  static struct resource bcm2708_emmc_resources[] = {
3456         [0] = {
3457 -               .start = EMMC_BASE,
3458 -               .end   = EMMC_BASE + SZ_256 - 1, /* we only need this area */
3459 -               /* the memory map actually makes SZ_4K available  */
3460 -               .flags = IORESOURCE_MEM,
3461 -       },
3462 +              .start = EMMC_BASE,
3463 +              .end = EMMC_BASE + SZ_256 - 1,   /* we only need this area */
3464 +              /* the memory map actually makes SZ_4K available  */
3465 +              .flags = IORESOURCE_MEM,
3466 +              },
3467         [1] = {
3468 -               .start = IRQ_ARASANSDIO,
3469 -               .end   = IRQ_ARASANSDIO,
3470 -               .flags = IORESOURCE_IRQ,
3471 -       },
3472 +              .start = IRQ_ARASANSDIO,
3473 +              .end = IRQ_ARASANSDIO,
3474 +              .flags = IORESOURCE_IRQ,
3475 +              },
3476  };
3477  
3478  static u64 bcm2708_emmc_dmamask = 0xffffffffUL;
3479  
3480  struct platform_device bcm2708_emmc_device = {
3481 -       .name           = "bcm2708_sdhci",
3482 -       .id             = 0,
3483 -       .num_resources  = ARRAY_SIZE(bcm2708_emmc_resources),
3484 -       .resource       = bcm2708_emmc_resources,
3485 -       .dev            = {
3486 -               .dma_mask               = &bcm2708_emmc_dmamask,
3487 -               .coherent_dma_mask      = 0xffffffffUL
3488 -       },
3489 +       .name = "bcm2708_sdhci",
3490 +       .id = 0,
3491 +       .num_resources = ARRAY_SIZE(bcm2708_emmc_resources),
3492 +       .resource = bcm2708_emmc_resources,
3493 +       .dev = {
3494 +               .dma_mask = &bcm2708_emmc_dmamask,
3495 +               .coherent_dma_mask = 0xffffffffUL},
3496  };
3497  #endif /* CONFIG_MMC_SDHCI_BCM2708 */
3498  
3499  static struct resource bcm2708_powerman_resources[] = {
3500         [0] = {
3501 -               .start = PM_BASE,
3502 -               .end   = PM_BASE + SZ_256 - 1,
3503 -               .flags = IORESOURCE_MEM,
3504 -       },
3505 +              .start = PM_BASE,
3506 +              .end = PM_BASE + SZ_256 - 1,
3507 +              .flags = IORESOURCE_MEM,
3508 +              },
3509  };
3510  
3511  static u64 powerman_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
3512  
3513  struct platform_device bcm2708_powerman_device = {
3514 -       .name           = "bcm2708_powerman",
3515 -       .id             = 0,
3516 -       .num_resources  = ARRAY_SIZE(bcm2708_powerman_resources),
3517 -       .resource       = bcm2708_powerman_resources,
3518 -       .dev            = {
3519 -               .dma_mask     = &powerman_dmamask,
3520 -               .coherent_dma_mask = 0xffffffffUL
3521 -       },
3522 +       .name = "bcm2708_powerman",
3523 +       .id = 0,
3524 +       .num_resources = ARRAY_SIZE(bcm2708_powerman_resources),
3525 +       .resource = bcm2708_powerman_resources,
3526 +       .dev = {
3527 +               .dma_mask = &powerman_dmamask,
3528 +               .coherent_dma_mask = 0xffffffffUL},
3529 +};
3530 +
3531 +static struct platform_device bcm2708_alsa_devices[] = {
3532 +       [0] = {
3533 +              .name = "bcm2835_AUD0",
3534 +              .id = 0,         /* first audio device */
3535 +              .resource = 0,
3536 +              .num_resources = 0,
3537 +              },
3538  };
3539  
3540  int __init bcm_register_device(struct platform_device *pdev)
3541 @@ -500,30 +490,29 @@ void __init bcm2708_init(void)
3542         bcm_register_device(&bcm2708_fb_device);
3543         bcm_register_device(&bcm2708_usb_device);
3544         bcm_register_device(&bcm2708_uart1_device);
3545 -#ifdef CONFIG_BCM2708_BUTTONS
3546 -       bcm_register_device(&bcm2708_vcbuttons_device);
3547 -#endif
3548 -#ifdef CONFIG_BCM2708_TOUCHSCREEN
3549 -       bcm_register_device(&bcm2708_vctouch_device);
3550 -#endif
3551         bcm_register_device(&bcm2708_powerman_device);
3552  #ifdef CONFIG_MMC_SDHCI_BCM2708
3553         bcm_register_device(&bcm2708_emmc_device);
3554  #endif
3555 -        bcm2708_init_led();
3556 +       bcm2708_init_led();
3557 +       for (i = 0; i < ARRAY_SIZE(bcm2708_alsa_devices); i++)
3558 +               bcm_register_device(&bcm2708_alsa_devices[i]);
3559 +
3560  #ifdef CONFIG_BCM2708_VCMEM
3561 -{
3562 -       extern void vc_mem_connected_init(void);
3563 -        vc_mem_connected_init();
3564 -}
3565 +       {
3566 +               extern void vc_mem_connected_init(void);
3567 +               vc_mem_connected_init();
3568 +       }
3569  #endif
3570         for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
3571                 struct amba_device *d = amba_devs[i];
3572                 amba_device_register(d, &iomem_resource);
3573         }
3574 +       system_rev = boardrev;
3575 +       system_serial_low = serial;
3576  }
3577  
3578 -#define TIMER_PERIOD 10000 /* HZ in microsecs */
3579 +#define TIMER_PERIOD 10000     /* HZ in microsecs */
3580  
3581  static void timer_set_mode(enum clock_event_mode mode,
3582                            struct clock_event_device *clk)
3583 @@ -532,37 +521,36 @@ static void timer_set_mode(enum clock_ev
3584  
3585         switch (mode) {
3586         case CLOCK_EVT_MODE_PERIODIC:
3587 -               stc = readl(__io_address(ST_BASE+0x04));
3588 -               writel(stc + TIMER_PERIOD,
3589 -                       __io_address(ST_BASE+0x18));/* stc3 */
3590 +               stc = readl(__io_address(ST_BASE + 0x04));
3591 +               writel(stc + TIMER_PERIOD, __io_address(ST_BASE + 0x18));       /* stc3 */
3592                 break;
3593         case CLOCK_EVT_MODE_ONESHOT:
3594         case CLOCK_EVT_MODE_UNUSED:
3595         case CLOCK_EVT_MODE_SHUTDOWN:
3596         default:
3597                 printk(KERN_ERR "timer_set_mode: unhandled mode:%d\n",
3598 -                       (int)mode);
3599 +                      (int)mode);
3600                 break;
3601         }
3602  
3603  }
3604  
3605 -static int timer_set_next_event(unsigned long evt,
3606 +static int timer_set_next_event(unsigned long cycles,
3607                                 struct clock_event_device *unused)
3608  {
3609         unsigned long stc;
3610  
3611 -        stc = readl(__io_address(ST_BASE + 0x04));
3612 -        writel(stc + TIMER_PERIOD, __io_address(ST_BASE+0x18)); /* stc3 */
3613 +       stc = readl(__io_address(ST_BASE + 0x04));
3614 +       writel(stc + cycles, __io_address(ST_BASE + 0x18));     /* stc3 */
3615         return 0;
3616  }
3617  
3618 -static struct clock_event_device timer0_clockevent =    {
3619 -       .name           = "timer0",
3620 -       .shift          = 32,
3621 -       .features       = CLOCK_EVT_FEAT_ONESHOT,
3622 -       .set_mode       = timer_set_mode,
3623 -       .set_next_event = timer_set_next_event,
3624 +static struct clock_event_device timer0_clockevent = {
3625 +       .name = "timer0",
3626 +       .shift = 32,
3627 +       .features = CLOCK_EVT_FEAT_ONESHOT,
3628 +       .set_mode = timer_set_mode,
3629 +       .set_next_event = timer_set_next_event,
3630  };
3631  
3632  /*
3633 @@ -572,7 +560,7 @@ static irqreturn_t bcm2708_timer_interru
3634  {
3635         struct clock_event_device *evt = &timer0_clockevent;
3636  
3637 -       writel(1<<3, __io_address(ST_BASE+0x00)); /* stcs clear timer int */
3638 +       writel(1 << 3, __io_address(ST_BASE + 0x00));   /* stcs clear timer int */
3639  
3640         evt->event_handler(evt);
3641  
3642 @@ -580,9 +568,9 @@ static irqreturn_t bcm2708_timer_interru
3643  }
3644  
3645  static struct irqaction bcm2708_timer_irq = {
3646 -       .name           = "BCM2708 Timer Tick",
3647 -       .flags          = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
3648 -       .handler        = bcm2708_timer_interrupt,
3649 +       .name = "BCM2708 Timer Tick",
3650 +       .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
3651 +       .handler = bcm2708_timer_interrupt,
3652  };
3653  
3654  /*
3655 @@ -590,6 +578,9 @@ static struct irqaction bcm2708_timer_ir
3656   */
3657  static void __init bcm2708_timer_init(void)
3658  {
3659 +       /* init high res timer */
3660 +       bcm2708_clocksource_init();
3661 +
3662         /*
3663          * Initialise to a known state (all timers off)
3664          */
3665 @@ -600,18 +591,18 @@ static void __init bcm2708_timer_init(vo
3666         setup_irq(IRQ_TIMER3, &bcm2708_timer_irq);
3667  
3668         timer0_clockevent.mult =
3669 -               div_sc(1000000, NSEC_PER_SEC, timer0_clockevent.shift);
3670 +           div_sc(STC_FREQ_HZ, NSEC_PER_SEC, timer0_clockevent.shift);
3671         timer0_clockevent.max_delta_ns =
3672 -               clockevent_delta2ns(0xffffffff, &timer0_clockevent);
3673 +           clockevent_delta2ns(0xffffffff, &timer0_clockevent);
3674         timer0_clockevent.min_delta_ns =
3675 -               clockevent_delta2ns(0xf, &timer0_clockevent);
3676 +           clockevent_delta2ns(0xf, &timer0_clockevent);
3677  
3678         timer0_clockevent.cpumask = cpumask_of(0);
3679         clockevents_register_device(&timer0_clockevent);
3680  }
3681  
3682  struct sys_timer bcm2708_timer = {
3683 -       .init           = bcm2708_timer_init,
3684 +       .init = bcm2708_timer_init,
3685  };
3686  
3687  #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
3688 @@ -619,24 +610,24 @@ struct sys_timer bcm2708_timer = {
3689  
3690  static struct gpio_led bcm2708_leds[] = {
3691         [0] = {
3692 -               .gpio                   = 16,
3693 -               .name                   = "led0",
3694 -               .default_trigger        = "mmc0",
3695 -               .active_low             = 0,
3696 -       },
3697 +              .gpio = 16,
3698 +              .name = "led0",
3699 +              .default_trigger = "mmc0",
3700 +              .active_low = 1,
3701 +              },
3702  };
3703  
3704  static struct gpio_led_platform_data bcm2708_led_pdata = {
3705 -       .num_leds       = ARRAY_SIZE(bcm2708_leds),
3706 -       .leds           = bcm2708_leds,
3707 +       .num_leds = ARRAY_SIZE(bcm2708_leds),
3708 +       .leds = bcm2708_leds,
3709  };
3710  
3711  static struct platform_device bcm2708_led_device = {
3712 -       .name           = "leds-gpio",
3713 -       .id             = -1,
3714 -       .dev            = {
3715 -               .platform_data  = &bcm2708_led_pdata,
3716 -       },
3717 +       .name = "leds-gpio",
3718 +       .id = -1,
3719 +       .dev = {
3720 +               .platform_data = &bcm2708_led_pdata,
3721 +               },
3722  };
3723  
3724  static void __init bcm2708_init_led(void)
3725 @@ -644,14 +635,14 @@ static void __init bcm2708_init_led(void
3726         platform_device_register(&bcm2708_led_device);
3727  }
3728  #else
3729 -static inline void bcm2708_init_led(void) {}
3730 +static inline void bcm2708_init_led(void)
3731 +{
3732 +}
3733  #endif
3734  
3735 -
3736  MACHINE_START(BCM2708, "BCM2708")
3737 -       /* Maintainer: Broadcom Europe Ltd. */
3738 -       .map_io         = bcm2708_map_io,
3739 -       .init_irq       = bcm2708_init_irq,
3740 -       .timer          = &bcm2708_timer,
3741 -       .init_machine   = bcm2708_init,
3742 -MACHINE_END
3743 +    /* Maintainer: Broadcom Europe Ltd. */
3744 +    .map_io = bcm2708_map_io,.init_irq = bcm2708_init_irq,.timer =
3745 +    &bcm2708_timer,.init_machine =
3746 +    bcm2708_init, MACHINE_END module_param(boardrev, uint, 0644);
3747 +module_param(serial, uint, 0644);
3748 --- a/arch/arm/mach-bcm2708/include/mach/memory.h
3749 +++ b/arch/arm/mach-bcm2708/include/mach/memory.h
3750 @@ -32,9 +32,14 @@
3751  /*
3752   * Physical DRAM offset.
3753   */
3754 -#define PHYS_OFFSET     UL(0x00000000)
3755 +#define PLAT_PHYS_OFFSET        UL(0x00000000)
3756  #define ARMMEM_OFFSET    UL(0x00000000)   /* offset in VC of ARM memory */
3757 -#define _REAL_BUS_OFFSET UL(0xC0000000)   /* don't use L1 or L2 caches */
3758 +
3759 +#ifdef CONFIG_BCM2708_NOL2CACHE
3760 + #define _REAL_BUS_OFFSET UL(0xC0000000)   /* don't use L1 or L2 caches */
3761 +#else
3762 + #define _REAL_BUS_OFFSET UL(0x40000000)   /* use L2 cache */
3763 +#endif
3764  
3765  /* We're using the memory at 64M in the VideoCore for Linux - this adjustment
3766   * will provide the offset into this area as well as setting the bits that
3767 @@ -46,8 +51,8 @@
3768  #define BUS_OFFSET          (ARMMEM_OFFSET + _REAL_BUS_OFFSET)
3769  #define __virt_to_bus(x)    ((x) + (BUS_OFFSET - PAGE_OFFSET))
3770  #define __bus_to_virt(x)    ((x) - (BUS_OFFSET - PAGE_OFFSET))
3771 -#define __pfn_to_bus(x)     (__pfn_to_phys(x) + (BUS_OFFSET - PHYS_OFFSET))
3772 -#define __bus_to_pfn(x)     __phys_to_pfn((x) - (BUS_OFFSET - PHYS_OFFSET))
3773 +#define __pfn_to_bus(x)     (__pfn_to_phys(x) + (BUS_OFFSET - PLAT_PHYS_OFFSET))
3774 +#define __bus_to_pfn(x)     __phys_to_pfn((x) - (BUS_OFFSET - PLAT_PHYS_OFFSET))
3775  
3776  /*
3777   * Consistent DMA area set to 2M. Framebuffer now allocated on host
3778 --- a/arch/arm/mach-bcm2708/include/mach/vc_mem.h
3779 +++ b/arch/arm/mach-bcm2708/include/mach/vc_mem.h
3780 @@ -21,6 +21,7 @@
3781  
3782  #define VC_MEM_IOC_MEM_PHYS_ADDR    _IOR( VC_MEM_IOC_MAGIC, 0, unsigned long )
3783  #define VC_MEM_IOC_MEM_SIZE         _IOR( VC_MEM_IOC_MAGIC, 1, unsigned int )
3784 +#define VC_MEM_IOC_MEM_BASE         _IOR( VC_MEM_IOC_MAGIC, 2, unsigned int )
3785  
3786  #if defined( __KERNEL__ )
3787  #define VC_MEM_TO_ARM_ADDR_MASK 0x3FFFFFFF
3788 --- a/arch/arm/mach-bcm2708/power.c
3789 +++ b/arch/arm/mach-bcm2708/power.c
3790 @@ -14,6 +14,7 @@
3791  #include <linux/module.h>
3792  #include <linux/semaphore.h>
3793  #include <linux/bug.h>
3794 +#include <linux/delay.h>
3795  #include <mach/power.h>
3796  #include <mach/vcio.h>
3797  #include <mach/arm_power.h>
3798 @@ -96,7 +97,6 @@ int bcm_power_request(BCM_POWER_HANDLE_T
3799                                 bcm_mailbox_write(MBOX_CHAN_POWER,
3800                                                   global_request << 4);
3801  
3802 -                               /* Wait for a response during power-up */
3803                                 if (global_request & ~g_state.global_request) {
3804                                         rc = bcm_mailbox_read(MBOX_CHAN_POWER,
3805                                                               &actual);
3806 @@ -111,14 +111,14 @@ int bcm_power_request(BCM_POWER_HANDLE_T
3807  
3808                                 if (rc == 0) {
3809                                         if (actual != global_request) {
3810 -                                               printk(KERN_ERR
3811 -                                                    "%s: prev global %x, new global %x, actual %x, request %x, others_request %x\n",
3812 +                                               printk(KERN_INFO
3813 +                                                    "%s: Fail: prev global %x, new global %x, actual %x request %x, others_request %x\n",
3814                                                      __func__,
3815                                                      g_state.global_request,
3816                                                      global_request, actual, request, others_request);
3817                                                 /* A failure */
3818 -                                               BUG_ON((others_request & actual)
3819 -                                                      != others_request);
3820 +                                       //      BUG_ON((others_request & actual)
3821 +                                       //             != others_request);
3822                                                 request &= actual;
3823                                                 rc = -EIO;
3824                                         }
3825 @@ -161,6 +161,7 @@ static int __init bcm_power_init(void)
3826         int i;
3827  
3828         printk(KERN_INFO "bcm_power: Broadcom power driver\n");
3829 +       bcm_mailbox_write(MBOX_CHAN_POWER, 0);
3830  
3831         for (i = 0; i < BCM_POWER_MAXCLIENTS; i++)
3832                 g_state.client_request[i] = BCM_POWER_NOCLIENT;
3833 --- a/arch/arm/mach-bcm2708/vc_mem.c
3834 +++ b/arch/arm/mach-bcm2708/vc_mem.c
3835 @@ -85,9 +85,11 @@ unsigned long mm_vc_mem_phys_addr = MM_A
3836  #endif
3837  
3838  unsigned int mm_vc_mem_size = 0;
3839 +unsigned int mm_vc_mem_base = 0;
3840  
3841  EXPORT_SYMBOL(mm_vc_mem_phys_addr);
3842  EXPORT_SYMBOL(mm_vc_mem_size);
3843 +EXPORT_SYMBOL(mm_vc_mem_base);
3844  
3845  /****************************************************************************
3846  *
3847 @@ -132,36 +134,19 @@ vc_mem_release(struct inode *inode, stru
3848  static void
3849  vc_mem_get_size(void)
3850  {
3851 -#ifdef CONFIG_ARCH_BCM2708
3852         mm_vc_mem_size = 256 * 1024 * 1024;     // Static for now
3853 -#else
3854 -       CHAL_IPC_HANDLE ipc_handle;
3855 -       uint32_t wakeup_register;
3856 -
3857 -       // Get the videocore memory size from the IPC mailbox if not yet
3858 -       // assigned.
3859 -       if (mm_vc_mem_size == 0) {
3860 -               ipc_handle = chal_ipc_config(NULL);
3861 -               if (ipc_handle == NULL) {
3862 -                       LOG_ERR("%s: failed to get IPC handlle", __func__);
3863 -                       return;
3864 -               }
3865 +}
3866  
3867 -               chal_ipc_query_wakeup_vc(ipc_handle, &wakeup_register);
3868 -               if ((wakeup_register & ~1) == 0) {
3869 -                       LOG_DBG("%s: videocore not yet loaded, skipping...",
3870 -                               __func__);
3871 -               } else {
3872 -                       if (chal_ipc_read_mailbox(ipc_handle,
3873 -                                                 IPC_MAILBOX_ID_0,
3874 -                                                 &mm_vc_mem_size) !=
3875 -                           BCM_SUCCESS) {
3876 -                               LOG_ERR("%s: failed to read from IPC mailbox",
3877 -                                       __func__);
3878 -                       }
3879 -               }
3880 -       }
3881 -#endif
3882 +/****************************************************************************
3883 +*
3884 +*   vc_mem_get_base
3885 +*
3886 +***************************************************************************/
3887 +
3888 +static void
3889 +vc_mem_get_base(void)
3890 +{
3891 +       mm_vc_mem_base = 128 * 1024 * 1024;     // Static for now
3892  }
3893  
3894  /****************************************************************************
3895 @@ -220,6 +205,20 @@ vc_mem_ioctl(struct file *file, unsigned
3896                                 rc = -EFAULT;
3897                         }
3898                         break;
3899 +               }
3900 +       case VC_MEM_IOC_MEM_BASE:
3901 +               {
3902 +                       // Get the videocore memory base
3903 +                       vc_mem_get_base();
3904 +
3905 +                       LOG_DBG("%s: VC_MEM_IOC_MEM_BASE=%u", __func__,
3906 +                               mm_vc_mem_base);
3907 +
3908 +                       if (copy_to_user((void *) arg, &mm_vc_mem_base,
3909 +                                        sizeof (mm_vc_mem_base)) != 0) {
3910 +                               rc = -EFAULT;
3911 +                       }
3912 +                       break;
3913                 }
3914         default:
3915                 {
3916 --- a/arch/arm/mach-bcm2708/vcio.c
3917 +++ b/arch/arm/mach-bcm2708/vcio.c
3918 @@ -119,8 +119,7 @@ static int mbox_read(struct vc_mailbox *
3919         if (mbox->magic != MBOX_MAGIC)
3920                 rc = -EINVAL;
3921         else {
3922 -               if (mbox->msg[chan] ||
3923 -                   (down_interruptible(&mbox->sema[chan]) == 0)) {
3924 +               if (down_interruptible(&mbox->sema[chan]) == 0) {
3925                         *data28 = MBOX_DATA28(mbox->msg[chan]);
3926                         mbox->msg[chan] = 0;
3927                         rc = 0;
3928 --- a/drivers/misc/vc04_services/Makefile
3929 +++ b/drivers/misc/vc04_services/Makefile
3930 @@ -2,6 +2,8 @@ obj-$(CONFIG_BCM2708_VCHIQ)     += vchiq.o
3931  
3932  vchiq-objs := \
3933     interface/vchiq_arm/vchiq_core.o  \
3934 +   interface/vchiq_arm/vchiq_shim.o  \
3935 +   interface/vchiq_arm/vchiq_util.o  \
3936     interface/vchiq_arm/vchiq_arm.o \
3937     interface/vchiq_arm/vchiq_kern_lib.o \
3938     interface/vchiq_arm/vchiq_2835_arm.o \
3939 @@ -13,7 +15,7 @@ vchiq-objs := \
3940     interface/vcos/generic/vcos_mem_from_malloc.o \
3941     interface/vcos/generic/vcos_cmd.o
3942  
3943 -EXTRA_CFLAGS += -DVCOS_VERIFY_BKPTS=1 -Idrivers/misc/vc04_services -Idrivers/misc/vc04_services/interface/vcos/linuxkernel
3944 +EXTRA_CFLAGS += -DVCOS_VERIFY_BKPTS=1 -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -Idrivers/misc/vc04_services -Idrivers/misc/vc04_services/interface/vcos/linuxkernel
3945  
3946  
3947  
3948 --- /dev/null
3949 +++ b/drivers/misc/vc04_services/interface/vchi/connections/connection.h
3950 @@ -0,0 +1,309 @@
3951 +/*
3952 + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved.
3953 + *
3954 + * This program is free software; you can redistribute it and/or modify
3955 + * it under the terms of the GNU General Public License as published by
3956 + * the Free Software Foundation; either version 2 of the License, or
3957 + * (at your option) any later version.
3958 + *
3959 + * This program is distributed in the hope that it will be useful,
3960 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3961 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3962 + * GNU General Public License for more details.
3963 + *
3964 + * You should have received a copy of the GNU General Public License
3965 + * along with this program; if not, write to the Free Software
3966 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
3967 + */
3968 +
3969 +#ifndef CONNECTION_H_
3970 +#define CONNECTION_H_
3971 +
3972 +#include "interface/vchi/vchi_cfg_internal.h"
3973 +#include "interface/vchi/vchi_common.h"
3974 +#include "interface/vchi/message_drivers/message.h"
3975 +
3976 +/******************************************************************************
3977 + Global defs
3978 + *****************************************************************************/
3979 +
3980 +// Opaque handle for a connection / service pair
3981 +typedef struct opaque_vchi_connection_connected_service_handle_t *VCHI_CONNECTION_SERVICE_HANDLE_T;
3982 +
3983 +// opaque handle to the connection state information
3984 +typedef struct opaque_vchi_connection_info_t VCHI_CONNECTION_STATE_T;
3985 +
3986 +typedef struct vchi_connection_t VCHI_CONNECTION_T;
3987 +
3988 +
3989 +/******************************************************************************
3990 + API
3991 + *****************************************************************************/
3992 +
3993 +// Routine to init a connection with a particular low level driver
3994 +typedef VCHI_CONNECTION_STATE_T * (*VCHI_CONNECTION_INIT_T)( struct vchi_connection_t * connection,
3995 +                                                             const VCHI_MESSAGE_DRIVER_T * driver );
3996 +
3997 +// Routine to control CRC enabling at a connection level
3998 +typedef int32_t (*VCHI_CONNECTION_CRC_CONTROL_T)( VCHI_CONNECTION_STATE_T *state_handle,
3999 +                                                  VCHI_CRC_CONTROL_T control );
4000 +
4001 +// Routine to create a service
4002 +typedef int32_t (*VCHI_CONNECTION_SERVICE_CONNECT_T)( VCHI_CONNECTION_STATE_T *state_handle,
4003 +                                                      vcos_fourcc_t service_id,
4004 +                                                      uint32_t rx_fifo_size,
4005 +                                                      uint32_t tx_fifo_size,
4006 +                                                      int server,
4007 +                                                      VCHI_CALLBACK_T callback,
4008 +                                                      void *callback_param,
4009 +                                                      vcos_bool_t want_crc,
4010 +                                                      vcos_bool_t want_unaligned_bulk_rx,
4011 +                                                      vcos_bool_t want_unaligned_bulk_tx,
4012 +                                                      VCHI_CONNECTION_SERVICE_HANDLE_T *service_handle );
4013 +
4014 +// Routine to close a service
4015 +typedef int32_t (*VCHI_CONNECTION_SERVICE_DISCONNECT_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle );
4016 +
4017 +// Routine to queue a message
4018 +typedef int32_t (*VCHI_CONNECTION_SERVICE_QUEUE_MESSAGE_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle,
4019 +                                                            const void *data,
4020 +                                                            uint32_t data_size,
4021 +                                                            VCHI_FLAGS_T flags,
4022 +                                                            void *msg_handle );
4023 +
4024 +// scatter-gather (vector) message queueing
4025 +typedef int32_t (*VCHI_CONNECTION_SERVICE_QUEUE_MESSAGEV_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle,
4026 +                                                             VCHI_MSG_VECTOR_T *vector,
4027 +                                                             uint32_t count,
4028 +                                                             VCHI_FLAGS_T flags,
4029 +                                                             void *msg_handle );
4030 +
4031 +// Routine to dequeue a message
4032 +typedef int32_t (*VCHI_CONNECTION_SERVICE_DEQUEUE_MESSAGE_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle,
4033 +                                                              void *data,
4034 +                                                              uint32_t max_data_size_to_read,
4035 +                                                              uint32_t *actual_msg_size,
4036 +                                                              VCHI_FLAGS_T flags );
4037 +
4038 +// Routine to peek at a message
4039 +typedef int32_t (*VCHI_CONNECTION_SERVICE_PEEK_MESSAGE_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle,
4040 +                                                           void **data,
4041 +                                                           uint32_t *msg_size,
4042 +                                                           VCHI_FLAGS_T flags );
4043 +
4044 +// Routine to hold a message
4045 +typedef int32_t (*VCHI_CONNECTION_SERVICE_HOLD_MESSAGE_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle,
4046 +                                                           void **data,
4047 +                                                           uint32_t *msg_size,
4048 +                                                           VCHI_FLAGS_T flags,
4049 +                                                           void **message_handle );
4050 +
4051 +// Routine to initialise a received message iterator
4052 +typedef int32_t (*VCHI_CONNECTION_SERVICE_LOOKAHEAD_MESSAGE_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle,
4053 +                                                                VCHI_MSG_ITER_T *iter,
4054 +                                                                VCHI_FLAGS_T flags );
4055 +
4056 +// Routine to release a held message
4057 +typedef int32_t (*VCHI_CONNECTION_HELD_MSG_RELEASE_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle,
4058 +                                                       void *message_handle );
4059 +
4060 +// Routine to get info on a held message
4061 +typedef int32_t (*VCHI_CONNECTION_HELD_MSG_INFO_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle,
4062 +                                                    void *message_handle,
4063 +                                                    void **data,
4064 +                                                    int32_t *msg_size,
4065 +                                                    uint32_t *tx_timestamp,
4066 +                                                    uint32_t *rx_timestamp );
4067 +
4068 +// Routine to check whether the iterator has a next message
4069 +typedef vcos_bool_t (*VCHI_CONNECTION_MSG_ITER_HAS_NEXT_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service,
4070 +                                                       const VCHI_MSG_ITER_T *iter );
4071 +
4072 +// Routine to advance the iterator
4073 +typedef int32_t (*VCHI_CONNECTION_MSG_ITER_NEXT_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service,
4074 +                                                    VCHI_MSG_ITER_T *iter,
4075 +                                                    void **data,
4076 +                                                    uint32_t *msg_size );
4077 +
4078 +// Routine to remove the last message returned by the iterator
4079 +typedef int32_t (*VCHI_CONNECTION_MSG_ITER_REMOVE_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service,
4080 +                                                      VCHI_MSG_ITER_T *iter );
4081 +
4082 +// Routine to hold the last message returned by the iterator
4083 +typedef int32_t (*VCHI_CONNECTION_MSG_ITER_HOLD_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service,
4084 +                                                    VCHI_MSG_ITER_T *iter,
4085 +                                                    void **msg_handle );
4086 +
4087 +// Routine to transmit bulk data
4088 +typedef int32_t (*VCHI_CONNECTION_BULK_QUEUE_TRANSMIT_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle,
4089 +                                                          const void *data_src,
4090 +                                                          uint32_t data_size,
4091 +                                                          VCHI_FLAGS_T flags,
4092 +                                                          void *bulk_handle );
4093 +
4094 +// Routine to receive data
4095 +typedef int32_t (*VCHI_CONNECTION_BULK_QUEUE_RECEIVE_T)( VCHI_CONNECTION_SERVICE_HANDLE_T service_handle,
4096 +                                                         void *data_dst,
4097 +                                                         uint32_t data_size,
4098 +                                                         VCHI_FLAGS_T flags,
4099 +                                                         void *bulk_handle );
4100 +
4101 +// Routine to report if a server is available
4102 +typedef int32_t (*VCHI_CONNECTION_SERVER_PRESENT)( VCHI_CONNECTION_STATE_T *state, vcos_fourcc_t service_id, int32_t peer_flags );
4103 +
4104 +// Routine to report the number of RX slots available
4105 +typedef int (*VCHI_CONNECTION_RX_SLOTS_AVAILABLE)( const VCHI_CONNECTION_STATE_T *state );
4106 +
4107 +// Routine to report the RX slot size
4108 +typedef uint32_t (*VCHI_CONNECTION_RX_SLOT_SIZE)( const VCHI_CONNECTION_STATE_T *state );
4109 +
4110 +// Callback to indicate that the other side has added a buffer to the rx bulk DMA FIFO
4111 +typedef void (*VCHI_CONNECTION_RX_BULK_BUFFER_ADDED)(VCHI_CONNECTION_STATE_T *state,
4112 +                                                     vcos_fourcc_t service,
4113 +                                                     uint32_t length,
4114 +                                                     MESSAGE_TX_CHANNEL_T channel,
4115 +                                                     uint32_t channel_params,
4116 +                                                     uint32_t data_length,
4117 +                                                     uint32_t data_offset);
4118 +
4119 +// Callback to inform a service that a Xon or Xoff message has been received
4120 +typedef void (*VCHI_CONNECTION_FLOW_CONTROL)(VCHI_CONNECTION_STATE_T *state, vcos_fourcc_t service_id, int32_t xoff);
4121 +
4122 +// Callback to inform a service that a server available reply message has been received
4123 +typedef void (*VCHI_CONNECTION_SERVER_AVAILABLE_REPLY)(VCHI_CONNECTION_STATE_T *state, vcos_fourcc_t service_id, uint32_t flags);
4124 +
4125 +// Callback to indicate that bulk auxiliary messages have arrived
4126 +typedef void (*VCHI_CONNECTION_BULK_AUX_RECEIVED)(VCHI_CONNECTION_STATE_T *state);
4127 +
4128 +// Callback to indicate that bulk auxiliary messages have arrived
4129 +typedef void (*VCHI_CONNECTION_BULK_AUX_TRANSMITTED)(VCHI_CONNECTION_STATE_T *state, void *handle);
4130 +
4131 +// Callback with all the connection info you require
4132 +typedef void (*VCHI_CONNECTION_INFO)(VCHI_CONNECTION_STATE_T *state, uint32_t protocol_version, uint32_t slot_size, uint32_t num_slots, uint32_t min_bulk_size);
4133 +
4134 +// Callback to inform of a disconnect
4135 +typedef void (*VCHI_CONNECTION_DISCONNECT)(VCHI_CONNECTION_STATE_T *state, uint32_t flags);
4136 +
4137 +// Callback to inform of a power control request
4138 +typedef void (*VCHI_CONNECTION_POWER_CONTROL)(VCHI_CONNECTION_STATE_T *state, MESSAGE_TX_CHANNEL_T channel, vcos_bool_t enable);
4139 +
4140 +// allocate memory suitably aligned for this connection
4141 +typedef void * (*VCHI_BUFFER_ALLOCATE)(VCHI_CONNECTION_SERVICE_HANDLE_T service_handle, uint32_t * length);
4142 +
4143 +// free memory allocated by buffer_allocate
4144 +typedef void   (*VCHI_BUFFER_FREE)(VCHI_CONNECTION_SERVICE_HANDLE_T service_handle, void * address);
4145 +
4146 +
4147 +/******************************************************************************
4148 + System driver struct
4149 + *****************************************************************************/
4150 +
4151 +struct opaque_vchi_connection_api_t
4152 +{
4153 +   // Routine to init the connection
4154 +   VCHI_CONNECTION_INIT_T                      init;
4155 +
4156 +   // Connection-level CRC control
4157 +   VCHI_CONNECTION_CRC_CONTROL_T               crc_control;
4158 +
4159 +   // Routine to connect to or create service
4160 +   VCHI_CONNECTION_SERVICE_CONNECT_T           service_connect;
4161 +
4162 +   // Routine to disconnect from a service
4163 +   VCHI_CONNECTION_SERVICE_DISCONNECT_T        service_disconnect;
4164 +
4165 +   // Routine to queue a message
4166 +   VCHI_CONNECTION_SERVICE_QUEUE_MESSAGE_T     service_queue_msg;
4167 +
4168 +   // scatter-gather (vector) message queue
4169 +   VCHI_CONNECTION_SERVICE_QUEUE_MESSAGEV_T    service_queue_msgv;
4170 +
4171 +   // Routine to dequeue a message
4172 +   VCHI_CONNECTION_SERVICE_DEQUEUE_MESSAGE_T   service_dequeue_msg;
4173 +
4174 +   // Routine to peek at a message
4175 +   VCHI_CONNECTION_SERVICE_PEEK_MESSAGE_T      service_peek_msg;
4176 +
4177 +   // Routine to hold a message
4178 +   VCHI_CONNECTION_SERVICE_HOLD_MESSAGE_T      service_hold_msg;
4179 +
4180 +   // Routine to initialise a received message iterator
4181 +   VCHI_CONNECTION_SERVICE_LOOKAHEAD_MESSAGE_T service_look_ahead_msg;
4182 +
4183 +   // Routine to release a message
4184 +   VCHI_CONNECTION_HELD_MSG_RELEASE_T          held_msg_release;
4185 +
4186 +   // Routine to get information on a held message
4187 +   VCHI_CONNECTION_HELD_MSG_INFO_T             held_msg_info;
4188 +
4189 +   // Routine to check for next message on iterator
4190 +   VCHI_CONNECTION_MSG_ITER_HAS_NEXT_T         msg_iter_has_next;
4191 +
4192 +   // Routine to get next message on iterator
4193 +   VCHI_CONNECTION_MSG_ITER_NEXT_T             msg_iter_next;
4194 +
4195 +   // Routine to remove the last message returned by iterator
4196 +   VCHI_CONNECTION_MSG_ITER_REMOVE_T           msg_iter_remove;
4197 +
4198 +   // Routine to hold the last message returned by iterator
4199 +   VCHI_CONNECTION_MSG_ITER_HOLD_T             msg_iter_hold;
4200 +
4201 +   // Routine to transmit bulk data
4202 +   VCHI_CONNECTION_BULK_QUEUE_TRANSMIT_T       bulk_queue_transmit;
4203 +
4204 +   // Routine to receive data
4205 +   VCHI_CONNECTION_BULK_QUEUE_RECEIVE_T        bulk_queue_receive;
4206 +
4207 +   // Routine to report the available servers
4208 +   VCHI_CONNECTION_SERVER_PRESENT              server_present;
4209 +
4210 +   // Routine to report the number of RX slots available
4211 +   VCHI_CONNECTION_RX_SLOTS_AVAILABLE          connection_rx_slots_available;
4212 +
4213 +   // Routine to report the RX slot size
4214 +   VCHI_CONNECTION_RX_SLOT_SIZE                connection_rx_slot_size;
4215 +
4216 +   // Callback to indicate that the other side has added a buffer to the rx bulk DMA FIFO
4217 +   VCHI_CONNECTION_RX_BULK_BUFFER_ADDED        rx_bulk_buffer_added;
4218 +
4219 +   // Callback to inform a service that a Xon or Xoff message has been received
4220 +   VCHI_CONNECTION_FLOW_CONTROL                flow_control;
4221 +
4222 +   // Callback to inform a service that a server available reply message has been received
4223 +   VCHI_CONNECTION_SERVER_AVAILABLE_REPLY      server_available_reply;
4224 +
4225 +   // Callback to indicate that bulk auxiliary messages have arrived
4226 +   VCHI_CONNECTION_BULK_AUX_RECEIVED           bulk_aux_received;
4227 +
4228 +   // Callback to indicate that a bulk auxiliary message has been transmitted
4229 +   VCHI_CONNECTION_BULK_AUX_TRANSMITTED        bulk_aux_transmitted;
4230 +
4231 +   // Callback to provide information about the connection
4232 +   VCHI_CONNECTION_INFO                        connection_info;
4233 +
4234 +   // Callback to notify that peer has requested disconnect
4235 +   VCHI_CONNECTION_DISCONNECT                  disconnect;
4236 +
4237 +   // Callback to notify that peer has requested power change
4238 +   VCHI_CONNECTION_POWER_CONTROL               power_control;
4239 +
4240 +   // allocate memory suitably aligned for this connection
4241 +   VCHI_BUFFER_ALLOCATE                        buffer_allocate;
4242 +
4243 +   // free memory allocated by buffer_allocate
4244 +   VCHI_BUFFER_FREE                            buffer_free;
4245 +
4246 +};
4247 +
4248 +struct vchi_connection_t {
4249 +   const VCHI_CONNECTION_API_T *api;
4250 +   VCHI_CONNECTION_STATE_T     *state;
4251 +#ifdef VCHI_COARSE_LOCKING
4252 +   VCOS_SEMAPHORE_T             sem;
4253 +#endif
4254 +};
4255 +
4256 +
4257 +#endif /* CONNECTION_H_ */
4258 +
4259 +/****************************** End of file **********************************/
4260 --- /dev/null
4261 +++ b/drivers/misc/vc04_services/interface/vchi/message_drivers/message.h
4262 @@ -0,0 +1,186 @@
4263 +/*
4264 + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved.
4265 + *
4266 + * This program is free software; you can redistribute it and/or modify
4267 + * it under the terms of the GNU General Public License as published by
4268 + * the Free Software Foundation; either version 2 of the License, or
4269 + * (at your option) any later version.
4270 + *
4271 + * This program is distributed in the hope that it will be useful,
4272 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4273 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
4274 + * GNU General Public License for more details.
4275 + *
4276 + * You should have received a copy of the GNU General Public License
4277 + * along with this program; if not, write to the Free Software
4278 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
4279 + */
4280 +
4281 +#ifndef _VCHI_MESSAGE_H_
4282 +#define _VCHI_MESSAGE_H_
4283 +
4284 +#include "interface/vchi/vchi_cfg_internal.h"
4285 +#include "interface/vcos/vcos.h"
4286 +#include "interface/vchi/vchi_common.h"
4287 +
4288 +
4289 +typedef enum message_event_type {
4290 +   MESSAGE_EVENT_NONE,
4291 +   MESSAGE_EVENT_NOP,
4292 +   MESSAGE_EVENT_MESSAGE,
4293 +   MESSAGE_EVENT_SLOT_COMPLETE,
4294 +   MESSAGE_EVENT_RX_BULK_PAUSED,
4295 +   MESSAGE_EVENT_RX_BULK_COMPLETE,
4296 +   MESSAGE_EVENT_TX_COMPLETE,
4297 +   MESSAGE_EVENT_MSG_DISCARDED
4298 +} MESSAGE_EVENT_TYPE_T;
4299 +
4300 +typedef enum vchi_msg_flags
4301 +{
4302 +   VCHI_MSG_FLAGS_NONE                  = 0x0,
4303 +   VCHI_MSG_FLAGS_TERMINATE_DMA         = 0x1
4304 +} VCHI_MSG_FLAGS_T;
4305 +
4306 +typedef enum message_tx_channel
4307 +{
4308 +   MESSAGE_TX_CHANNEL_MESSAGE           = 0,
4309 +   MESSAGE_TX_CHANNEL_BULK              = 1 // drivers may provide multiple bulk channels, from 1 upwards
4310 +} MESSAGE_TX_CHANNEL_T;
4311 +
4312 +// Macros used for cycling through bulk channels
4313 +#define MESSAGE_TX_CHANNEL_BULK_PREV(c) (MESSAGE_TX_CHANNEL_BULK+((c)-MESSAGE_TX_CHANNEL_BULK+VCHI_MAX_BULK_TX_CHANNELS_PER_CONNECTION-1)%VCHI_MAX_BULK_TX_CHANNELS_PER_CONNECTION)
4314 +#define MESSAGE_TX_CHANNEL_BULK_NEXT(c) (MESSAGE_TX_CHANNEL_BULK+((c)-MESSAGE_TX_CHANNEL_BULK+1)%VCHI_MAX_BULK_TX_CHANNELS_PER_CONNECTION)
4315 +
4316 +typedef enum message_rx_channel
4317 +{
4318 +   MESSAGE_RX_CHANNEL_MESSAGE           = 0,
4319 +   MESSAGE_RX_CHANNEL_BULK              = 1 // drivers may provide multiple bulk channels, from 1 upwards
4320 +} MESSAGE_RX_CHANNEL_T;
4321 +
4322 +// Message receive slot information
4323 +typedef struct rx_msg_slot_info {
4324 +
4325 +   struct rx_msg_slot_info *next;
4326 +   //struct slot_info *prev;
4327 +#if !defined VCHI_COARSE_LOCKING
4328 +   VCOS_SEMAPHORE_T   sem;
4329 +#endif
4330 +
4331 +   uint8_t           *addr;               // base address of slot
4332 +   uint32_t           len;                // length of slot in bytes
4333 +
4334 +   uint32_t           write_ptr;          // hardware causes this to advance
4335 +   uint32_t           read_ptr;           // this module does the reading
4336 +   int                active;             // is this slot in the hardware dma fifo?
4337 +   uint32_t           msgs_parsed;        // count how many messages are in this slot
4338 +   uint32_t           msgs_released;      // how many messages have been released
4339 +   void              *state;              // connection state information
4340 +   uint8_t            ref_count[VCHI_MAX_SERVICES_PER_CONNECTION];          // reference count for slots held by services
4341 +} RX_MSG_SLOTINFO_T;
4342 +
4343 +// The message driver no longer needs to know about the fields of RX_BULK_SLOTINFO_T - sort this out.
4344 +// In particular, it mustn't use addr and len - they're the client buffer, but the message
4345 +// driver will be tasked with sending the aligned core section.
4346 +typedef struct rx_bulk_slotinfo_t {
4347 +   struct rx_bulk_slotinfo_t *next;
4348 +
4349 +   VCOS_SEMAPHORE_T *blocking;
4350 +
4351 +   // needed by DMA
4352 +   void        *addr;
4353 +   uint32_t     len;
4354 +
4355 +   // needed for the callback
4356 +   void        *service;
4357 +   void        *handle;
4358 +   VCHI_FLAGS_T flags;
4359 +} RX_BULK_SLOTINFO_T;
4360 +
4361 +
4362 +/* ----------------------------------------------------------------------
4363 + * each connection driver will have a pool of the following struct.
4364 + *
4365 + * the pool will be managed by vchi_qman_*
4366 + * this means there will be multiple queues (single linked lists)
4367 + * a given struct message_info will be on exactly one of these queues
4368 + * at any one time
4369 + * -------------------------------------------------------------------- */
4370 +typedef struct rx_message_info {
4371 +
4372 +   struct message_info *next;
4373 +   //struct message_info *prev;
4374 +
4375 +   uint8_t    *addr;
4376 +   uint32_t   len;
4377 +   RX_MSG_SLOTINFO_T *slot; // points to whichever slot contains this message
4378 +   uint32_t   tx_timestamp;
4379 +   uint32_t   rx_timestamp;
4380 +
4381 +} RX_MESSAGE_INFO_T;
4382 +
4383 +typedef struct {
4384 +   MESSAGE_EVENT_TYPE_T type;
4385 +
4386 +   struct {
4387 +      // for messages
4388 +      void    *addr;           // address of message
4389 +      uint16_t slot_delta;     // whether this message indicated slot delta
4390 +      uint32_t len;            // length of message
4391 +      RX_MSG_SLOTINFO_T *slot; // slot this message is in
4392 +      vcos_fourcc_t service;   // service id this message is destined for
4393 +      uint32_t tx_timestamp;   // timestamp from the header
4394 +      uint32_t rx_timestamp;   // timestamp when we parsed it
4395 +   } message;
4396 +
4397 +   // FIXME: cleanup slot reporting...
4398 +   RX_MSG_SLOTINFO_T *rx_msg;
4399 +   RX_BULK_SLOTINFO_T *rx_bulk;
4400 +   void *tx_handle;
4401 +   MESSAGE_TX_CHANNEL_T tx_channel;
4402 +
4403 +} MESSAGE_EVENT_T;
4404 +
4405 +
4406 +// callbacks
4407 +typedef void VCHI_MESSAGE_DRIVER_EVENT_CALLBACK_T( void *state );
4408 +
4409 +typedef struct {
4410 +   VCHI_MESSAGE_DRIVER_EVENT_CALLBACK_T *event_callback;
4411 +} VCHI_MESSAGE_DRIVER_OPEN_T;
4412 +
4413 +
4414 +// handle to this instance of message driver (as returned by ->open)
4415 +typedef struct opaque_mhandle_t *VCHI_MDRIVER_HANDLE_T;
4416 +
4417 +struct opaque_vchi_message_driver_t {
4418 +   VCHI_MDRIVER_HANDLE_T *(*open)( VCHI_MESSAGE_DRIVER_OPEN_T *params, void *state );
4419 +   int32_t (*suspending)( VCHI_MDRIVER_HANDLE_T *handle );
4420 +   int32_t (*resumed)( VCHI_MDRIVER_HANDLE_T *handle );
4421 +   int32_t (*power_control)( VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_TX_CHANNEL_T, vcos_bool_t enable );
4422 +   int32_t (*add_msg_rx_slot)( VCHI_MDRIVER_HANDLE_T *handle, RX_MSG_SLOTINFO_T *slot );      // rx message
4423 +   int32_t (*add_bulk_rx)( VCHI_MDRIVER_HANDLE_T *handle, void *data, uint32_t len, RX_BULK_SLOTINFO_T *slot );  // rx data (bulk)
4424 +   int32_t (*send)( VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_TX_CHANNEL_T channel, const void *data, uint32_t len, VCHI_MSG_FLAGS_T flags, void *send_handle );      // tx (message & bulk)
4425 +   void    (*next_event)( VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_EVENT_T *event );     // get the next event from message_driver
4426 +   int32_t (*enable)( VCHI_MDRIVER_HANDLE_T *handle );
4427 +   int32_t (*form_message)( VCHI_MDRIVER_HANDLE_T *handle, vcos_fourcc_t service_id, VCHI_MSG_VECTOR_T *vector, uint32_t count, void
4428 +                            *address, uint32_t length_avail, uint32_t max_total_length, vcos_bool_t pad_to_fill, vcos_bool_t allow_partial );
4429 +
4430 +   int32_t (*update_message)( VCHI_MDRIVER_HANDLE_T *handle, void *dest, int16_t *slot_count );
4431 +   int32_t (*buffer_aligned)( VCHI_MDRIVER_HANDLE_T *handle, int tx, int uncached, const void *address, const uint32_t length );
4432 +   void *  (*allocate_buffer)( VCHI_MDRIVER_HANDLE_T *handle, uint32_t *length );
4433 +   void    (*free_buffer)( VCHI_MDRIVER_HANDLE_T *handle, void *address );
4434 +   int     (*rx_slot_size)( VCHI_MDRIVER_HANDLE_T *handle, int msg_size );
4435 +   int     (*tx_slot_size)( VCHI_MDRIVER_HANDLE_T *handle, int msg_size );
4436 +
4437 +   vcos_bool_t  (*tx_supports_terminate)( const VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_TX_CHANNEL_T channel );
4438 +   uint32_t (*tx_bulk_chunk_size)( const VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_TX_CHANNEL_T channel );
4439 +   int     (*tx_alignment)( const VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_TX_CHANNEL_T channel );
4440 +   int     (*rx_alignment)( const VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_RX_CHANNEL_T channel );
4441 +   void    (*form_bulk_aux)( VCHI_MDRIVER_HANDLE_T *handle, MESSAGE_TX_CHANNEL_T channel, const void *data, uint32_t len, uint32_t chunk_size, const void **aux_data, int32_t *aux_len );
4442 +   void    (*debug)( VCHI_MDRIVER_HANDLE_T *handle );
4443 +};
4444 +
4445 +
4446 +#endif // _VCHI_MESSAGE_H_
4447 +
4448 +/****************************** End of file ***********************************/
4449 --- /dev/null
4450 +++ b/drivers/misc/vc04_services/interface/vchi/vchi.h
4451 @@ -0,0 +1,347 @@
4452 +/*
4453 + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved.
4454 + *
4455 + * This program is free software; you can redistribute it and/or modify
4456 + * it under the terms of the GNU General Public License as published by
4457 + * the Free Software Foundation; either version 2 of the License, or
4458 + * (at your option) any later version.
4459 + *
4460 + * This program is distributed in the hope that it will be useful,
4461 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4462 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
4463 + * GNU General Public License for more details.
4464 + *
4465 + * You should have received a copy of the GNU General Public License
4466 + * along with this program; if not, write to the Free Software
4467 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
4468 + */
4469 +
4470 +/*=============================================================================
4471 +Contains the protypes for the vchi functions.
4472 +=============================================================================*/
4473 +
4474 +#ifndef VCHI_H_
4475 +#define VCHI_H_
4476 +
4477 +#include "interface/vcos/vcos.h"
4478 +#include "interface/vchi/vchi_cfg.h"
4479 +#include "interface/vchi/vchi_common.h"
4480 +#include "interface/vchi/connections/connection.h"
4481 +#include "vchi_mh.h"
4482 +
4483 +
4484 +/******************************************************************************
4485 + Global defs
4486 + *****************************************************************************/
4487 +
4488 +#define VCHI_BULK_ROUND_UP(x)     ((((unsigned long)(x))+VCHI_BULK_ALIGN-1) & ~(VCHI_BULK_ALIGN-1))
4489 +#define VCHI_BULK_ROUND_DOWN(x)   (((unsigned long)(x)) & ~(VCHI_BULK_ALIGN-1))
4490 +#define VCHI_BULK_ALIGN_NBYTES(x) (VCHI_BULK_ALIGNED(x) ? 0 : (VCHI_BULK_ALIGN - ((unsigned long)(x) & (VCHI_BULK_ALIGN-1))))
4491 +
4492 +#ifdef USE_VCHIQ_ARM
4493 +#define VCHI_BULK_ALIGNED(x)      1
4494 +#else
4495 +#define VCHI_BULK_ALIGNED(x)      (((unsigned long)(x) & (VCHI_BULK_ALIGN-1)) == 0)
4496 +#endif
4497 +
4498 +
4499 +typedef enum
4500 +{
4501 +   VCHI_VEC_POINTER,
4502 +   VCHI_VEC_HANDLE,
4503 +   VCHI_VEC_LIST
4504 +} VCHI_MSG_VECTOR_TYPE_T;
4505 +
4506 +typedef struct vchi_msg_vector_ex {
4507 +
4508 +   VCHI_MSG_VECTOR_TYPE_T type;
4509 +   union
4510 +   {
4511 +      // a memory handle
4512 +      struct
4513 +      {
4514 +         VCHI_MEM_HANDLE_T handle;
4515 +         uint32_t offset;
4516 +         int32_t vec_len;
4517 +      } handle;
4518 +
4519 +      // an ordinary data pointer
4520 +      struct
4521 +      {
4522 +         const void *vec_base;
4523 +         int32_t vec_len;
4524 +      } ptr;
4525 +
4526 +      // a nested vector list
4527 +      struct
4528 +      {
4529 +         struct vchi_msg_vector_ex *vec;
4530 +         uint32_t vec_len;
4531 +      } list;
4532 +   } u;
4533 +} VCHI_MSG_VECTOR_EX_T;
4534 +
4535 +
4536 +// Construct an entry in a msg vector for a pointer (p) of length (l)
4537 +#define VCHI_VEC_POINTER(p,l)  VCHI_VEC_POINTER, { { (VCHI_MEM_HANDLE_T)(p), (l) } }
4538 +
4539 +// Construct an entry in a msg vector for a message handle (h), starting at offset (o) of length (l)
4540 +#define VCHI_VEC_HANDLE(h,o,l) VCHI_VEC_HANDLE,  { { (h), (o), (l) } }
4541 +
4542 +// Macros to manipulate fourcc_t values
4543 +#define MAKE_FOURCC(x) ((fourcc_t)( (x[0] << 24) | (x[1] << 16) | (x[2] << 8) | x[3] ))
4544 +#define FOURCC_TO_CHAR(x) (x >> 24) & 0xFF,(x >> 16) & 0xFF,(x >> 8) & 0xFF, x & 0xFF
4545 +
4546 +
4547 +// Opaque service information
4548 +struct opaque_vchi_service_t;
4549 +
4550 +// Descriptor for a held message. Allocated by client, initialised by vchi_msg_hold,
4551 +// vchi_msg_iter_hold or vchi_msg_iter_hold_next. Fields are for internal VCHI use only.
4552 +typedef struct
4553 +{
4554 +   struct opaque_vchi_service_t *service;
4555 +   void *message;
4556 +} VCHI_HELD_MSG_T;
4557 +
4558 +
4559 +
4560 +// structure used to provide the information needed to open a server or a client
4561 +typedef struct {
4562 +   vcos_fourcc_t service_id;
4563 +   VCHI_CONNECTION_T *connection;
4564 +   uint32_t rx_fifo_size;
4565 +   uint32_t tx_fifo_size;
4566 +   VCHI_CALLBACK_T callback;
4567 +   void *callback_param;
4568 +   vcos_bool_t want_unaligned_bulk_rx;    // client intends to receive bulk transfers of odd lengths or into unaligned buffers
4569 +   vcos_bool_t want_unaligned_bulk_tx;    // client intends to transmit bulk transfers of odd lengths or out of unaligned buffers
4570 +   vcos_bool_t want_crc;                  // client wants to check CRCs on (bulk) transfers. Only needs to be set at 1 end - will do both directions.
4571 +} SERVICE_CREATION_T;
4572 +
4573 +// Opaque handle for a VCHI instance
4574 +typedef struct opaque_vchi_instance_handle_t *VCHI_INSTANCE_T;
4575 +
4576 +// Opaque handle for a server or client
4577 +typedef struct opaque_vchi_service_handle_t *VCHI_SERVICE_HANDLE_T;
4578 +
4579 +// Service registration & startup
4580 +typedef void (*VCHI_SERVICE_INIT)(VCHI_INSTANCE_T initialise_instance, VCHI_CONNECTION_T **connections, uint32_t num_connections);
4581 +
4582 +typedef struct service_info_tag {
4583 +   const char * const vll_filename; /* VLL to load to start this service. This is an empty string if VLL is "static" */
4584 +   VCHI_SERVICE_INIT init;          /* Service initialisation function */
4585 +   void *vll_handle;                /* VLL handle; NULL when unloaded or a "static VLL" in build */
4586 +} SERVICE_INFO_T;
4587 +
4588 +/******************************************************************************
4589 + Global funcs - implementation is specific to which side you are on (local / remote)
4590 + *****************************************************************************/
4591 +
4592 +#ifdef __cplusplus
4593 +extern "C" {
4594 +#endif
4595 +
4596 +extern /*@observer@*/ VCHI_CONNECTION_T * vchi_create_connection( const VCHI_CONNECTION_API_T * function_table,
4597 +                                                   const VCHI_MESSAGE_DRIVER_T * low_level);
4598 +
4599 +
4600 +// Routine used to initialise the vchi on both local + remote connections
4601 +extern int32_t vchi_initialise( VCHI_INSTANCE_T *instance_handle );
4602 +
4603 +extern int32_t vchi_exit( void );
4604 +
4605 +extern int32_t vchi_connect( VCHI_CONNECTION_T **connections,
4606 +                             const uint32_t num_connections,
4607 +                             VCHI_INSTANCE_T instance_handle );
4608 +
4609 +//When this is called, ensure that all services have no data pending.
4610 +//Bulk transfers can remain 'queued'
4611 +extern int32_t vchi_disconnect( VCHI_INSTANCE_T instance_handle );
4612 +
4613 +// Global control over bulk CRC checking
4614 +extern int32_t vchi_crc_control( VCHI_CONNECTION_T *connection,
4615 +                                 VCHI_CRC_CONTROL_T control );
4616 +
4617 +// helper functions
4618 +extern void * vchi_allocate_buffer(VCHI_SERVICE_HANDLE_T handle, uint32_t *length);
4619 +extern void vchi_free_buffer(VCHI_SERVICE_HANDLE_T handle, void *address);
4620 +extern uint32_t vchi_current_time(VCHI_INSTANCE_T instance_handle);
4621 +
4622 +
4623 +/******************************************************************************
4624 + Global service API
4625 + *****************************************************************************/
4626 +// Routine to create a named service
4627 +extern int32_t vchi_service_create( VCHI_INSTANCE_T instance_handle,
4628 +                                    SERVICE_CREATION_T *setup,
4629 +                                    VCHI_SERVICE_HANDLE_T *handle );
4630 +
4631 +// Routine to destory a service
4632 +extern int32_t vchi_service_destroy( const VCHI_SERVICE_HANDLE_T handle );
4633 +
4634 +// Routine to open a named service
4635 +extern int32_t vchi_service_open( VCHI_INSTANCE_T instance_handle,
4636 +                                  SERVICE_CREATION_T *setup,
4637 +                                  VCHI_SERVICE_HANDLE_T *handle);
4638 +
4639 +// Routine to close a named service
4640 +extern int32_t vchi_service_close( const VCHI_SERVICE_HANDLE_T handle );
4641 +
4642 +// Routine to increment ref count on a named service
4643 +extern int32_t vchi_service_use( const VCHI_SERVICE_HANDLE_T handle );
4644 +
4645 +// Routine to decrement ref count on a named service
4646 +extern int32_t vchi_service_release( const VCHI_SERVICE_HANDLE_T handle );
4647 +
4648 +// Routine to send a message accross a service
4649 +extern int32_t vchi_msg_queue( VCHI_SERVICE_HANDLE_T handle,
4650 +                               const void *data,
4651 +                               uint32_t data_size,
4652 +                               VCHI_FLAGS_T flags,
4653 +                               void *msg_handle );
4654 +
4655 +// scatter-gather (vector) and send message
4656 +int32_t vchi_msg_queuev_ex( VCHI_SERVICE_HANDLE_T handle,
4657 +                            VCHI_MSG_VECTOR_EX_T *vector,
4658 +                            uint32_t count,
4659 +                            VCHI_FLAGS_T flags,
4660 +                            void *msg_handle );
4661 +
4662 +// legacy scatter-gather (vector) and send message, only handles pointers
4663 +int32_t vchi_msg_queuev( VCHI_SERVICE_HANDLE_T handle,
4664 +                         VCHI_MSG_VECTOR_T *vector,
4665 +                         uint32_t count,
4666 +                         VCHI_FLAGS_T flags,
4667 +                         void *msg_handle );
4668 +
4669 +// Routine to receive a msg from a service
4670 +// Dequeue is equivalent to hold, copy into client buffer, release
4671 +extern int32_t vchi_msg_dequeue( VCHI_SERVICE_HANDLE_T handle,
4672 +                                 void *data,
4673 +                                 uint32_t max_data_size_to_read,
4674 +                                 uint32_t *actual_msg_size,
4675 +                                 VCHI_FLAGS_T flags );
4676 +
4677 +// Routine to look at a message in place.
4678 +// The message is not dequeued, so a subsequent call to peek or dequeue
4679 +// will return the same message.
4680 +extern int32_t vchi_msg_peek( VCHI_SERVICE_HANDLE_T handle,
4681 +                              void **data,
4682 +                              uint32_t *msg_size,
4683 +                              VCHI_FLAGS_T flags );
4684 +
4685 +// Routine to remove a message after it has been read in place with peek
4686 +// The first message on the queue is dequeued.
4687 +extern int32_t vchi_msg_remove( VCHI_SERVICE_HANDLE_T handle );
4688 +
4689 +// Routine to look at a message in place.
4690 +// The message is dequeued, so the caller is left holding it; the descriptor is
4691 +// filled in and must be released when the user has finished with the message.
4692 +extern int32_t vchi_msg_hold( VCHI_SERVICE_HANDLE_T handle,
4693 +                              void **data,        // } may be NULL, as info can be
4694 +                              uint32_t *msg_size, // } obtained from HELD_MSG_T
4695 +                              VCHI_FLAGS_T flags,
4696 +                              VCHI_HELD_MSG_T *message_descriptor );
4697 +
4698 +// Initialise an iterator to look through messages in place
4699 +extern int32_t vchi_msg_look_ahead( VCHI_SERVICE_HANDLE_T handle,
4700 +                                    VCHI_MSG_ITER_T *iter,
4701 +                                    VCHI_FLAGS_T flags );
4702 +
4703 +/******************************************************************************
4704 + Global service support API - operations on held messages and message iterators
4705 + *****************************************************************************/
4706 +
4707 +// Routine to get the address of a held message
4708 +extern void *vchi_held_msg_ptr( const VCHI_HELD_MSG_T *message );
4709 +
4710 +// Routine to get the size of a held message
4711 +extern int32_t vchi_held_msg_size( const VCHI_HELD_MSG_T *message );
4712 +
4713 +// Routine to get the transmit timestamp as written into the header by the peer
4714 +extern uint32_t vchi_held_msg_tx_timestamp( const VCHI_HELD_MSG_T *message );
4715 +
4716 +// Routine to get the reception timestamp, written as we parsed the header
4717 +extern uint32_t vchi_held_msg_rx_timestamp( const VCHI_HELD_MSG_T *message );
4718 +
4719 +// Routine to release a held message after it has been processed
4720 +extern int32_t vchi_held_msg_release( VCHI_HELD_MSG_T *message );
4721 +
4722 +// Indicates whether the iterator has a next message.
4723 +extern vcos_bool_t vchi_msg_iter_has_next( const VCHI_MSG_ITER_T *iter );
4724 +
4725 +// Return the pointer and length for the next message and advance the iterator.
4726 +extern int32_t vchi_msg_iter_next( VCHI_MSG_ITER_T *iter,
4727 +                                   void **data,
4728 +                                   uint32_t *msg_size );
4729 +
4730 +// Remove the last message returned by vchi_msg_iter_next.
4731 +// Can only be called once after each call to vchi_msg_iter_next.
4732 +extern int32_t vchi_msg_iter_remove( VCHI_MSG_ITER_T *iter );
4733 +
4734 +// Hold the last message returned by vchi_msg_iter_next.
4735 +// Can only be called once after each call to vchi_msg_iter_next.
4736 +extern int32_t vchi_msg_iter_hold( VCHI_MSG_ITER_T *iter,
4737 +                                   VCHI_HELD_MSG_T *message );
4738 +
4739 +// Return information for the next message, and hold it, advancing the iterator.
4740 +extern int32_t vchi_msg_iter_hold_next( VCHI_MSG_ITER_T *iter,
4741 +                                        void **data,        // } may be NULL
4742 +                                        uint32_t *msg_size, // }
4743 +                                        VCHI_HELD_MSG_T *message );
4744 +
4745 +
4746 +/******************************************************************************
4747 + Global bulk API
4748 + *****************************************************************************/
4749 +
4750 +// Routine to prepare interface for a transfer from the other side
4751 +extern int32_t vchi_bulk_queue_receive( VCHI_SERVICE_HANDLE_T handle,
4752 +                                        void *data_dst,
4753 +                                        uint32_t data_size,
4754 +                                        VCHI_FLAGS_T flags,
4755 +                                        void *transfer_handle );
4756 +
4757 +
4758 +// Prepare interface for a transfer from the other side into relocatable memory.
4759 +int32_t vchi_bulk_queue_receive_reloc( const VCHI_SERVICE_HANDLE_T handle,
4760 +                                       VCHI_MEM_HANDLE_T h_dst,
4761 +                                       uint32_t offset,
4762 +                                       uint32_t data_size,
4763 +                                       const VCHI_FLAGS_T flags,
4764 +                                       void * const bulk_handle );
4765 +
4766 +// Routine to queue up data ready for transfer to the other (once they have signalled they are ready)
4767 +extern int32_t vchi_bulk_queue_transmit( VCHI_SERVICE_HANDLE_T handle,
4768 +                                         const void *data_src,
4769 +                                         uint32_t data_size,
4770 +                                         VCHI_FLAGS_T flags,
4771 +                                         void *transfer_handle );
4772 +
4773 +
4774 +/******************************************************************************
4775 + Configuration plumbing
4776 + *****************************************************************************/
4777 +
4778 +// function prototypes for the different mid layers (the state info gives the different physical connections)
4779 +extern const VCHI_CONNECTION_API_T *single_get_func_table( void );
4780 +//extern const VCHI_CONNECTION_API_T *local_server_get_func_table( void );
4781 +//extern const VCHI_CONNECTION_API_T *local_client_get_func_table( void );
4782 +
4783 +// declare all message drivers here
4784 +const VCHI_MESSAGE_DRIVER_T *vchi_mphi_message_driver_func_table( void );
4785 +
4786 +#ifdef __cplusplus
4787 +}
4788 +#endif
4789 +
4790 +extern int32_t vchi_bulk_queue_transmit_reloc( VCHI_SERVICE_HANDLE_T handle,
4791 +                                               VCHI_MEM_HANDLE_T h_src,
4792 +                                               uint32_t offset,
4793 +                                               uint32_t data_size,
4794 +                                               VCHI_FLAGS_T flags,
4795 +                                               void *transfer_handle );
4796 +#endif /* VCHI_H_ */
4797 +
4798 +/****************************** End of file **********************************/
4799 --- /dev/null
4800 +++ b/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h
4801 @@ -0,0 +1,214 @@
4802 +/*
4803 + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved.
4804 + *
4805 + * This program is free software; you can redistribute it and/or modify
4806 + * it under the terms of the GNU General Public License as published by
4807 + * the Free Software Foundation; either version 2 of the License, or
4808 + * (at your option) any later version.
4809 + *
4810 + * This program is distributed in the hope that it will be useful,
4811 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4812 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
4813 + * GNU General Public License for more details.
4814 + *
4815 + * You should have received a copy of the GNU General Public License
4816 + * along with this program; if not, write to the Free Software
4817 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
4818 + */
4819 +
4820 +/*=============================================================================
4821 +Contains the #defines for the number of servers / clients etc, these can be
4822 +over-ridden from the platform makefile if needed
4823 +=============================================================================*/
4824 +
4825 +#ifndef VCHI_CFG_H_
4826 +#define VCHI_CFG_H_
4827 +
4828 +/****************************************************************************************
4829 + * Defines in this first section are part of the VCHI API and may be examined by VCHI
4830 + * services.
4831 + ***************************************************************************************/
4832 +
4833 +/* Required alignment of base addresses for bulk transfer, if unaligned transfers are not enabled */
4834 +/* Really determined by the message driver, and should be available from a run-time call. */
4835 +#ifndef VCHI_BULK_ALIGN
4836 +#   if __VCCOREVER__ >= 0x04000000
4837 +#       define VCHI_BULK_ALIGN 32 // Allows for the need to do cache cleans
4838 +#   else
4839 +#       define VCHI_BULK_ALIGN 16
4840 +#   endif
4841 +#endif
4842 +
4843 +/* Required length multiple for bulk transfers, if unaligned transfers are not enabled */
4844 +/* May be less than or greater than VCHI_BULK_ALIGN */
4845 +/* Really determined by the message driver, and should be available from a run-time call. */
4846 +#ifndef VCHI_BULK_GRANULARITY
4847 +#   if __VCCOREVER__ >= 0x04000000
4848 +#       define VCHI_BULK_GRANULARITY 32 // Allows for the need to do cache cleans
4849 +#   else
4850 +#       define VCHI_BULK_GRANULARITY 16
4851 +#   endif
4852 +#endif
4853 +
4854 +/* The largest possible message to be queued with vchi_msg_queue. */
4855 +#ifndef VCHI_MAX_MSG_SIZE
4856 +#   if defined VCHI_LOCAL_HOST_PORT
4857 +#       define VCHI_MAX_MSG_SIZE     16384         // makes file transfers fast, but should they be using bulk?
4858 +#   else
4859 +#       define VCHI_MAX_MSG_SIZE      4096 // NOTE: THIS MUST BE LARGER THAN OR EQUAL TO THE SIZE OF THE KHRONOS MERGE BUFFER!!
4860 +#   endif
4861 +#endif
4862 +
4863 +/******************************************************************************************
4864 + * Defines below are system configuration options, and should not be used by VCHI services.
4865 + *****************************************************************************************/
4866 +
4867 +/* How many connections can we support? A localhost implementation uses 2 connections,
4868 + * 1 for host-app, 1 for VMCS, and these are hooked together by a loopback MPHI VCFW
4869 + * driver. */
4870 +#ifndef VCHI_MAX_NUM_CONNECTIONS
4871 +#   define VCHI_MAX_NUM_CONNECTIONS 3
4872 +#endif
4873 +
4874 +/* How many services can we open per connection? Extending this doesn't cost processing time, just a small
4875 + * amount of static memory. */
4876 +#ifndef VCHI_MAX_SERVICES_PER_CONNECTION
4877 +#  define VCHI_MAX_SERVICES_PER_CONNECTION 36
4878 +#endif
4879 +
4880 +/* Adjust if using a message driver that supports more logical TX channels */
4881 +#ifndef VCHI_MAX_BULK_TX_CHANNELS_PER_CONNECTION
4882 +#   define VCHI_MAX_BULK_TX_CHANNELS_PER_CONNECTION 9 // 1 MPHI + 8 CCP2 logical channels
4883 +#endif
4884 +
4885 +/* Adjust if using a message driver that supports more logical RX channels */
4886 +#ifndef VCHI_MAX_BULK_RX_CHANNELS_PER_CONNECTION
4887 +#   define VCHI_MAX_BULK_RX_CHANNELS_PER_CONNECTION 1 // 1 MPHI
4888 +#endif
4889 +
4890 +/* How many receive slots do we use. This times VCHI_MAX_MSG_SIZE gives the effective
4891 + * receive queue space, less message headers. */
4892 +#ifndef VCHI_NUM_READ_SLOTS
4893 +#  if defined(VCHI_LOCAL_HOST_PORT)
4894 +#     define VCHI_NUM_READ_SLOTS 4
4895 +#  else
4896 +#     define VCHI_NUM_READ_SLOTS 48
4897 +#  endif
4898 +#endif
4899 +
4900 +/* Do we utilise overrun facility for receive message slots? Can aid peer transmit
4901 + * performance. Only define on VideoCore end, talking to host.
4902 + */
4903 +//#define VCHI_MSG_RX_OVERRUN
4904 +
4905 +/* How many transmit slots do we use. Generally don't need many, as the hardware driver
4906 + * underneath VCHI will usually have its own buffering. */
4907 +#ifndef VCHI_NUM_WRITE_SLOTS
4908 +#  define VCHI_NUM_WRITE_SLOTS 4
4909 +#endif
4910 +
4911 +/* If a service has held or queued received messages in VCHI_XOFF_THRESHOLD or more slots,
4912 + * then it's taking up too much buffer space, and the peer service will be told to stop
4913 + * transmitting with an XOFF message. For this to be effective, the VCHI_NUM_READ_SLOTS
4914 + * needs to be considerably bigger than VCHI_NUM_WRITE_SLOTS, or the transmit latency
4915 + * is too high. */
4916 +#ifndef VCHI_XOFF_THRESHOLD
4917 +#  define VCHI_XOFF_THRESHOLD (VCHI_NUM_READ_SLOTS / 2)
4918 +#endif
4919 +
4920 +/* After we've sent an XOFF, the peer will be told to resume transmission once the local
4921 + * service has dequeued/released enough messages that it's now occupying
4922 + * VCHI_XON_THRESHOLD slots or fewer. */
4923 +#ifndef VCHI_XON_THRESHOLD
4924 +#  define VCHI_XON_THRESHOLD (VCHI_NUM_READ_SLOTS / 4)
4925 +#endif
4926 +
4927 +/* A size below which a bulk transfer omits the handshake completely and always goes
4928 + * via the message channel, if bulk auxiliary is being sent on that service. (The user
4929 + * can guarantee this by enabling unaligned transmits).
4930 + * Not API. */
4931 +#ifndef VCHI_MIN_BULK_SIZE
4932 +#  define VCHI_MIN_BULK_SIZE    ( VCHI_MAX_MSG_SIZE / 2 < 4096 ? VCHI_MAX_MSG_SIZE / 2 : 4096 )
4933 +#endif
4934 +
4935 +/* Maximum size of bulk transmission chunks, for each interface type. A trade-off between
4936 + * speed and latency; the smaller the chunk size the better change of messages and other
4937 + * bulk transmissions getting in when big bulk transfers are happening. Set to 0 to not
4938 + * break transmissions into chunks.
4939 + */
4940 +#ifndef VCHI_MAX_BULK_CHUNK_SIZE_MPHI
4941 +#  define VCHI_MAX_BULK_CHUNK_SIZE_MPHI (16 * 1024)
4942 +#endif
4943 +
4944 +/* NB Chunked CCP2 transmissions violate the letter of the CCP2 spec by using "JPEG8" mode
4945 + * with multiple-line frames. Only use if the receiver can cope. */
4946 +#ifndef VCHI_MAX_BULK_CHUNK_SIZE_CCP2
4947 +#  define VCHI_MAX_BULK_CHUNK_SIZE_CCP2 0
4948 +#endif
4949 +
4950 +/* How many TX messages can we have pending in our transmit slots. Once exhausted,
4951 + * vchi_msg_queue will be blocked. */
4952 +#ifndef VCHI_TX_MSG_QUEUE_SIZE
4953 +#  define VCHI_TX_MSG_QUEUE_SIZE           256
4954 +#endif
4955 +
4956 +/* How many RX messages can we have parsed in the receive slots. Once exhausted, parsing
4957 + * will be suspended until older messages are dequeued/released. */
4958 +#ifndef VCHI_RX_MSG_QUEUE_SIZE
4959 +#  define VCHI_RX_MSG_QUEUE_SIZE           256
4960 +#endif
4961 +
4962 +/* Really should be able to cope if we run out of received message descriptors, by
4963 + * suspending parsing as the comment above says, but we don't. This sweeps the issue
4964 + * under the carpet. */
4965 +#if VCHI_RX_MSG_QUEUE_SIZE < (VCHI_MAX_MSG_SIZE/16 + 1) * VCHI_NUM_READ_SLOTS
4966 +#  undef VCHI_RX_MSG_QUEUE_SIZE
4967 +#  define VCHI_RX_MSG_QUEUE_SIZE (VCHI_MAX_MSG_SIZE/16 + 1) * VCHI_NUM_READ_SLOTS
4968 +#endif
4969 +
4970 +/* How many bulk transmits can we have pending. Once exhausted, vchi_bulk_queue_transmit
4971 + * will be blocked. */
4972 +#ifndef VCHI_TX_BULK_QUEUE_SIZE
4973 +#  define VCHI_TX_BULK_QUEUE_SIZE           64
4974 +#endif
4975 +
4976 +/* How many bulk receives can we have pending. Once exhausted, vchi_bulk_queue_receive
4977 + * will be blocked. */
4978 +#ifndef VCHI_RX_BULK_QUEUE_SIZE
4979 +#  define VCHI_RX_BULK_QUEUE_SIZE           64
4980 +#endif
4981 +
4982 +/* A limit on how many outstanding bulk requests we expect the peer to give us. If
4983 + * the peer asks for more than this, VCHI will fail and assert. The number is determined
4984 + * by the peer's hardware - it's the number of outstanding requests that can be queued
4985 + * on all bulk channels. VC3's MPHI peripheral allows 16. */
4986 +#ifndef VCHI_MAX_PEER_BULK_REQUESTS
4987 +#  define VCHI_MAX_PEER_BULK_REQUESTS       32
4988 +#endif
4989 +
4990 +/* Define VCHI_CCP2TX_MANUAL_POWER if the host tells us when to turn the CCP2
4991 + * transmitter on and off.
4992 + */
4993 +/*#define VCHI_CCP2TX_MANUAL_POWER*/
4994 +
4995 +#ifndef VCHI_CCP2TX_MANUAL_POWER
4996 +
4997 +/* Timeout (in milliseconds) for putting the CCP2TX interface into IDLE state. Set
4998 + * negative for no IDLE.
4999 + */
5000 +#  ifndef VCHI_CCP2TX_IDLE_TIMEOUT
5001 +#    define VCHI_CCP2TX_IDLE_TIMEOUT        5
5002 +#  endif
5003 +
5004 +/* Timeout (in milliseconds) for putting the CCP2TX interface into OFF state. Set
5005 + * negative for no OFF.
5006 + */
5007 +#  ifndef VCHI_CCP2TX_OFF_TIMEOUT
5008 +#    define VCHI_CCP2TX_OFF_TIMEOUT         1000
5009 +#  endif
5010 +
5011 +#endif /* VCHI_CCP2TX_MANUAL_POWER */
5012 +
5013 +#endif /* VCHI_CFG_H_ */
5014 +
5015 +/****************************** End of file **********************************/
5016 --- /dev/null
5017 +++ b/drivers/misc/vc04_services/interface/vchi/vchi_cfg_internal.h
5018 @@ -0,0 +1,56 @@
5019 +/*
5020 + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved.
5021 + *
5022 + * This program is free software; you can redistribute it and/or modify
5023 + * it under the terms of the GNU General Public License as published by
5024 + * the Free Software Foundation; either version 2 of the License, or
5025 + * (at your option) any later version.
5026 + *
5027 + * This program is distributed in the hope that it will be useful,
5028 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
5029 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
5030 + * GNU General Public License for more details.
5031 + *
5032 + * You should have received a copy of the GNU General Public License
5033 + * along with this program; if not, write to the Free Software
5034 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
5035 + */
5036 +
5037 +#ifndef VCHI_CFG_INTERNAL_H_
5038 +#define VCHI_CFG_INTERNAL_H_
5039 +
5040 +/****************************************************************************************
5041 + * Control optimisation attempts.
5042 + ***************************************************************************************/
5043 +
5044 +// Don't use lots of short-term locks - use great long ones, reducing the overall locks-per-second
5045 +#define VCHI_COARSE_LOCKING
5046 +
5047 +// Avoid lock then unlock on exit from blocking queue operations (msg tx, bulk rx/tx)
5048 +// (only relevant if VCHI_COARSE_LOCKING)
5049 +#define VCHI_ELIDE_BLOCK_EXIT_LOCK
5050 +
5051 +// Avoid lock on non-blocking peek
5052 +// (only relevant if VCHI_COARSE_LOCKING)
5053 +#define VCHI_AVOID_PEEK_LOCK
5054 +
5055 +// Use one slot-handler thread per connection, rather than 1 thread dealing with all connections in rotation.
5056 +#define VCHI_MULTIPLE_HANDLER_THREADS
5057 +
5058 +// Put free descriptors onto the head of the free queue, rather than the tail, so that we don't thrash
5059 +// our way through the pool of descriptors.
5060 +#define VCHI_PUSH_FREE_DESCRIPTORS_ONTO_HEAD
5061 +
5062 +// Don't issue a MSG_AVAILABLE callback for every single message. Possibly only safe if VCHI_COARSE_LOCKING.
5063 +#define VCHI_FEWER_MSG_AVAILABLE_CALLBACKS
5064 +
5065 +// Don't use message descriptors for TX messages that don't need them
5066 +#define VCHI_MINIMISE_TX_MSG_DESCRIPTORS
5067 +
5068 +// Nano-locks for multiqueue
5069 +//#define VCHI_MQUEUE_NANOLOCKS
5070 +
5071 +// Lock-free(er) dequeuing
5072 +//#define VCHI_RX_NANOLOCKS
5073 +
5074 +#endif /*VCHI_CFG_INTERNAL_H_*/
5075 --- /dev/null
5076 +++ b/drivers/misc/vc04_services/interface/vchi/vchi_common.h
5077 @@ -0,0 +1,152 @@
5078 +/*
5079 + * Copyright (c) 2010-2011 Broadcom Corporation. All rights reserved.
5080 + *
5081 + * This program is free software; you can redistribute it and/or modify
5082 + * it under the terms of the GNU General Public License as published by
5083 + * the Free Software Foundation; either version 2 of the License, or
5084 + * (at your option) any later version.
5085 + *
5086 + * This program is distributed in the hope that it will be useful,
5087 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
5088 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
5089 + * GNU General Public License for more details.
5090 + *
5091 + * You should have received a copy of the GNU General Public License
5092 + * along with this program; if not, write to the Free Software
5093 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
5094 + */
5095 +
5096 +/*=============================================================================
5097 +Contains global defs used by submodules within vchi.
5098 +=============================================================================*/
5099 +
5100 +#ifndef VCHI_COMMON_H_
5101 +#define VCHI_COMMON_H_
5102 +
5103 +
5104 +//flags used when sending messages (must be bitmapped)
5105 +typedef enum
5106 +{
5107 +   VCHI_FLAGS_NONE                      = 0x0,
5108 +   VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE   = 0x1,   // waits for message to be received, or sent (NB. not the same as being seen on other side)
5109 +   VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE = 0x2,   // run a callback when message sent
5110 +   VCHI_FLAGS_BLOCK_UNTIL_QUEUED        = 0x4,   // return once the transfer is in a queue ready to go
5111 +   VCHI_FLAGS_ALLOW_PARTIAL             = 0x8,
5112 +   VCHI_FLAGS_BLOCK_UNTIL_DATA_READ     = 0x10,
5113 +   VCHI_FLAGS_CALLBACK_WHEN_DATA_READ   = 0x20,
5114 +
5115 +   VCHI_FLAGS_ALIGN_SLOT            = 0x000080,  // internal use only
5116 +   VCHI_FLAGS_BULK_AUX_QUEUED       = 0x010000,  // internal use only
5117 +   VCHI_FLAGS_BULK_AUX_COMPLETE     = 0x020000,  // internal use only
5118 +   VCHI_FLAGS_BULK_DATA_QUEUED      = 0x040000,  // internal use only
5119 +   VCHI_FLAGS_BULK_DATA_COMPLETE    = 0x080000,  // internal use only
5120 +   VCHI_FLAGS_INTERNAL              = 0xFF0000
5121 +} VCHI_FLAGS_T;
5122 +
5123 +// constants for vchi_crc_control()
5124 +typedef enum {
5125 +   VCHI_CRC_NOTHING = -1,
5126 +   VCHI_CRC_PER_SERVICE = 0,
5127 +   VCHI_CRC_EVERYTHING = 1,
5128 +} VCHI_CRC_CONTROL_T;
5129 +
5130 +//callback reasons when an event occurs on a service
5131 +typedef enum
5132 +{
5133 +   VCHI_CALLBACK_REASON_MIN,
5134 +
5135 +   //This indicates that there is data available
5136 +   //handle is the msg id that was transmitted with the data
5137 +   //    When a message is received and there was no FULL message available previously, send callback
5138 +   //    Tasks get kicked by the callback, reset their event and try and read from the fifo until it fails
5139 +   VCHI_CALLBACK_MSG_AVAILABLE,
5140 +   VCHI_CALLBACK_MSG_SENT,
5141 +   VCHI_CALLBACK_MSG_SPACE_AVAILABLE, // XXX not yet implemented
5142 +
5143 +   // This indicates that a transfer from the other side has completed
5144 +   VCHI_CALLBACK_BULK_RECEIVED,
5145 +   //This indicates that data queued up to be sent has now gone
5146 +   //handle is the msg id that was used when sending the data
5147 +   VCHI_CALLBACK_BULK_SENT,
5148 +   VCHI_CALLBACK_BULK_RX_SPACE_AVAILABLE, // XXX not yet implemented
5149 +   VCHI_CALLBACK_BULK_TX_SPACE_AVAILABLE, // XXX not yet implemented
5150 +
5151 +   VCHI_CALLBACK_SERVICE_CLOSED,
5152 +
5153 +   // this side has sent XOFF to peer due to lack of data consumption by service
5154 +   // (suggests the service may need to take some recovery action if it has
5155 +   // been deliberately holding off consuming data)
5156 +   VCHI_CALLBACK_SENT_XOFF,
5157 +   VCHI_CALLBACK_SENT_XON,
5158 +
5159 +   // indicates that a bulk transfer has finished reading the source buffer
5160 +   VCHI_CALLBACK_BULK_DATA_READ,
5161 +
5162 +   // power notification events (currently host side only)
5163 +   VCHI_CALLBACK_PEER_OFF,
5164 +   VCHI_CALLBACK_PEER_SUSPENDED,
5165 +   VCHI_CALLBACK_PEER_ON,
5166 +   VCHI_CALLBACK_PEER_RESUMED,
5167 +   VCHI_CALLBACK_FORCED_POWER_OFF,
5168 +
5169 +#ifdef USE_VCHIQ_ARM
5170 +   // some extra notifications provided by vchiq_arm
5171 +   VCHI_CALLBACK_SERVICE_OPENED,
5172 +   VCHI_CALLBACK_BULK_RECEIVE_ABORTED,
5173 +   VCHI_CALLBACK_BULK_TRANSMIT_ABORTED,
5174 +#endif
5175 +
5176 +   VCHI_CALLBACK_REASON_MAX
5177 +} VCHI_CALLBACK_REASON_T;
5178 +
5179 +//Calback used by all services / bulk transfers
5180 +typedef void (*VCHI_CALLBACK_T)( void *callback_param, //my service local param
5181 +                                 VCHI_CALLBACK_REASON_T reason,
5182 +                                 void *handle ); //for transmitting msg's only
5183 +
5184 +
5185 +
5186 +/*
5187 + * Define vector struct for scatter-gather (vector) operations
5188 + * Vectors can be nested - if a vector element has negative length, then
5189 + * the data pointer is treated as pointing to another vector array, with
5190 + * '-vec_len' elements. Thus to append a header onto an existing vector,
5191 + * you can do this:
5192 + *
5193 + * void foo(const VCHI_MSG_VECTOR_T *v, int n)
5194 + * {
5195 + *    VCHI_MSG_VECTOR_T nv[2];
5196 + *    nv[0].vec_base = my_header;
5197 + *    nv[0].vec_len = sizeof my_header;
5198 + *    nv[1].vec_base = v;
5199 + *    nv[1].vec_len = -n;
5200 + *    ...
5201 + *
5202 + */
5203 +typedef struct vchi_msg_vector {
5204 +   const void *vec_base;
5205 +   int32_t vec_len;
5206 +} VCHI_MSG_VECTOR_T;
5207 +
5208 +// Opaque type for a connection API
5209 +typedef struct opaque_vchi_connection_api_t VCHI_CONNECTION_API_T;
5210 +
5211 +// Opaque type for a message driver
5212 +typedef struct opaque_vchi_message_driver_t VCHI_MESSAGE_DRIVER_T;
5213 +
5214 +
5215 +// Iterator structure for reading ahead through received message queue. Allocated by client,
5216 +// initialised by vchi_msg_look_ahead. Fields are for internal VCHI use only.
5217 +// Iterates over messages in queue at the instant of the call to vchi_msg_lookahead -
5218 +// will not proceed to messages received since. Behaviour is undefined if an iterator
5219 +// is used again after messages for that service are removed/dequeued by any
5220 +// means other than vchi_msg_iter_... calls on the iterator itself.
5221 +typedef struct {
5222 +   struct opaque_vchi_service_t *service;
5223 +   void *last;
5224 +   void *next;
5225 +   void *remove;
5226 +} VCHI_MSG_ITER_T;
5227 +
5228 +
5229 +#endif // VCHI_COMMON_H_
5230 --- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
5231 +++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
5232 @@ -36,7 +36,7 @@
5233  #define TOTAL_SLOTS (VCHIQ_SLOT_ZERO_SLOTS + 2 * 32)
5234  
5235  #define VCHIQ_DOORBELL_IRQ IRQ_ARM_DOORBELL_0
5236 -#define VCHIQ_ARM_ADDRESS(x) __virt_to_bus(x)
5237 +#define VCHIQ_ARM_ADDRESS(x) ((void *)__virt_to_bus((unsigned)x))
5238  
5239  #include "vchiq_arm.h"
5240  #include "vchiq_2835.h"
5241 @@ -182,7 +182,15 @@ remote_event_signal(REMOTE_EVENT_T *even
5242  int
5243  vchiq_copy_from_user(void *dst, const void *src, int size)
5244  {
5245 -       return copy_from_user(dst, src, size);
5246 +       if ( (uint32_t)src < TASK_SIZE)
5247 +       {
5248 +               return copy_from_user(dst, src, size);
5249 +       }
5250 +       else
5251 +       {
5252 +               memcpy( dst, src, size );
5253 +               return 0;
5254 +       }
5255  }
5256  
5257  VCHIQ_STATUS_T
5258 @@ -239,6 +247,22 @@ vchiq_dump_platform_state(void *dump_con
5259          vchiq_dump(dump_context, buf, len + 1);
5260  }
5261  
5262 +VCHIQ_STATUS_T
5263 +vchiq_platform_suspend(VCHIQ_STATE_T *state)
5264 +{
5265 +   vcos_unused(state);
5266 +   vcos_assert_msg(0, "Suspend/resume not supported");
5267 +   return VCHIQ_ERROR;
5268 +}
5269 +
5270 +VCHIQ_STATUS_T
5271 +vchiq_platform_resume(VCHIQ_STATE_T *state)
5272 +{
5273 +   vcos_unused(state);
5274 +   vcos_assert_msg(0, "Suspend/resume not supported");
5275 +   return VCHIQ_ERROR;
5276 +}
5277 +
5278  void
5279  vchiq_platform_paused(VCHIQ_STATE_T *state)
5280  {
5281 @@ -253,33 +277,40 @@ vchiq_platform_resumed(VCHIQ_STATE_T *st
5282     vcos_assert_msg(0, "Suspend/resume not supported");
5283  }
5284  
5285 -VCHIQ_STATUS_T
5286 -vchiq_use_service(VCHIQ_SERVICE_HANDLE_T handle)
5287 +int
5288 +vchiq_platform_videocore_wanted(VCHIQ_STATE_T* state)
5289  {
5290 -   VCHIQ_SERVICE_T *service = (VCHIQ_SERVICE_T *)handle;
5291 -   if (!service)
5292 -      return VCHIQ_ERROR;
5293 -   return VCHIQ_SUCCESS;
5294 +   vcos_unused(state);
5295 +   return 1; // autosuspend not supported - videocore always wanted
5296  }
5297  
5298 -VCHIQ_STATUS_T
5299 -vchiq_release_service(VCHIQ_SERVICE_HANDLE_T handle)
5300 +#if VCOS_HAVE_TIMER
5301 +int
5302 +vchiq_platform_use_suspend_timer(void)
5303  {
5304 -   VCHIQ_SERVICE_T *service = (VCHIQ_SERVICE_T *)handle;
5305 -   if (!service)
5306 -      return VCHIQ_ERROR;
5307 -   return VCHIQ_SUCCESS;
5308 +   return 0;
5309 +}
5310 +#endif
5311 +void
5312 +vchiq_dump_platform_use_state(VCHIQ_STATE_T *state)
5313 +{
5314 +   vcos_unused(state);
5315  }
5316  
5317  VCHIQ_STATUS_T
5318 -vchiq_check_service(VCHIQ_SERVICE_HANDLE_T handle)
5319 +vchiq_platform_init_state(VCHIQ_STATE_T *state)
5320  {
5321 -   VCHIQ_SERVICE_T *service = (VCHIQ_SERVICE_T *)handle;
5322 -   if (!service)
5323 -      return VCHIQ_ERROR;
5324 +   vcos_unused(state);
5325     return VCHIQ_SUCCESS;
5326  }
5327  
5328 +VCHIQ_ARM_STATE_T*
5329 +vchiq_platform_get_arm_state(VCHIQ_STATE_T *state)
5330 +{
5331 +   vcos_unused(state);
5332 +   return NULL;
5333 +}
5334 +
5335  /*
5336   * Local functions
5337   */
5338 @@ -479,9 +510,3 @@ free_pagelist(PAGELIST_T *pagelist, int
5339         kfree(pagelist);
5340  }
5341  
5342 -VCHIQ_STATUS_T
5343 -vchiq_platform_suspend(VCHIQ_STATE_T *state)
5344 -{
5345 -   vcos_unused(state);
5346 -   return VCHIQ_ERROR;
5347 -}
5348 --- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c
5349 +++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c
5350 @@ -23,6 +23,9 @@
5351  #include <linux/cdev.h>
5352  #include <linux/fs.h>
5353  #include <linux/device.h>
5354 +#include <linux/mm.h>
5355 +#include <linux/highmem.h>
5356 +#include <linux/pagemap.h>
5357  
5358  #include "vchiq_core.h"
5359  #include "vchiq_ioctl.h"
5360 @@ -44,6 +47,15 @@
5361  
5362  #define VCOS_LOG_CATEGORY (&vchiq_arm_log_category)
5363  
5364 +#define VCHIQ_ARM_VCSUSPEND_TASK_STACK 4096
5365 +
5366 +#if VCOS_HAVE_TIMER
5367 +#define SUSPEND_TIMER_TIMEOUT_MS 100
5368 +static VCOS_TIMER_T      g_suspend_timer;
5369 +static void suspend_timer_callback(void *context);
5370 +#endif
5371 +
5372 +
5373  typedef struct client_service_struct {
5374     VCHIQ_SERVICE_T *service;
5375     void *userdata;
5376 @@ -106,10 +118,17 @@ static const char *ioctl_names[] =
5377     "GET_CONFIG",
5378     "CLOSE_SERVICE",
5379     "USE_SERVICE",
5380 -   "RELEASE_SERIVCE"
5381 +   "RELEASE_SERVICE",
5382 +   "SET_SERVICE_OPTION",
5383 +   "DUMP_PHYS_MEM"
5384  };
5385  
5386 -VCOS_LOG_LEVEL_T vchiq_default_arm_log_level = VCOS_LOG_WARN;
5387 +vcos_static_assert(vcos_countof(ioctl_names) == (VCHIQ_IOC_MAX + 1));
5388 +
5389 +VCOS_LOG_LEVEL_T vchiq_default_arm_log_level = VCOS_LOG_ERROR;
5390 +
5391 +static void
5392 +dump_phys_mem( void *virt_addr, uint32_t num_bytes );
5393  
5394  /****************************************************************************
5395  *
5396 @@ -118,7 +137,7 @@ VCOS_LOG_LEVEL_T vchiq_default_arm_log_l
5397  ***************************************************************************/
5398  
5399  static inline USER_SERVICE_T *find_service_by_handle(
5400 -       VCHIQ_INSTANCE_T instance, int handle )
5401 +   VCHIQ_INSTANCE_T instance, int handle )
5402  {
5403     USER_SERVICE_T *user_service;
5404  
5405 @@ -524,7 +543,7 @@ vchiq_ioctl(struct file *file, unsigned
5406              status = (cmd == VCHIQ_IOC_USE_SERVICE) ? vchiq_use_service(&user_service->service->base) : vchiq_release_service(&user_service->service->base);
5407              if (status != VCHIQ_SUCCESS)
5408              {
5409 -               ret = -EINVAL; // ???
5410 +               ret = -EINVAL; /* ??? */
5411              }
5412           }
5413        }
5414 @@ -872,6 +891,21 @@ vchiq_ioctl(struct file *file, unsigned
5415        }
5416        break;
5417  
5418 +   case VCHIQ_IOC_DUMP_PHYS_MEM:
5419 +      {
5420 +         VCHIQ_DUMP_MEM_T  args;
5421 +
5422 +         if (copy_from_user
5423 +             (&args, (const void __user *)arg,
5424 +              sizeof(args)) != 0) {
5425 +            ret = -EFAULT;
5426 +            break;
5427 +         }
5428 +         dump_phys_mem( args.virt_addr, args.num_bytes );
5429 +      }
5430 +      break;
5431 +
5432 +
5433     default:
5434        ret = -ENOTTY;
5435        break;
5436 @@ -1060,7 +1094,7 @@ vchiq_dump(void *dump_context, const cha
5437           char cr = '\n';
5438           if (copy_to_user(context->buf + context->actual - 1, &cr, 1))
5439           {
5440 -           context->actual = -EFAULT;
5441 +            context->actual = -EFAULT;
5442           }
5443        }
5444     }
5445 @@ -1153,6 +1187,88 @@ vchiq_dump_platform_service_state(void *
5446  
5447  /****************************************************************************
5448  *
5449 +*   dump_user_mem
5450 +*
5451 +***************************************************************************/
5452 +
5453 +static void
5454 +dump_phys_mem( void *virt_addr, uint32_t num_bytes )
5455 +{
5456 +   int            rc;
5457 +   uint8_t       *end_virt_addr = virt_addr + num_bytes;
5458 +   int            num_pages;
5459 +   int            offset;
5460 +   int            end_offset;
5461 +   int            page_idx;
5462 +   int            prev_idx;
5463 +   struct page   *page;
5464 +   struct page  **pages;
5465 +   uint8_t       *kmapped_virt_ptr;
5466 +
5467 +   // Align virtAddr and endVirtAddr to 16 byte boundaries.
5468 +
5469 +   virt_addr = (void *)((unsigned long)virt_addr & ~0x0fuL );
5470 +   end_virt_addr = (void *)(( (unsigned long)end_virt_addr + 15uL ) & ~0x0fuL);
5471 +
5472 +   offset = (int)(long)virt_addr & ( PAGE_SIZE - 1 );
5473 +   end_offset = (int)(long)end_virt_addr & ( PAGE_SIZE - 1 );
5474 +
5475 +   num_pages = (offset + num_bytes + PAGE_SIZE - 1) / PAGE_SIZE;
5476 +
5477 +   if (( pages = kmalloc( sizeof( struct page *) * num_pages, GFP_KERNEL )) == NULL )
5478 +   {
5479 +      printk( KERN_ERR "Unable to allocation memory for %d pages\n", num_pages );
5480 +      return;
5481 +   }
5482 +
5483 +   down_read( &current->mm->mmap_sem );
5484 +   rc = get_user_pages( current,                   /* task */
5485 +                        current->mm,               /* mm */
5486 +                        (unsigned long)virt_addr,  /* start */
5487 +                        num_pages,                 /* len */
5488 +                        0,                         /* write */
5489 +                        0,                         /* force */
5490 +                        pages,                     /* pages (array of pointers to page) */
5491 +                        NULL );                    /* vmas */
5492 +   up_read( &current->mm->mmap_sem );
5493 +
5494 +   prev_idx = -1;
5495 +   page = NULL;
5496 +
5497 +   while ( offset < end_offset ) {
5498 +
5499 +      int page_offset = offset % PAGE_SIZE;
5500 +      page_idx = offset / PAGE_SIZE;
5501 +
5502 +      if ( page_idx != prev_idx ) {
5503 +
5504 +         if (page != NULL) {
5505 +            kunmap( page );
5506 +         }
5507 +         page = pages[page_idx];
5508 +         kmapped_virt_ptr = kmap( page );
5509 +
5510 +         prev_idx = page_idx;
5511 +      }
5512 +
5513 +      vcos_log_dump_mem_impl( &vchiq_arm_log_category, "ph",
5514 +                              (uint32_t)(unsigned long)&kmapped_virt_ptr[page_offset],
5515 +                              &kmapped_virt_ptr[page_offset], 16 );
5516 +
5517 +      offset += 16;
5518 +   }
5519 +   if (page != NULL) {
5520 +      kunmap( page );
5521 +   }
5522 +
5523 +   for ( page_idx = 0; page_idx < num_pages; page_idx++ ) {
5524 +      page_cache_release( pages[page_idx] );
5525 +   }
5526 +   kfree( pages );
5527 +}
5528 +
5529 +/****************************************************************************
5530 +*
5531  *   vchiq_read
5532  *
5533  ***************************************************************************/
5534 @@ -1204,6 +1320,505 @@ vchiq_fops = {
5535     .read = vchiq_read
5536  };
5537  
5538 +/*
5539 + * Autosuspend related functionality
5540 + */
5541 +
5542 +static int vchiq_videocore_wanted(VCHIQ_STATE_T* state)
5543 +{
5544 +   VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state);
5545 +   if(!arm_state)
5546 +   { // autosuspend not supported - always return wanted
5547 +      return 1;
5548 +   }
5549 +   else if(!arm_state->videocore_use_count)
5550 +   { // usage count zero - check for override
5551 +      return vchiq_platform_videocore_wanted(state);
5552 +   }
5553 +   else
5554 +   { // non-zero usage count - videocore still required
5555 +      return 1;
5556 +   }
5557 +}
5558 +
5559 +
5560 +/* Called by the lp thread */
5561 +static void *
5562 +lp_func(void *v)
5563 +{
5564 +   VCHIQ_STATE_T *state = (VCHIQ_STATE_T *) v;
5565 +   VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state);
5566 +
5567 +   while (1) {
5568 +      vcos_event_wait(&arm_state->lp_evt);
5569 +
5570 +      vcos_mutex_lock(&arm_state->use_count_mutex);
5571 +      if (!vchiq_videocore_wanted(state))
5572 +      {
5573 +         arm_state->suspend_pending = 1;
5574 +      }
5575 +      vcos_mutex_unlock(&arm_state->use_count_mutex);
5576 +
5577 +      vchiq_arm_vcsuspend(state);
5578 +   }
5579 +   return NULL;
5580 +}
5581 +/* Called by the hp thread */
5582 +static void *
5583 +hp_func(void *v)
5584 +{
5585 +   VCHIQ_STATE_T *state = (VCHIQ_STATE_T *) v;
5586 +   VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state);
5587 +   int send_pending;
5588 +
5589 +   while (1) {
5590 +      vcos_event_wait(&arm_state->hp_evt);
5591 +
5592 +      send_pending = 0;
5593 +
5594 +      vcos_mutex_lock(&arm_state->use_count_mutex);
5595 +      if (vchiq_videocore_wanted(state))
5596 +      {
5597 +         vchiq_arm_vcresume(state);
5598 +      }
5599 +      if(arm_state->use_notify_pending)
5600 +      {
5601 +         send_pending = arm_state->use_notify_pending;
5602 +         arm_state->use_notify_pending=0;
5603 +      }
5604 +      vcos_mutex_unlock(&arm_state->use_count_mutex);
5605 +      while(send_pending--)
5606 +      {
5607 +         vcos_log_info( "%s sending VCHIQ_MSG_REMOTE_USE_ACTIVE", __func__);
5608 +         if ( vchiq_send_remote_use_active(state) != VCHIQ_SUCCESS)
5609 +         {
5610 +            BUG();  /* vc should be resumed, so shouldn't be a problem sending message */
5611 +         }
5612 +      }
5613 +   }
5614 +   return NULL;
5615 +}
5616 +
5617 +VCHIQ_STATUS_T
5618 +vchiq_arm_init_state(VCHIQ_STATE_T* state, VCHIQ_ARM_STATE_T *arm_state)
5619 +{
5620 +   VCHIQ_STATUS_T status = VCHIQ_SUCCESS;
5621 +   VCOS_THREAD_ATTR_T attrs;
5622 +   char threadname[10];
5623 +
5624 +   if(arm_state)
5625 +   {
5626 +      vcos_mutex_create(&arm_state->use_count_mutex, "v.use_count_mutex");
5627 +      vcos_mutex_create(&arm_state->suspend_resume_mutex, "v.susp_res_mutex");
5628 +
5629 +      vcos_event_create(&arm_state->lp_evt, "LP_EVT");
5630 +      vcos_event_create(&arm_state->hp_evt, "HP_EVT");
5631 +
5632 +      vcos_thread_attr_init(&attrs);
5633 +      vcos_thread_attr_setstacksize(&attrs, VCHIQ_ARM_VCSUSPEND_TASK_STACK);
5634 +      vcos_thread_attr_setpriority(&attrs, VCOS_THREAD_PRI_LOWEST);
5635 +      vcos_snprintf(threadname, sizeof(threadname), "VCHIQl-%d", state->id);
5636 +      if(vcos_thread_create(&arm_state->lp_thread, threadname, &attrs, lp_func, state) != VCOS_SUCCESS)
5637 +      {
5638 +         vcos_log_error("vchiq: FATAL: couldn't create thread %s", threadname);
5639 +         status = VCHIQ_ERROR;
5640 +      }
5641 +      else
5642 +      {
5643 +         vcos_thread_attr_init(&attrs);
5644 +         vcos_thread_attr_setstacksize(&attrs, VCHIQ_ARM_VCSUSPEND_TASK_STACK);
5645 +         vcos_thread_attr_setpriority(&attrs, VCOS_THREAD_PRI_HIGHEST);
5646 +         vcos_snprintf(threadname, sizeof(threadname), "VCHIQh-%d", state->id);
5647 +
5648 +         if(vcos_thread_create(&arm_state->hp_thread, threadname, &attrs, hp_func, state) != VCOS_SUCCESS)
5649 +         {
5650 +            vcos_log_error("vchiq: FATAL: couldn't create thread %s", threadname);
5651 +            status = VCHIQ_ERROR;
5652 +         }
5653 +      }
5654 +   }
5655 +   return status;
5656 +}
5657 +
5658 +
5659 +VCHIQ_STATUS_T
5660 +vchiq_arm_vcsuspend(VCHIQ_STATE_T *state)
5661 +{
5662 +   VCHIQ_STATUS_T status = VCHIQ_SUCCESS;
5663 +   VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state);
5664 +
5665 +   if (state->conn_state != VCHIQ_CONNSTATE_CONNECTED)
5666 +      return VCHIQ_ERROR;
5667 +
5668 +   if(arm_state->suspend_pending)
5669 +   {
5670 +      vcos_mutex_lock(&arm_state->suspend_resume_mutex);
5671 +      if(arm_state->videocore_suspended)
5672 +      {
5673 +         vcos_log_info("%s - already suspended", __func__);
5674 +      }
5675 +      else
5676 +      {
5677 +         vcos_log_info("%s - suspending", __func__);
5678 +
5679 +         status = vchiq_platform_suspend(state);
5680 +         arm_state->videocore_suspended = (status == VCHIQ_SUCCESS) ? 1 : 0;
5681 +
5682 +         vcos_mutex_unlock(&arm_state->suspend_resume_mutex);
5683 +
5684 +         vcos_mutex_lock(&arm_state->use_count_mutex);
5685 +         if(!arm_state->suspend_pending)
5686 +         { /* Something has changed the suspend_pending state while we were suspending.
5687 +            Run the HP task to check if we need to resume */
5688 +            vcos_log_info( "%s trigger HP task to check resume", __func__);
5689 +            vcos_event_signal(&arm_state->hp_evt);
5690 +         }
5691 +         arm_state->suspend_pending = 0;
5692 +         vcos_mutex_unlock(&arm_state->use_count_mutex);
5693 +      }
5694 +   }
5695 +   else
5696 +   {
5697 +      vchiq_check_resume(state);
5698 +   }
5699 +   return status;
5700 +}
5701 +
5702 +
5703 +VCHIQ_STATUS_T
5704 +vchiq_arm_vcresume(VCHIQ_STATE_T *state)
5705 +{
5706 +   VCHIQ_STATUS_T status = VCHIQ_SUCCESS;
5707 +   VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state);
5708 +   vcos_mutex_lock(&arm_state->suspend_resume_mutex);
5709 +
5710 +   status = vchiq_platform_resume(state);
5711 +   arm_state->videocore_suspended = (status == VCHIQ_RETRY) ? 1 : 0;
5712 +
5713 +   vcos_mutex_unlock(&arm_state->suspend_resume_mutex);
5714 +
5715 +   return status;
5716 +}
5717 +
5718 +void
5719 +vchiq_check_resume(VCHIQ_STATE_T* state)
5720 +{
5721 +   VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state);
5722 +   vcos_mutex_lock(&arm_state->use_count_mutex);
5723 +
5724 +   if (arm_state->videocore_suspended && vchiq_videocore_wanted(state))
5725 +   { /* signal high priority task to resume vc */
5726 +      vcos_event_signal(&arm_state->hp_evt);
5727 +   }
5728 +
5729 +   vcos_mutex_unlock(&arm_state->use_count_mutex);
5730 +}
5731 +
5732 +void
5733 +vchiq_check_suspend(VCHIQ_STATE_T* state)
5734 +{
5735 +   VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state);
5736 +
5737 +   vcos_mutex_lock(&arm_state->use_count_mutex);
5738 +
5739 +   if (!arm_state->videocore_suspended && !vchiq_videocore_wanted(state))
5740 +   { /* signal low priority task to suspend vc */
5741 +      vcos_event_signal(&arm_state->lp_evt);
5742 +   }
5743 +
5744 +   vcos_mutex_unlock(&arm_state->use_count_mutex);
5745 +}
5746 +
5747 +
5748 +
5749 +static VCHIQ_STATUS_T
5750 +vchiq_use_internal(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service, int block_while_resume)
5751 +{
5752 +   VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state);
5753 +   VCHIQ_STATUS_T ret = VCHIQ_SUCCESS;
5754 +   char entity[10];
5755 +   int* entity_uc;
5756 +
5757 +   if(arm_state)
5758 +   {
5759 +      vcos_mutex_lock(&arm_state->use_count_mutex);
5760 +
5761 +      if (service)
5762 +      {
5763 +         sprintf(entity, "%c%c%c%c:%03d",VCHIQ_FOURCC_AS_4CHARS(service->base.fourcc), service->client_id);
5764 +         entity_uc = &service->service_use_count;
5765 +      }
5766 +      else
5767 +      {
5768 +         sprintf(entity, "PEER:   ");
5769 +         entity_uc = &arm_state->peer_use_count;
5770 +      }
5771 +
5772 +      if (!arm_state->videocore_suspended && !vchiq_videocore_wanted(state))
5773 +      {
5774 +#if VCOS_HAVE_TIMER
5775 +         if (vchiq_platform_use_suspend_timer())
5776 +         {
5777 +            vcos_log_trace( "%s %s - cancel suspend timer", __func__, entity);
5778 +         }
5779 +         vcos_timer_cancel(&g_suspend_timer);
5780 +#endif
5781 +      }
5782 +
5783 +      arm_state->videocore_use_count++;
5784 +      (*entity_uc)++;
5785 +      arm_state->suspend_pending = 0;
5786 +
5787 +      if (arm_state->videocore_suspended && vchiq_videocore_wanted(state))
5788 +      {
5789 +         vcos_log_info( "%s %s count %d, state count %d", __func__, entity, *entity_uc, arm_state->videocore_use_count);
5790 +         if(block_while_resume)
5791 +         {
5792 +            ret = vchiq_arm_vcresume(state);
5793 +         }
5794 +         else
5795 +         {
5796 +            vcos_log_info( "%s trigger HP task to do resume", __func__); /* triggering is done below */
5797 +         }
5798 +      }
5799 +      else
5800 +      {
5801 +         vcos_log_trace( "%s %s count %d, state count %d", __func__, entity, *entity_uc, arm_state->videocore_use_count);
5802 +      }
5803 +      if(!block_while_resume)
5804 +      {
5805 +         arm_state->use_notify_pending++;
5806 +         vcos_event_signal(&arm_state->hp_evt); /* hp task will check if we need to resume and also send use notify */
5807 +      }
5808 +
5809 +      if (ret == VCHIQ_RETRY)
5810 +      { /* if we're told to retry, decrement the counters.  VCHIQ_ERROR probably means we're already resumed. */
5811 +         (*entity_uc)--;
5812 +         arm_state->videocore_use_count--;
5813 +      }
5814 +
5815 +      vcos_mutex_unlock(&arm_state->use_count_mutex);
5816 +   }
5817 +   return ret;
5818 +}
5819 +
5820 +static VCHIQ_STATUS_T
5821 +vchiq_release_internal(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service)
5822 +{
5823 +   VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state);
5824 +   VCHIQ_STATUS_T ret = VCHIQ_SUCCESS;
5825 +   char entity[10];
5826 +   int* entity_uc;
5827 +
5828 +   if(arm_state)
5829 +   {
5830 +      vcos_mutex_lock(&arm_state->use_count_mutex);
5831 +
5832 +      if (service)
5833 +      {
5834 +         sprintf(entity, "%c%c%c%c:%03d",VCHIQ_FOURCC_AS_4CHARS(service->base.fourcc), service->client_id);
5835 +         entity_uc = &service->service_use_count;
5836 +      }
5837 +      else
5838 +      {
5839 +         sprintf(entity, "PEER:   ");
5840 +         entity_uc = &arm_state->peer_use_count;
5841 +      }
5842 +
5843 +      if (*entity_uc && arm_state->videocore_use_count)
5844 +      {
5845 +         arm_state->videocore_use_count--;
5846 +         (*entity_uc)--;
5847 +
5848 +         if (!vchiq_videocore_wanted(state))
5849 +         {
5850 +#if VCOS_HAVE_TIMER
5851 +            if (vchiq_platform_use_suspend_timer())
5852 +            {
5853 +               vcos_log_trace( "%s %s count %d, state count %d - starting suspend timer", __func__, entity, *entity_uc, arm_state->videocore_use_count);
5854 +               vcos_timer_cancel(&g_suspend_timer);
5855 +               vcos_timer_set(&g_suspend_timer, SUSPEND_TIMER_TIMEOUT_MS);
5856 +            }
5857 +            else
5858 +#endif
5859 +            {
5860 +               vcos_log_info( "%s %s count %d, state count %d - suspend pending", __func__, entity, *entity_uc, arm_state->videocore_use_count);
5861 +               vcos_event_signal(&arm_state->lp_evt); /* kick the lp thread to do the suspend */
5862 +            }
5863 +         }
5864 +         else
5865 +         {
5866 +            vcos_log_trace( "%s %s count %d, state count %d", __func__, entity, *entity_uc, arm_state->videocore_use_count);
5867 +         }
5868 +      }
5869 +      else
5870 +      {
5871 +         vcos_log_error( "%s %s ERROR releasing service; count %d, state count %d", __func__, entity, *entity_uc, arm_state->videocore_use_count);
5872 +         ret = VCHIQ_ERROR;
5873 +      }
5874 +
5875 +      vcos_mutex_unlock(&arm_state->use_count_mutex);
5876 +   }
5877 +   return ret;
5878 +}
5879 +
5880 +VCHIQ_STATUS_T
5881 +vchiq_on_remote_use(VCHIQ_STATE_T *state)
5882 +{
5883 +   vcos_log_info("%s state %p", __func__, state);
5884 +   return state ? vchiq_use_internal(state, NULL, 0) : VCHIQ_ERROR;
5885 +}
5886 +
5887 +VCHIQ_STATUS_T
5888 +vchiq_on_remote_release(VCHIQ_STATE_T *state)
5889 +{
5890 +   vcos_log_info("%s state %p", __func__, state);
5891 +   return state ? vchiq_release_internal(state, NULL) : VCHIQ_ERROR;
5892 +}
5893 +
5894 +VCHIQ_STATUS_T
5895 +vchiq_use_service_internal(VCHIQ_SERVICE_T *service)
5896 +{
5897 +   VCHIQ_STATE_T* state = NULL;
5898 +
5899 +   if (service)
5900 +   {
5901 +      state = service->state;
5902 +   }
5903 +
5904 +   if (!service || !state)
5905 +   {
5906 +      return VCHIQ_ERROR;
5907 +   }
5908 +   return vchiq_use_internal(state, service, 1);
5909 +}
5910 +
5911 +VCHIQ_STATUS_T
5912 +vchiq_release_service_internal(VCHIQ_SERVICE_T *service)
5913 +{
5914 +   VCHIQ_STATE_T* state = NULL;
5915 +
5916 +   if (service)
5917 +   {
5918 +      state = service->state;
5919 +   }
5920 +
5921 +   if (!service || !state)
5922 +   {
5923 +      return VCHIQ_ERROR;
5924 +   }
5925 +   return vchiq_release_internal(state, service);
5926 +}
5927 +
5928 +
5929 +#if VCOS_HAVE_TIMER
5930 +static void suspend_timer_callback(void* context)
5931 +{
5932 +   VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state((VCHIQ_STATE_T*)context);
5933 +   vcos_log_info( "%s - suspend pending", __func__);
5934 +   vcos_event_signal(&arm_state->lp_evt);
5935 +}
5936 +#endif
5937 +
5938 +VCHIQ_STATUS_T
5939 +vchiq_use_service(VCHIQ_SERVICE_HANDLE_T handle)
5940 +{
5941 +   VCHIQ_STATUS_T ret = VCHIQ_ERROR;
5942 +   VCHIQ_SERVICE_T *service = (VCHIQ_SERVICE_T *) handle;
5943 +   if (service)
5944 +   {
5945 +      ret = vchiq_use_service_internal(service);
5946 +   }
5947 +   return ret;
5948 +}
5949 +
5950 +VCHIQ_STATUS_T
5951 +vchiq_release_service(VCHIQ_SERVICE_HANDLE_T handle)
5952 +{
5953 +   VCHIQ_STATUS_T ret = VCHIQ_ERROR;
5954 +   VCHIQ_SERVICE_T *service = (VCHIQ_SERVICE_T *) handle;
5955 +   if (service)
5956 +   {
5957 +      ret = vchiq_release_service_internal(service);
5958 +   }
5959 +   return ret;
5960 +}
5961 +
5962 +void
5963 +vchiq_dump_service_use_state(VCHIQ_STATE_T *state)
5964 +{
5965 +   VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state);
5966 +   int i;
5967 +   if(arm_state)
5968 +   {
5969 +      vcos_mutex_lock(&arm_state->suspend_resume_mutex);
5970 +      if (arm_state->videocore_suspended)
5971 +      {
5972 +         vcos_log_warn("--VIDEOCORE SUSPENDED--");
5973 +      }
5974 +      else
5975 +      {
5976 +         vcos_log_warn("--VIDEOCORE AWAKE--");
5977 +      }
5978 +      for (i = 0; i < state->unused_service; i++) {
5979 +         VCHIQ_SERVICE_T *service_ptr = state->services[i];
5980 +         if (service_ptr && (service_ptr->srvstate != VCHIQ_SRVSTATE_FREE))
5981 +         {
5982 +            if (service_ptr->service_use_count)
5983 +               vcos_log_error("----- %c%c%c%c:%d service count %d <-- preventing suspend", VCHIQ_FOURCC_AS_4CHARS(service_ptr->base.fourcc), service_ptr->client_id, service_ptr->service_use_count);
5984 +            else
5985 +               vcos_log_warn("----- %c%c%c%c:%d service count 0", VCHIQ_FOURCC_AS_4CHARS(service_ptr->base.fourcc), service_ptr->client_id);
5986 +         }
5987 +      }
5988 +      vcos_log_warn("----- PEER use count count %d", arm_state->peer_use_count);
5989 +      vcos_log_warn("--- Overall vchiq instance use count %d", arm_state->videocore_use_count);
5990 +
5991 +      vchiq_dump_platform_use_state(state);
5992 +
5993 +      vcos_mutex_unlock(&arm_state->suspend_resume_mutex);
5994 +   }
5995 +}
5996 +
5997 +VCHIQ_STATUS_T
5998 +vchiq_check_service(VCHIQ_SERVICE_T * service)
5999 +{
6000 +   VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(service->state);
6001 +   VCHIQ_STATUS_T ret = VCHIQ_ERROR;
6002 +   /* on 2835 vchiq does not have an arm_state */
6003 +   if (!arm_state)
6004 +      return VCHIQ_SUCCESS;
6005 +   if (service && arm_state)
6006 +   {
6007 +      vcos_mutex_lock(&arm_state->use_count_mutex);
6008 +      if (!service->service_use_count)
6009 +      {
6010 +         vcos_log_error( "%s ERROR - %c%c%c%c:%d service count %d, state count %d, videocore_suspended %d", __func__,VCHIQ_FOURCC_AS_4CHARS(service->base.fourcc), service->client_id, service->service_use_count, arm_state->videocore_use_count, arm_state->videocore_suspended);
6011 +         vchiq_dump_service_use_state(service->state);
6012 +         vcos_assert(0); // vcos_assert should kill the calling thread, so a user thread shouldn't be able to kill the kernel.
6013 +      }
6014 +      else
6015 +      {
6016 +         ret = VCHIQ_SUCCESS;
6017 +      }
6018 +      vcos_mutex_unlock(&arm_state->use_count_mutex);
6019 +   }
6020 +   return ret;
6021 +}
6022 +
6023 +/* stub functions */
6024 +void vchiq_on_remote_use_active(VCHIQ_STATE_T *state)
6025 +{
6026 +   vcos_unused(state);
6027 +}
6028 +
6029 +void vchiq_platform_conn_state_changed(VCHIQ_STATE_T *state, VCHIQ_CONNSTATE_T oldstate, VCHIQ_CONNSTATE_T newstate)
6030 +{
6031 +   vcos_unused(state);
6032 +   vcos_unused(oldstate);
6033 +   vcos_unused(oldstate);
6034 +}
6035 +
6036 +
6037  /****************************************************************************
6038  *
6039  *   vchiq_init - called when the module is loaded.
6040 @@ -1250,6 +1865,10 @@ vchiq_init(void)
6041     if (err != 0)
6042        goto failed_platform_init;
6043  
6044 +#if VCOS_HAVE_TIMER
6045 +   vcos_timer_create( &g_suspend_timer, "suspend_timer", suspend_timer_callback, (void*)(&g_state));
6046 +#endif
6047 +
6048     vcos_log_error("vchiq: initialised - version %d (min %d), device %d.%d",
6049        VCHIQ_VERSION, VCHIQ_VERSION_MIN,
6050        MAJOR(vchiq_devid), MINOR(vchiq_devid));
6051 --- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h
6052 +++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h
6053 @@ -21,6 +21,40 @@
6054  
6055  #include "vchiq_core.h"
6056  
6057 +
6058 +typedef struct vchiq_arm_state_struct {
6059 +
6060 +   VCOS_THREAD_T lp_thread;            /* processes low priority messages (eg suspend) */
6061 +   VCOS_THREAD_T hp_thread;            /* processes high priority messages (eg resume) */
6062 +
6063 +   VCOS_EVENT_T lp_evt;
6064 +   VCOS_EVENT_T hp_evt;
6065 +
6066 +   VCOS_MUTEX_T use_count_mutex;
6067 +   VCOS_MUTEX_T suspend_resume_mutex;
6068 +
6069 +   int suspend_pending;
6070 +
6071 +   /* Global use count for videocore.
6072 +    * This is equal to the sum of the use counts for all services.  When this hits
6073 +    * zero the videocore suspend procedure will be initiated. */
6074 +   int videocore_use_count;
6075 +
6076 +   /* Use count to track requests from videocore peer.
6077 +    * This use count is not associated with a service, so needs to be tracked separately
6078 +    * with the state.
6079 +    */
6080 +   int peer_use_count;
6081 +
6082 +   /* Flag to indicate whether videocore is currently suspended */
6083 +   int videocore_suspended;
6084 +
6085 +   /* Flag to indicate whether a notification is pending back to videocore that it's
6086 +    * "remote use request" has been actioned */
6087 +   int use_notify_pending;
6088 +} VCHIQ_ARM_STATE_T;
6089 +
6090 +
6091  extern VCOS_LOG_CAT_T vchiq_arm_log_category;
6092  
6093  extern int __init
6094 @@ -35,4 +69,50 @@ vchiq_platform_exit(VCHIQ_STATE_T *state
6095  extern VCHIQ_STATE_T *
6096  vchiq_get_state(void);
6097  
6098 +extern VCHIQ_STATUS_T
6099 +vchiq_arm_vcsuspend(VCHIQ_STATE_T *state);
6100 +
6101 +extern VCHIQ_STATUS_T
6102 +vchiq_arm_vcresume(VCHIQ_STATE_T *state);
6103 +
6104 +extern VCHIQ_STATUS_T
6105 +vchiq_arm_init_state(VCHIQ_STATE_T *state, VCHIQ_ARM_STATE_T *arm_state);
6106 +
6107 +extern void
6108 +vchiq_check_resume(VCHIQ_STATE_T* state);
6109 +
6110 +extern void
6111 +vchiq_check_suspend(VCHIQ_STATE_T* state);
6112 +
6113 +extern VCHIQ_STATUS_T
6114 +vchiq_use_service(VCHIQ_SERVICE_HANDLE_T handle);
6115 +
6116 +extern VCHIQ_STATUS_T
6117 +vchiq_release_service(VCHIQ_SERVICE_HANDLE_T handle);
6118 +
6119 +extern VCHIQ_STATUS_T
6120 +vchiq_check_service(VCHIQ_SERVICE_T * service);
6121 +
6122 +extern VCHIQ_STATUS_T
6123 +vchiq_platform_suspend(VCHIQ_STATE_T *state);
6124 +
6125 +extern VCHIQ_STATUS_T
6126 +vchiq_platform_resume(VCHIQ_STATE_T *state);
6127 +
6128 +extern int
6129 +vchiq_platform_videocore_wanted(VCHIQ_STATE_T* state);
6130 +
6131 +extern int
6132 +vchiq_platform_use_suspend_timer(void);
6133 +
6134 +extern void
6135 +vchiq_dump_platform_use_state(VCHIQ_STATE_T *state);
6136 +
6137 +extern void
6138 +vchiq_dump_service_use_state(VCHIQ_STATE_T *state);
6139 +
6140 +extern VCHIQ_ARM_STATE_T*
6141 +vchiq_platform_get_arm_state(VCHIQ_STATE_T *state);
6142 +
6143 +
6144  #endif /* VCHIQ_ARM_H */
6145 --- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c
6146 +++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c
6147 @@ -30,6 +30,11 @@
6148  
6149  #define BULK_INDEX(x) (x & (VCHIQ_NUM_SERVICE_BULKS - 1))
6150  
6151 +
6152 +/* Used to check use counts allow vchiq use. */
6153 +extern VCHIQ_STATUS_T vchiq_check_service(VCHIQ_SERVICE_T * service);
6154 +
6155 +
6156  typedef struct bulk_waiter_struct
6157  {
6158     VCOS_EVENT_T event;
6159 @@ -114,6 +119,13 @@ vchiq_set_service_state(VCHIQ_SERVICE_T
6160     service->srvstate = newstate;
6161  }
6162  
6163 +static inline int
6164 +is_valid_service(VCHIQ_SERVICE_T *service)
6165 +{
6166 +   return ((service != NULL) &&
6167 +      (service->srvstate != VCHIQ_SRVSTATE_FREE));
6168 +}
6169 +
6170  static inline VCHIQ_STATUS_T
6171  make_service_callback(VCHIQ_SERVICE_T *service, VCHIQ_REASON_T reason,
6172     VCHIQ_HEADER_T *header, void *bulk_userdata)
6173 @@ -127,10 +139,12 @@ make_service_callback(VCHIQ_SERVICE_T *s
6174  static inline void
6175  vchiq_set_conn_state(VCHIQ_STATE_T *state, VCHIQ_CONNSTATE_T newstate)
6176  {
6177 +   VCHIQ_CONNSTATE_T oldstate = state->conn_state;
6178     vcos_log_info("%d: %s->%s", state->id,
6179 -      conn_state_names[state->conn_state],
6180 +      conn_state_names[oldstate],
6181        conn_state_names[newstate]);
6182     state->conn_state = newstate;
6183 +   vchiq_platform_conn_state_changed(state, oldstate, newstate);
6184  }
6185  
6186  static inline void
6187 @@ -323,7 +337,7 @@ process_free_queue(VCHIQ_STATE_T *state)
6188  
6189     while (slot_queue_available != local->slot_queue_recycle)
6190     {
6191 -      int pos;
6192 +      unsigned int pos;
6193        int slot_index = local->slot_queue[slot_queue_available++ & VCHIQ_SLOT_QUEUE_MASK];
6194        char *data = (char *)SLOT_DATA_FROM_INDEX(state, slot_index);
6195  
6196 @@ -343,17 +357,37 @@ process_free_queue(VCHIQ_STATE_T *state)
6197           if (VCHIQ_MSG_TYPE(msgid) == VCHIQ_MSG_DATA)
6198           {
6199              int port = VCHIQ_MSG_SRCPORT(msgid);
6200 +            VCHIQ_SERVICE_QUOTA_T *service_quota =
6201 +               &state->service_quotas[port];
6202 +            int count;
6203 +            count = service_quota->message_use_count;
6204 +            if (count > 0)
6205 +            {
6206 +               service_quota->message_use_count = count - 1;
6207 +               if (count == service_quota->message_quota)
6208 +               {
6209 +                  /* Signal the service that it has dropped below its quota */
6210 +                  vcos_event_signal(&service_quota->quota_event);
6211 +               }
6212 +            }
6213 +            else
6214 +            {
6215 +               vcos_log_error("service %d message_use_count=%d (header %x,"
6216 +                              " msgid %x, header->msgid %x, header->size %x)",
6217 +                  port, service_quota->message_use_count,
6218 +                  (unsigned int)header, msgid, header->msgid,
6219 +                  header->size);
6220 +               vcos_assert(0);
6221 +            }
6222              if (!BITSET_IS_SET(service_found, port))
6223              {
6224 -               VCHIQ_SERVICE_QUOTA_T *service_quota =
6225 -                  &state->service_quotas[port];
6226 -
6227                 /* Set the found bit for this service */
6228                 BITSET_SET(service_found, port);
6229  
6230 -               if (service_quota->slot_use_count > 0)
6231 +               count = service_quota->slot_use_count;
6232 +               if (count > 0)
6233                 {
6234 -                  service_quota->slot_use_count--;
6235 +                  service_quota->slot_use_count = count - 1;
6236                    /* Signal the service in case it has dropped below its quota */
6237                    vcos_event_signal(&service_quota->quota_event);
6238                    vcos_log_trace("%d: pfq:%d %x@%x - slot_use->%d",
6239 @@ -376,7 +410,7 @@ process_free_queue(VCHIQ_STATE_T *state)
6240           pos += calc_stride(header->size);
6241           if (pos > VCHIQ_SLOT_SIZE)
6242           {
6243 -            vcos_log_error("pos %x: header %x, msgid %x, header->msgid %x, header->size %x",
6244 +            vcos_log_error("pfq - pos %x: header %x, msgid %x, header->msgid %x, header->size %x",
6245                 pos, (unsigned int)header, msgid, header->msgid, header->size);
6246              vcos_assert(0);
6247           }
6248 @@ -431,20 +465,21 @@ queue_message(VCHIQ_STATE_T *state, VCHI
6249  
6250        service_quota = &state->service_quotas[service->localport];
6251  
6252 -      /* ...ensure it doesn't use more than its quota of slots */
6253 -      while ((tx_end_index != service_quota->previous_tx_index) &&
6254 -         (service_quota->slot_use_count == service_quota->slot_quota))
6255 +      /* ...ensure it doesn't use more than its quota of messages or slots */
6256 +      while ((service_quota->message_use_count == service_quota->message_quota) ||
6257 +         ((tx_end_index != service_quota->previous_tx_index) &&
6258 +         (service_quota->slot_use_count == service_quota->slot_quota)))
6259        {
6260 -         vcos_log_trace("%d: qm:%d %s,%x - quota stall",
6261 +         vcos_log_trace("%d: qm:%d %s,%x - quota stall (msg %d, slot %d)",
6262              state->id, service->localport,
6263 -            msg_type_str(VCHIQ_MSG_TYPE(msgid)), size);
6264 +            msg_type_str(VCHIQ_MSG_TYPE(msgid)), size,
6265 +            service_quota->message_use_count, service_quota->slot_use_count);
6266           VCHIQ_SERVICE_STATS_INC(service, quota_stalls);
6267           vcos_mutex_unlock(&state->slot_mutex);
6268           if (vcos_event_wait(&service_quota->quota_event) != VCOS_SUCCESS)
6269              return VCHIQ_RETRY;
6270           if (vcos_mutex_lock(&state->slot_mutex) != VCOS_SUCCESS)
6271              return VCHIQ_RETRY;
6272 -         vcos_assert(service_quota->slot_use_count <= service_quota->slot_quota);
6273           tx_end_index = SLOT_QUEUE_INDEX_FROM_POS(state->local_tx_pos + stride - 1);
6274        }
6275     }
6276 @@ -498,6 +533,7 @@ queue_message(VCHIQ_STATE_T *state, VCHI
6277        }
6278  
6279        service_quota->previous_tx_index = tx_end_index;
6280 +      service_quota->message_use_count++;
6281        VCHIQ_SERVICE_STATS_INC(service, ctrl_tx_count);
6282        VCHIQ_SERVICE_STATS_ADD(service, ctrl_tx_bytes, size);
6283     } else {
6284 @@ -1232,6 +1268,17 @@ parse_rx_slots(VCHIQ_STATE_T *state)
6285           vchiq_set_conn_state(state, VCHIQ_CONNSTATE_CONNECTED);
6286           vchiq_platform_resumed(state);
6287           break;
6288 +
6289 +      case VCHIQ_MSG_REMOTE_USE:
6290 +         vchiq_on_remote_use(state);
6291 +         break;
6292 +      case VCHIQ_MSG_REMOTE_RELEASE:
6293 +         vchiq_on_remote_release(state);
6294 +         break;
6295 +      case VCHIQ_MSG_REMOTE_USE_ACTIVE:
6296 +         vchiq_on_remote_use_active(state);
6297 +         break;
6298 +
6299        default:
6300           vcos_log_error("%d: prs invalid msgid %x@%x,%x",
6301              state->id, msgid, (unsigned int)header, size);
6302 @@ -1326,8 +1373,6 @@ slot_handler_func(void *v)
6303     return NULL;
6304  }
6305  
6306 -extern VCHIQ_STATUS_T
6307 -vchiq_platform_suspend(VCHIQ_STATE_T *state);
6308  
6309  /* Called by the recycle thread */
6310  static void *
6311 @@ -1348,23 +1393,6 @@ recycle_func(void *v)
6312     return NULL;
6313  }
6314  
6315 -/* Called by the lp thread */
6316 -static void *
6317 -lp_func(void *v)
6318 -{
6319 -   VCHIQ_STATE_T *state = (VCHIQ_STATE_T *) v;
6320 -
6321 -   while (1) {
6322 -      vcos_event_wait(&state->lp_evt);
6323 -      vcos_mutex_lock(&state->use_count_mutex);
6324 -      if (state->videocore_use_count == 0)
6325 -      {
6326 -         vchiq_platform_suspend(state);
6327 -      }
6328 -      vcos_mutex_unlock(&state->use_count_mutex);
6329 -   }
6330 -   return NULL;
6331 -}
6332  
6333  static void
6334  init_bulk_queue(VCHIQ_BULK_QUEUE_T *queue)
6335 @@ -1417,6 +1445,7 @@ vchiq_init_state(VCHIQ_STATE_T *state, V
6336     VCHIQ_SHARED_STATE_T *local;
6337     VCHIQ_SHARED_STATE_T *remote;
6338     VCOS_THREAD_ATTR_T attrs;
6339 +   VCHIQ_STATUS_T status;
6340     char threadname[10];
6341     static int id = 0;
6342     int i;
6343 @@ -1426,7 +1455,7 @@ vchiq_init_state(VCHIQ_STATE_T *state, V
6344     vcos_log_register("vchiq_core", &vchiq_core_log_category);
6345     vcos_log_register("vchiq_core_msg", &vchiq_core_msg_log_category);
6346  
6347 -   vcos_log_warn( "%s: slot_zero = 0x%08lx, is_master = %d\n", __func__, (unsigned long)slot_zero, is_master );
6348 +   vcos_log_warn( "%s: slot_zero = 0x%08lx, is_master = %d", __func__, (unsigned long)slot_zero, is_master );
6349  
6350     /* Check the input configuration */
6351  
6352 @@ -1501,6 +1530,7 @@ vchiq_init_state(VCHIQ_STATE_T *state, V
6353     }
6354  
6355     memset(state, 0, sizeof(VCHIQ_STATE_T));
6356 +   vcos_log_warn( "%s: called", __func__);
6357     state->id = id++;
6358     state->is_master = is_master;
6359  
6360 @@ -1523,8 +1553,6 @@ vchiq_init_state(VCHIQ_STATE_T *state, V
6361  
6362     vcos_mutex_create(&state->slot_mutex, "v.slot_mutex");
6363     vcos_mutex_create(&state->recycle_mutex, "v.recycle_mutex");
6364 -   vcos_mutex_create(&state->use_count_mutex, "v.use_count_mutex");
6365 -   vcos_mutex_create(&state->suspend_resume_mutex, "v.susp_res_mutex");
6366  
6367     vcos_event_create(&state->slot_available_event, "v.slot_available_event");
6368     vcos_event_create(&state->slot_remove_event, "v.slot_remove_event");
6369 @@ -1543,6 +1571,7 @@ vchiq_init_state(VCHIQ_STATE_T *state, V
6370     }
6371  
6372     state->default_slot_quota = state->slot_queue_available/2;
6373 +   state->default_message_quota = vcos_min(state->default_slot_quota * 256, (unsigned short)~0);
6374  
6375     local->trigger.event = &state->trigger_event;
6376     remote_event_create(&local->trigger);
6377 @@ -1552,8 +1581,6 @@ vchiq_init_state(VCHIQ_STATE_T *state, V
6378     remote_event_create(&local->recycle);
6379     local->slot_queue_recycle = state->slot_queue_available;
6380  
6381 -   vcos_event_create(&state->lp_evt, "LP_EVT");
6382 -
6383     local->debug[DEBUG_ENTRIES] = DEBUG_MAX;
6384  
6385     /*
6386 @@ -1566,7 +1593,10 @@ vchiq_init_state(VCHIQ_STATE_T *state, V
6387     vcos_snprintf(threadname, sizeof(threadname), "VCHIQ-%d", state->id);
6388     if (vcos_thread_create(&state->slot_handler_thread, threadname,
6389              &attrs, slot_handler_func, state) != VCOS_SUCCESS)
6390 +   {
6391 +      vcos_log_error("vchiq: FATAL: couldn't create thread %s", threadname);
6392        return VCHIQ_ERROR;
6393 +   }
6394  
6395     vcos_thread_attr_init(&attrs);
6396     vcos_thread_attr_setstacksize(&attrs, VCHIQ_SLOT_HANDLER_STACK);
6397 @@ -1574,20 +1604,17 @@ vchiq_init_state(VCHIQ_STATE_T *state, V
6398     vcos_snprintf(threadname, sizeof(threadname), "VCHIQr-%d", state->id);
6399     if (vcos_thread_create(&state->recycle_thread, threadname,
6400              &attrs, recycle_func, state) != VCOS_SUCCESS)
6401 +   {
6402 +      vcos_log_error("vchiq: FATAL: couldn't create thread %s", threadname);
6403        return VCHIQ_ERROR;
6404 +   }
6405  
6406 -   vcos_thread_attr_init(&attrs);
6407 -   vcos_thread_attr_setstacksize(&attrs, VCHIQ_SLOT_HANDLER_STACK);
6408 -   vcos_thread_attr_setpriority(&attrs, VCOS_THREAD_PRI_LOWEST);
6409 -   vcos_snprintf(threadname, sizeof(threadname), "VCHIQl-%d", state->id);
6410 -   if (vcos_thread_create(&state->lp_thread, threadname,
6411 -            &attrs, lp_func, state) != VCOS_SUCCESS)
6412 -      return VCHIQ_ERROR;
6413 +   status = vchiq_platform_init_state(state);
6414  
6415     /* Indicate readiness to the other side */
6416     local->initialised = 1;
6417  
6418 -   return VCHIQ_SUCCESS;
6419 +   return status;
6420  }
6421  
6422  /* Called from application thread when a client or server service is created. */
6423 @@ -1684,6 +1711,7 @@ vchiq_add_service_internal(VCHIQ_STATE_T
6424        init_bulk_queue(&service->bulk_tx);
6425        init_bulk_queue(&service->bulk_rx);
6426        service_quota->slot_quota = state->default_slot_quota;
6427 +      service_quota->message_quota = state->default_message_quota;
6428        if (service_quota->slot_use_count == 0)
6429           service_quota->previous_tx_index =
6430              SLOT_QUEUE_INDEX_FROM_POS(state->local_tx_pos) - 1;
6431 @@ -1833,9 +1861,13 @@ vchiq_close_service_internal(VCHIQ_SERVI
6432  
6433     if (service->srvstate == VCHIQ_SRVSTATE_CLOSING)
6434     {
6435 +      int i;
6436 +      int uc = service->service_use_count;
6437        /* Complete the close process */
6438 -      vchiq_release_service(&service->base);
6439 -
6440 +      for( i=0; i<uc; i++)
6441 +      { /* cater for cases where close is forced and the client may not close all it's handles */
6442 +         vchiq_release_service_internal(service);
6443 +      }
6444        service->client_id = 0;
6445  
6446        /* Now tell the client that the services is closed */
6447 @@ -1912,7 +1944,7 @@ vchiq_free_service_internal(VCHIQ_SERVIC
6448        if (slot_info->release_count != slot_info->use_count)
6449        {
6450           char *data = (char *)SLOT_DATA_FROM_INDEX(state, i);
6451 -         int pos, end;
6452 +         unsigned int pos, end;
6453  
6454           end = VCHIQ_SLOT_SIZE;
6455           if (data == state->rx_data)
6456 @@ -1938,6 +1970,12 @@ vchiq_free_service_internal(VCHIQ_SERVIC
6457                 }
6458              }
6459              pos += calc_stride(header->size);
6460 +            if (pos > VCHIQ_SLOT_SIZE)
6461 +            {
6462 +               vcos_log_error("fsi - pos %x: header %x, msgid %x, header->msgid %x, header->size %x",
6463 +                  pos, (unsigned int)header, msgid, header->msgid, header->size);
6464 +               vcos_assert(0);
6465 +            }
6466           }
6467        }
6468     }
6469 @@ -2050,7 +2088,7 @@ vchiq_close_service(VCHIQ_SERVICE_HANDLE
6470     VCHIQ_SERVICE_T *service = (VCHIQ_SERVICE_T *) handle;
6471     VCHIQ_STATUS_T status = VCHIQ_ERROR;
6472  
6473 -   if (service == NULL)
6474 +   if (!is_valid_service(service))
6475        return VCHIQ_ERROR;
6476  
6477     vcos_log_info("%d: close_service:%d", service->state->id, service->localport);
6478 @@ -2080,7 +2118,7 @@ vchiq_remove_service(VCHIQ_SERVICE_HANDL
6479     VCHIQ_SERVICE_T *service = (VCHIQ_SERVICE_T *) handle;
6480     VCHIQ_STATUS_T status = VCHIQ_SUCCESS;
6481  
6482 -   if (service == NULL)
6483 +   if (!is_valid_service(service))
6484        return VCHIQ_ERROR;
6485  
6486     vcos_log_info("%d: remove_service:%d", service->state->id, service->localport);
6487 @@ -2137,15 +2175,14 @@ vchiq_bulk_transfer(VCHIQ_SERVICE_T *ser
6488     const int dir_msgtype = (dir == VCHIQ_BULK_TRANSMIT) ? VCHIQ_MSG_BULK_TX : VCHIQ_MSG_BULK_RX;
6489     VCHIQ_STATUS_T status = VCHIQ_ERROR;
6490  
6491 -   if ((service == NULL) ||
6492 -       ((memhandle == VCHI_MEM_HANDLE_INVALID) && (offset == NULL)))
6493 +   if (!is_valid_service(service) ||
6494 +       (service->srvstate != VCHIQ_SRVSTATE_OPEN) ||
6495 +       ((memhandle == VCHI_MEM_HANDLE_INVALID) && (offset == NULL)) ||
6496 +       (vchiq_check_service(service) != VCHIQ_SUCCESS))
6497        return VCHIQ_ERROR;
6498  
6499     state = service->state;
6500  
6501 -   if (service->srvstate != VCHIQ_SRVSTATE_OPEN)
6502 -      return VCHIQ_ERROR;  /* Must be connected */
6503 -
6504     if (vcos_mutex_lock(&service->bulk_mutex) != VCOS_SUCCESS)
6505        return VCHIQ_RETRY;
6506  
6507 @@ -2325,8 +2362,9 @@ vchiq_queue_message(VCHIQ_SERVICE_HANDLE
6508     unsigned int size = 0;
6509     unsigned int i;
6510  
6511 -   if ((service == NULL) ||
6512 -      (service->srvstate != VCHIQ_SRVSTATE_OPEN))
6513 +   if (!is_valid_service(service) ||
6514 +      (service->srvstate != VCHIQ_SRVSTATE_OPEN) ||
6515 +      (vchiq_check_service(service) != VCHIQ_SUCCESS))
6516        return VCHIQ_ERROR;
6517  
6518     for (i = 0; i < (unsigned int)count; i++)
6519 @@ -2361,7 +2399,7 @@ vchiq_release_message(VCHIQ_SERVICE_HAND
6520     int slot_index;
6521     int msgid;
6522  
6523 -   if (service == NULL)
6524 +   if (!is_valid_service(service))
6525        return;
6526  
6527     state = service->state;
6528 @@ -2418,7 +2456,7 @@ vchiq_set_service_option(VCHIQ_SERVICE_H
6529     VCHIQ_SERVICE_T *service = (VCHIQ_SERVICE_T *)handle;
6530     VCHIQ_STATUS_T status = VCHIQ_ERROR;
6531  
6532 -   if (service)
6533 +   if (is_valid_service(service))
6534     {
6535        switch (option)
6536        {
6537 @@ -2427,6 +2465,48 @@ vchiq_set_service_option(VCHIQ_SERVICE_H
6538           status = VCHIQ_SUCCESS;
6539           break;
6540  
6541 +      case VCHIQ_SERVICE_OPTION_SLOT_QUOTA:
6542 +         {
6543 +            VCHIQ_SERVICE_QUOTA_T *service_quota =
6544 +               &service->state->service_quotas[service->localport];
6545 +            if (value == 0)
6546 +               value = service->state->default_slot_quota;
6547 +            if ((value >= service_quota->slot_use_count) &&
6548 +                (value < (unsigned short)~0))
6549 +            {
6550 +               service_quota->slot_quota = value;
6551 +               if ((value >= service_quota->slot_use_count) &&
6552 +                   (service_quota->message_quota >= service_quota->message_use_count))
6553 +               {
6554 +                  /* Signal the service that it may have dropped below its quota */
6555 +                  vcos_event_signal(&service_quota->quota_event);
6556 +               }
6557 +               status = VCHIQ_SUCCESS;
6558 +            }
6559 +         }
6560 +         break;
6561 +
6562 +      case VCHIQ_SERVICE_OPTION_MESSAGE_QUOTA:
6563 +         {
6564 +            VCHIQ_SERVICE_QUOTA_T *service_quota =
6565 +               &service->state->service_quotas[service->localport];
6566 +            if (value == 0)
6567 +               value = service->state->default_message_quota;
6568 +            if ((value >= service_quota->message_use_count) &&
6569 +                (value < (unsigned short)~0))
6570 +            {
6571 +               service_quota->message_quota = value;
6572 +               if ((value >= service_quota->message_use_count) &&
6573 +                   (service_quota->slot_quota >= service_quota->slot_use_count))
6574 +               {
6575 +                  /* Signal the service that it may have dropped below its quota */
6576 +                  vcos_event_signal(&service_quota->quota_event);
6577 +               }
6578 +               status = VCHIQ_SUCCESS;
6579 +            }
6580 +         }
6581 +         break;
6582 +
6583        default:
6584           break;
6585        }
6586 @@ -2568,9 +2648,11 @@ vchiq_dump_service_state(void *dump_cont
6587           vcos_strcpy(remoteport, "n/a");
6588  
6589        len += vcos_snprintf(buf + len, sizeof(buf) - len,
6590 -         " '%c%c%c%c' remote %s (slot use %d/%d)",
6591 +         " '%c%c%c%c' remote %s (msg use %d/%d, slot use %d/%d)",
6592           VCHIQ_FOURCC_AS_4CHARS(fourcc),
6593           remoteport,
6594 +         service_quota->message_use_count,
6595 +         service_quota->message_quota,
6596           service_quota->slot_use_count,
6597           service_quota->slot_quota);
6598  
6599 @@ -2602,3 +2684,34 @@ vchiq_dump_service_state(void *dump_cont
6600  
6601     vchiq_dump_platform_service_state(dump_context, service);
6602  }
6603 +
6604 +
6605 +VCHIQ_STATUS_T vchiq_send_remote_use(VCHIQ_STATE_T * state)
6606 +{
6607 +   VCHIQ_STATUS_T status = VCHIQ_RETRY;
6608 +   if(state->conn_state != VCHIQ_CONNSTATE_DISCONNECTED)
6609 +   {
6610 +      status = queue_message(state, NULL, VCHIQ_MAKE_MSG(VCHIQ_MSG_REMOTE_USE, 0, 0), NULL, 0, 0, 0);
6611 +   }
6612 +   return status;
6613 +}
6614 +
6615 +VCHIQ_STATUS_T vchiq_send_remote_release(VCHIQ_STATE_T * state)
6616 +{
6617 +   VCHIQ_STATUS_T status = VCHIQ_RETRY;
6618 +   if(state->conn_state != VCHIQ_CONNSTATE_DISCONNECTED)
6619 +   {
6620 +      status = queue_message(state, NULL, VCHIQ_MAKE_MSG(VCHIQ_MSG_REMOTE_RELEASE, 0, 0), NULL, 0, 0, 0);
6621 +   }
6622 +   return status;
6623 +}
6624 +
6625 +VCHIQ_STATUS_T vchiq_send_remote_use_active(VCHIQ_STATE_T * state)
6626 +{
6627 +   VCHIQ_STATUS_T status = VCHIQ_RETRY;
6628 +   if(state->conn_state != VCHIQ_CONNSTATE_DISCONNECTED)
6629 +   {
6630 +      status = queue_message(state, NULL, VCHIQ_MAKE_MSG(VCHIQ_MSG_REMOTE_USE_ACTIVE, 0, 0), NULL, 0, 0, 0);
6631 +   }
6632 +   return status;
6633 +}
6634 --- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h
6635 +++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.h
6636 @@ -47,6 +47,9 @@ vcos_static_assert(IS_POW2(VCHIQ_MAX_SLO
6637  #define VCHIQ_MSG_BULK_TX_DONE         9  // + (srcport, dstport), actual
6638  #define VCHIQ_MSG_PAUSE               10  // -
6639  #define VCHIQ_MSG_RESUME              11  // -
6640 +#define VCHIQ_MSG_REMOTE_USE          12  // -
6641 +#define VCHIQ_MSG_REMOTE_RELEASE      13  // -
6642 +#define VCHIQ_MSG_REMOTE_USE_ACTIVE   14  // -
6643  
6644  #define VCHIQ_PORT_MAX                 (VCHIQ_MAX_SERVICES - 1)
6645  #define VCHIQ_PORT_FREE                0x1000
6646 @@ -194,6 +197,8 @@ typedef struct remote_event_struct {
6647     VCOS_EVENT_T * event;
6648  } REMOTE_EVENT_T;
6649  
6650 +typedef struct opaque_platform_state_t* VCHIQ_PLATFORM_STATE_T;
6651 +
6652  typedef struct vchiq_state_struct VCHIQ_STATE_T;
6653  
6654  typedef struct vchiq_slot_struct {
6655 @@ -253,8 +258,10 @@ typedef struct vchiq_service_struct {
6656     usage is carried over between users of the same port number.
6657   */
6658  typedef struct vchiq_service_quota_struct {
6659 -   int slot_quota;
6660 -   int slot_use_count;
6661 +   unsigned short slot_quota;
6662 +   unsigned short slot_use_count;
6663 +   unsigned short message_quota;
6664 +   unsigned short message_use_count;
6665     VCOS_EVENT_T quota_event;
6666     int previous_tx_index;
6667  } VCHIQ_SERVICE_QUOTA_T;
6668 @@ -314,7 +321,8 @@ struct vchiq_state_struct {
6669     VCHIQ_SHARED_STATE_T *remote;
6670     VCHIQ_SLOT_T *slot_data;
6671  
6672 -   int default_slot_quota;
6673 +   unsigned short default_slot_quota;
6674 +   unsigned short default_message_quota;
6675  
6676     VCOS_EVENT_T connect;      // event indicating connect message received
6677     VCOS_MUTEX_T mutex;        // mutex protecting services
6678 @@ -322,7 +330,6 @@ struct vchiq_state_struct {
6679  
6680     VCOS_THREAD_T slot_handler_thread;  // processes incoming messages
6681     VCOS_THREAD_T recycle_thread;       // processes recycled slots
6682 -   VCOS_THREAD_T lp_thread;            // processes low priority messages (eg suspend)
6683  
6684     /* Local implementation of the trigger remote event */
6685     VCOS_EVENT_T trigger_event;
6686 @@ -330,8 +337,6 @@ struct vchiq_state_struct {
6687     /* Local implementation of the recycle remote event */
6688     VCOS_EVENT_T recycle_event;
6689  
6690 -   VCOS_EVENT_T lp_evt;
6691 -
6692     char *tx_data;
6693     char *rx_data;
6694     VCHIQ_SLOT_INFO_T *rx_info;
6695 @@ -340,17 +345,6 @@ struct vchiq_state_struct {
6696  
6697     VCOS_MUTEX_T recycle_mutex;
6698  
6699 -   VCOS_MUTEX_T suspend_resume_mutex;
6700 -   VCOS_MUTEX_T use_count_mutex;
6701 -
6702 -   /* Global use count for videocore.
6703 -    * This is equal to the sum of the use counts for all services.  When this hits
6704 -    * zero the videocore suspend procedure will be initiated. */
6705 -   int videocore_use_count;
6706 -
6707 -   /* Flag to indicate whether videocore is currently suspended */
6708 -   int videocore_suspended;
6709 -
6710     /* Indicates the byte position within the stream from where the next message
6711        will be read. The least significant bits are an index into the slot.
6712        The next bits are the index of the slot in remote->slot_queue. */
6713 @@ -388,6 +382,8 @@ struct vchiq_state_struct {
6714     VCHIQ_SERVICE_T *services[VCHIQ_MAX_SERVICES];
6715     VCHIQ_SERVICE_QUOTA_T service_quotas[VCHIQ_MAX_SERVICES];
6716     VCHIQ_SLOT_INFO_T slot_info[VCHIQ_MAX_SLOTS];
6717 +
6718 +   VCHIQ_PLATFORM_STATE_T platform_state;
6719  };
6720  
6721  extern VCHIQ_SLOT_ZERO_T *
6722 @@ -477,4 +473,34 @@ extern void
6723  vchiq_dump_platform_service_state(void *dump_context,
6724     VCHIQ_SERVICE_T *service);
6725  
6726 +extern VCHIQ_STATUS_T
6727 +vchiq_use_service_internal(VCHIQ_SERVICE_T *service);
6728 +
6729 +extern VCHIQ_STATUS_T
6730 +vchiq_release_service_internal(VCHIQ_SERVICE_T *service);
6731 +
6732 +extern VCHIQ_STATUS_T
6733 +vchiq_on_remote_use(VCHIQ_STATE_T *state);
6734 +
6735 +extern VCHIQ_STATUS_T
6736 +vchiq_on_remote_release(VCHIQ_STATE_T *state);
6737 +
6738 +extern VCHIQ_STATUS_T
6739 +vchiq_platform_init_state(VCHIQ_STATE_T *state);
6740 +
6741 +extern void
6742 +vchiq_on_remote_use_active(VCHIQ_STATE_T *state);
6743 +
6744 +extern VCHIQ_STATUS_T
6745 +vchiq_send_remote_use(VCHIQ_STATE_T * state);
6746 +
6747 +extern VCHIQ_STATUS_T
6748 +vchiq_send_remote_release(VCHIQ_STATE_T * state);
6749 +
6750 +extern VCHIQ_STATUS_T
6751 +vchiq_send_remote_use_active(VCHIQ_STATE_T * state);
6752 +
6753 +extern void
6754 +vchiq_platform_conn_state_changed(VCHIQ_STATE_T* state, VCHIQ_CONNSTATE_T oldstate, VCHIQ_CONNSTATE_T newstate);
6755 +
6756  #endif
6757 --- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h
6758 +++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_if.h
6759 @@ -55,7 +55,9 @@ typedef enum
6760  
6761  typedef enum
6762  {
6763 -   VCHIQ_SERVICE_OPTION_AUTOCLOSE
6764 +   VCHIQ_SERVICE_OPTION_AUTOCLOSE,
6765 +   VCHIQ_SERVICE_OPTION_SLOT_QUOTA,
6766 +   VCHIQ_SERVICE_OPTION_MESSAGE_QUOTA
6767  } VCHIQ_SERVICE_OPTION_T;
6768  
6769  #ifdef __HIGHC__
6770 @@ -94,11 +96,11 @@ typedef struct vchiq_service_base_struct
6771  } VCHIQ_SERVICE_BASE_T;
6772  
6773  typedef struct vchiq_service_params_struct {
6774 -  int fourcc;
6775 -  VCHIQ_CALLBACK_T callback;
6776 -  void *userdata;
6777 -  short version;       /* Increment for non-trivial changes */
6778 -  short version_min;   /* Update for incompatible changes */
6779 +   int fourcc;
6780 +   VCHIQ_CALLBACK_T callback;
6781 +   void *userdata;
6782 +   short version;       /* Increment for non-trivial changes */
6783 +   short version_min;   /* Update for incompatible changes */
6784  } VCHIQ_SERVICE_PARAMS_T;
6785  
6786  typedef struct vchiq_config_struct {
6787 @@ -112,6 +114,8 @@ typedef struct vchiq_config_struct {
6788  } VCHIQ_CONFIG_T;
6789  
6790  typedef struct vchiq_instance_struct *VCHIQ_INSTANCE_T;
6791 +typedef void (*VCHIQ_REMOTE_USE_CALLBACK_T)(void* cb_arg);
6792 +
6793  
6794  extern VCHIQ_STATUS_T vchiq_initialise(VCHIQ_INSTANCE_T *pinstance);
6795  extern VCHIQ_STATUS_T vchiq_shutdown(VCHIQ_INSTANCE_T instance);
6796 @@ -143,6 +147,9 @@ extern int            vchiq_get_client_i
6797  extern VCHIQ_STATUS_T vchiq_get_config(VCHIQ_INSTANCE_T instance, int config_size, VCHIQ_CONFIG_T *pconfig);
6798  extern VCHIQ_STATUS_T vchiq_set_service_option(VCHIQ_SERVICE_HANDLE_T service, VCHIQ_SERVICE_OPTION_T option, int value);
6799  
6800 +extern VCHIQ_STATUS_T vchiq_remote_use(VCHIQ_INSTANCE_T instance, VCHIQ_REMOTE_USE_CALLBACK_T callback, void* cb_arg);
6801 +extern VCHIQ_STATUS_T vchiq_remote_release(VCHIQ_INSTANCE_T instance);
6802 +
6803  extern VCHIQ_STATUS_T vchiq_dump_phys_mem( VCHIQ_SERVICE_HANDLE_T service, void *ptr, size_t num_bytes );
6804  
6805  #endif /* VCHIQ_IF_H */
6806 --- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
6807 +++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
6808 @@ -91,15 +91,15 @@ typedef struct {
6809  #define VCHIQ_IOC_QUEUE_MESSAGE        _IOW(VCHIQ_IOC_MAGIC,  4, VCHIQ_QUEUE_MESSAGE_T)
6810  #define VCHIQ_IOC_QUEUE_BULK_TRANSMIT  _IOW(VCHIQ_IOC_MAGIC,  5, VCHIQ_QUEUE_BULK_TRANSFER_T)
6811  #define VCHIQ_IOC_QUEUE_BULK_RECEIVE   _IOW(VCHIQ_IOC_MAGIC,  6, VCHIQ_QUEUE_BULK_TRANSFER_T)
6812 -#define VCHIQ_IOC_AWAIT_COMPLETION     _IOW(VCHIQ_IOC_MAGIC,  7, VCHIQ_AWAIT_COMPLETION_T)
6813 -#define VCHIQ_IOC_DEQUEUE_MESSAGE      _IOW(VCHIQ_IOC_MAGIC,  8, VCHIQ_DEQUEUE_MESSAGE_T)
6814 +#define VCHIQ_IOC_AWAIT_COMPLETION     _IOWR(VCHIQ_IOC_MAGIC, 7, VCHIQ_AWAIT_COMPLETION_T)
6815 +#define VCHIQ_IOC_DEQUEUE_MESSAGE      _IOWR(VCHIQ_IOC_MAGIC, 8, VCHIQ_DEQUEUE_MESSAGE_T)
6816  #define VCHIQ_IOC_GET_CLIENT_ID        _IO(VCHIQ_IOC_MAGIC,   9)
6817 -#define VCHIQ_IOC_GET_CONFIG           _IOW(VCHIQ_IOC_MAGIC, 10, VCHIQ_GET_CONFIG_T)
6818 -#define VCHIQ_IOC_CLOSE_SERVICE        _IO(VCHIQ_IOC_MAGIC,  11)
6819 -#define VCHIQ_IOC_USE_SERVICE          _IO(VCHIQ_IOC_MAGIC,  12)
6820 -#define VCHIQ_IOC_RELEASE_SERVICE      _IO(VCHIQ_IOC_MAGIC,  13)
6821 -#define VCHIQ_IOC_SET_SERVICE_OPTION   _IOW(VCHIQ_IOC_MAGIC, 14, VCHIQ_SET_SERVICE_OPTION_T)
6822 -#define VCHIQ_IOC_DUMP_PHYS_MEM        _IOW(VCHIQ_IOC_MAGIC, 15, VCHIQ_DUMP_MEM_T)
6823 +#define VCHIQ_IOC_GET_CONFIG           _IOWR(VCHIQ_IOC_MAGIC, 10, VCHIQ_GET_CONFIG_T)
6824 +#define VCHIQ_IOC_CLOSE_SERVICE        _IO(VCHIQ_IOC_MAGIC,   11)
6825 +#define VCHIQ_IOC_USE_SERVICE          _IO(VCHIQ_IOC_MAGIC,   12)
6826 +#define VCHIQ_IOC_RELEASE_SERVICE      _IO(VCHIQ_IOC_MAGIC,   13)
6827 +#define VCHIQ_IOC_SET_SERVICE_OPTION   _IOW(VCHIQ_IOC_MAGIC,  14, VCHIQ_SET_SERVICE_OPTION_T)
6828 +#define VCHIQ_IOC_DUMP_PHYS_MEM        _IOW(VCHIQ_IOC_MAGIC,  15, VCHIQ_DUMP_MEM_T)
6829  #define VCHIQ_IOC_MAX                  15
6830  
6831  #endif
6832 --- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_lib.c
6833 +++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_lib.c
6834 @@ -97,6 +97,12 @@ is_valid_instance(VCHIQ_INSTANCE_T insta
6835     return (instance == &vchiq_instance) && (instance->initialised > 0);
6836  }
6837  
6838 +static __inline int
6839 +is_valid_service(VCHIQ_SERVICE_T *service)
6840 +{
6841 +   return ((service != NULL) && (service->fd != VCHIQ_INVALID_HANDLE));
6842 +}
6843 +
6844  /*
6845   * VCHIQ API
6846   */
6847 @@ -318,6 +324,9 @@ vchiq_close_service(VCHIQ_SERVICE_HANDLE
6848  
6849     vcos_log_trace( "%s called service handle = 0x%08x", __func__, (uint32_t)handle );
6850  
6851 +   if (!is_valid_service(service))
6852 +      return VCHIQ_ERROR;
6853 +
6854     RETRY(ret,ioctl(service->fd, VCHIQ_IOC_CLOSE_SERVICE, service->handle));
6855  
6856     if (ret != 0)
6857 @@ -335,6 +344,9 @@ vchiq_remove_service(VCHIQ_SERVICE_HANDL
6858  
6859     vcos_log_trace( "%s called service handle = 0x%08x", __func__, (uint32_t)handle );
6860  
6861 +   if (!is_valid_service(service))
6862 +      return VCHIQ_ERROR;
6863 +
6864     RETRY(ret,ioctl(service->fd, VCHIQ_IOC_REMOVE_SERVICE, service->handle));
6865  
6866     if (ret != 0)
6867 @@ -355,6 +367,9 @@ vchiq_queue_message(VCHIQ_SERVICE_HANDLE
6868  
6869     vcos_log_trace( "%s called service handle = 0x%08x", __func__, (uint32_t)handle );
6870  
6871 +   if (!is_valid_service(service))
6872 +      return VCHIQ_ERROR;
6873 +
6874     args.handle = service->handle;
6875     args.elements = elements;
6876     args.count = count;
6877 @@ -384,6 +399,9 @@ vchiq_queue_bulk_transmit(VCHIQ_SERVICE_
6878  
6879     vcos_log_trace( "%s called service handle = 0x%08x", __func__, (uint32_t)handle );
6880  
6881 +   if (!is_valid_service(service))
6882 +      return VCHIQ_ERROR;
6883 +
6884     args.handle = service->handle;
6885     args.data = (void *)data;
6886     args.size = size;
6887 @@ -406,6 +424,9 @@ vchiq_queue_bulk_receive(VCHIQ_SERVICE_H
6888  
6889     vcos_log_trace( "%s called service handle = 0x%08x", __func__, (uint32_t)handle );
6890  
6891 +   if (!is_valid_service(service))
6892 +      return VCHIQ_ERROR;
6893 +
6894     args.handle = service->handle;
6895     args.data = data;
6896     args.size = size;
6897 @@ -457,6 +478,9 @@ vchiq_bulk_transmit(VCHIQ_SERVICE_HANDLE
6898  
6899     vcos_log_trace( "%s called service handle = 0x%08x", __func__, (uint32_t)handle );
6900  
6901 +   if (!is_valid_service(service))
6902 +      return VCHIQ_ERROR;
6903 +
6904     args.handle = service->handle;
6905     args.data = (void *)data;
6906     args.size = size;
6907 @@ -480,6 +504,9 @@ vchiq_bulk_receive(VCHIQ_SERVICE_HANDLE_
6908  
6909     vcos_log_trace( "%s called service handle = 0x%08x", __func__, (uint32_t)handle );
6910  
6911 +   if (!is_valid_service(service))
6912 +      return VCHIQ_ERROR;
6913 +
6914     args.handle = service->handle;
6915     args.data = data;
6916     args.size = size;
6917 @@ -521,6 +548,9 @@ vchiq_get_client_id(VCHIQ_SERVICE_HANDLE
6918  {
6919     VCHIQ_SERVICE_T *service = (VCHIQ_SERVICE_T *)handle;
6920  
6921 +   if (!is_valid_service(service))
6922 +      return VCHIQ_ERROR;
6923 +
6924     return ioctl(service->fd, VCHIQ_IOC_GET_CLIENT_ID, service->handle);
6925  }
6926  
6927 @@ -546,10 +576,14 @@ vchiq_get_config(VCHIQ_INSTANCE_T instan
6928  int32_t
6929  vchiq_use_service( const VCHIQ_SERVICE_HANDLE_T handle )
6930  {
6931 -    VCHIQ_SERVICE_T *service = (VCHIQ_SERVICE_T *)handle;
6932 -    int ret;
6933 -    RETRY(ret,ioctl(service->fd, VCHIQ_IOC_USE_SERVICE, service->handle));
6934 -    return ret;
6935 +   VCHIQ_SERVICE_T *service = (VCHIQ_SERVICE_T *)handle;
6936 +   int ret;
6937 +
6938 +   if (!is_valid_service(service))
6939 +      return VCHIQ_ERROR;
6940 +
6941 +   RETRY(ret,ioctl(service->fd, VCHIQ_IOC_USE_SERVICE, service->handle));
6942 +   return ret;
6943  }
6944  
6945  int32_t
6946 @@ -569,6 +603,9 @@ vchiq_set_service_option(VCHIQ_SERVICE_H
6947     VCHIQ_SERVICE_T *service = (VCHIQ_SERVICE_T *)handle;
6948     int ret;
6949  
6950 +   if (!is_valid_service(service))
6951 +      return VCHIQ_ERROR;
6952 +
6953     args.handle = service->handle;
6954     args.option = option;
6955     args.value  = value;
6956 @@ -633,6 +670,9 @@ vchi_msg_peek( VCHI_SERVICE_HANDLE_T han
6957     VCHI_SERVICE_T *service = (VCHI_SERVICE_T *)handle;
6958     int ret;
6959  
6960 +   if (!is_valid_service(service))
6961 +      return VCHIQ_ERROR;
6962 +
6963     ret = fill_peek_buf(service, flags);
6964  
6965     if (ret == 0)
6966 @@ -659,6 +699,9 @@ vchi_msg_remove( VCHI_SERVICE_HANDLE_T h
6967  {
6968     VCHI_SERVICE_T *service = (VCHI_SERVICE_T *)handle;
6969  
6970 +   if (!is_valid_service(service))
6971 +      return VCHIQ_ERROR;
6972 +
6973     /* Why would you call vchi_msg_remove without calling vchi_msg_peek first? */
6974     vcos_assert(service->peek_size >= 0);
6975  
6976 @@ -697,6 +740,9 @@ vchi_msg_queue( VCHI_SERVICE_HANDLE_T ha
6977     vcos_unused(msg_handle);
6978     vcos_assert(flags == VCHI_FLAGS_BLOCK_UNTIL_QUEUED);
6979  
6980 +   if (!is_valid_service(service))
6981 +      return VCHIQ_ERROR;
6982 +
6983     args.handle = service->handle;
6984     args.elements = &element;
6985     args.count = 1;
6986 @@ -730,6 +776,9 @@ vchi_bulk_queue_receive( VCHI_SERVICE_HA
6987     VCHIQ_QUEUE_BULK_TRANSFER_T args;
6988     int ret;
6989  
6990 +   if (!is_valid_service(service))
6991 +      return VCHIQ_ERROR;
6992 +
6993     switch ((int)flags) {
6994     case VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE | VCHI_FLAGS_BLOCK_UNTIL_QUEUED:
6995        args.mode = VCHIQ_BULK_MODE_CALLBACK;
6996 @@ -780,6 +829,9 @@ vchi_bulk_queue_transmit( VCHI_SERVICE_H
6997     VCHIQ_QUEUE_BULK_TRANSFER_T args;
6998     int ret;
6999  
7000 +   if (!is_valid_service(service))
7001 +      return VCHIQ_ERROR;
7002 +
7003     switch ((int)flags) {
7004     case VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE | VCHI_FLAGS_BLOCK_UNTIL_QUEUED:
7005        args.mode = VCHIQ_BULK_MODE_CALLBACK;
7006 @@ -833,6 +885,9 @@ vchi_msg_dequeue( VCHI_SERVICE_HANDLE_T
7007  
7008     vcos_assert(flags == VCHI_FLAGS_NONE || flags == VCHI_FLAGS_BLOCK_UNTIL_OP_COMPLETE);
7009  
7010 +   if (!is_valid_service(service))
7011 +      return VCHIQ_ERROR;
7012 +
7013     if (service->peek_size >= 0)
7014     {
7015        fprintf(stderr, "vchi_msg_dequeue -> using peek buffer\n");
7016 @@ -903,6 +958,9 @@ vchi_msg_queuev( VCHI_SERVICE_HANDLE_T h
7017  
7018     vcos_assert(flags == VCHI_FLAGS_BLOCK_UNTIL_QUEUED);
7019  
7020 +   if (!is_valid_service(service))
7021 +      return VCHIQ_ERROR;
7022 +
7023     args.handle = service->handle;
7024     args.elements = (const VCHIQ_ELEMENT_T *)vector;
7025     args.count = count;
7026 @@ -961,6 +1019,9 @@ vchi_msg_hold( VCHI_SERVICE_HANDLE_T han
7027     VCHI_SERVICE_T *service = (VCHI_SERVICE_T *)handle;
7028     int ret;
7029  
7030 +   if (!is_valid_service(service))
7031 +      return VCHIQ_ERROR;
7032 +
7033     ret = fill_peek_buf(service, flags);
7034  
7035     if (ret == 0)
7036 @@ -1116,6 +1177,10 @@ vchi_service_close( const VCHI_SERVICE_H
7037  {
7038     VCHI_SERVICE_T *service = (VCHI_SERVICE_T *)handle;
7039     int ret;
7040 +
7041 +   if (!is_valid_service(service))
7042 +      return VCHIQ_ERROR;
7043 +
7044     RETRY(ret,ioctl(service->fd, VCHIQ_IOC_REMOVE_SERVICE, service->handle));
7045  
7046     if (ret == 0)
7047 @@ -1129,6 +1194,10 @@ vchi_service_destroy( const VCHI_SERVICE
7048  {
7049     VCHI_SERVICE_T *service = (VCHI_SERVICE_T *)handle;
7050     int ret;
7051 +
7052 +   if (!is_valid_service(service))
7053 +      return VCHIQ_ERROR;
7054 +
7055     RETRY(ret,ioctl(service->fd, VCHIQ_IOC_REMOVE_SERVICE, service->handle));
7056  
7057     if (ret == 0)
7058 @@ -1200,6 +1269,10 @@ vchi_service_use( const VCHI_SERVICE_HAN
7059  {
7060     VCHI_SERVICE_T *service = (VCHI_SERVICE_T *)handle;
7061     int ret;
7062 +
7063 +   if (!is_valid_service(service))
7064 +      return VCHIQ_ERROR;
7065 +
7066     RETRY(ret,ioctl(service->fd, VCHIQ_IOC_USE_SERVICE, service->handle));
7067     return ret;
7068  }
7069 @@ -1218,10 +1291,47 @@ int32_t vchi_service_release( const VCHI
7070  {
7071     VCHI_SERVICE_T *service = (VCHI_SERVICE_T *)handle;
7072     int ret;
7073 +
7074 +   if (!is_valid_service(service))
7075 +      return VCHIQ_ERROR;
7076 +
7077     RETRY(ret,ioctl(service->fd, VCHIQ_IOC_RELEASE_SERVICE, service->handle));
7078     return ret;
7079  }
7080  
7081 +/***********************************************************
7082 + * Name: vchiq_dump_phys_mem
7083 + *
7084 + * Arguments: const VCHI_SERVICE_HANDLE_T handle
7085 + *            void *buffer
7086 + *            size_t num_bytes
7087 + *
7088 + * Description: Dumps the physical memory associated with
7089 + *              a buffer.
7090 + *
7091 + * Returns: void
7092 + *
7093 + ***********************************************************/
7094 +VCHIQ_STATUS_T vchiq_dump_phys_mem( VCHIQ_SERVICE_HANDLE_T handle,
7095 +                             void *ptr,
7096 +                             size_t num_bytes )
7097 +{
7098 +   VCHIQ_SERVICE_T *service = (VCHIQ_SERVICE_T *)handle;
7099 +   VCHIQ_DUMP_MEM_T  dump_mem;
7100 +   int ret;
7101 +
7102 +   if (!is_valid_service(service))
7103 +      return VCHIQ_ERROR;
7104 +
7105 +   dump_mem.virt_addr = ptr;
7106 +   dump_mem.num_bytes = num_bytes;
7107 +
7108 +   RETRY(ret,ioctl(service->fd, VCHIQ_IOC_DUMP_PHYS_MEM, &dump_mem));
7109 +   return (ret >= 0) ? VCHIQ_SUCCESS : VCHIQ_ERROR;
7110 +}
7111 +
7112 +
7113 +
7114  /*
7115   * Support functions
7116   */
7117 --- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c
7118 +++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c
7119 @@ -859,10 +859,38 @@ int32_t vchi_service_create( VCHI_INSTAN
7120  
7121  int32_t vchi_service_close( const VCHI_SERVICE_HANDLE_T handle )
7122  {
7123 -   vcos_unused(handle);
7124 +   int32_t ret = -1;
7125 +   SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
7126 +   if(service)
7127 +   {
7128 +      VCHIQ_STATUS_T status = vchiq_close_service(service->handle);
7129 +      if (status == VCHIQ_SUCCESS)
7130 +      {
7131 +         service_free(service);
7132 +         service = NULL;
7133 +      }
7134 +
7135 +      ret = vchiq_status_to_vchi( status );
7136 +   }
7137 +   return ret;
7138 +}
7139  
7140 -   // YTI??
7141 -   return 0;
7142 +int32_t vchi_service_destroy( const VCHI_SERVICE_HANDLE_T handle )
7143 +{
7144 +   int32_t ret = -1;
7145 +   SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
7146 +   if(service)
7147 +   {
7148 +      VCHIQ_STATUS_T status = vchiq_remove_service(service->handle);
7149 +      if (status == VCHIQ_SUCCESS)
7150 +      {
7151 +         service_free(service);
7152 +         service = NULL;
7153 +      }
7154 +
7155 +      ret = vchiq_status_to_vchi( status );
7156 +   }
7157 +   return ret;
7158  }
7159  
7160  /* ----------------------------------------------------------------------
7161 @@ -962,9 +990,12 @@ EXPORT_SYMBOL(vchi_bulk_queue_transmit);
7162  EXPORT_SYMBOL(vchi_msg_dequeue);
7163  EXPORT_SYMBOL(vchi_msg_queue);
7164  EXPORT_SYMBOL(vchi_msg_queuev);
7165 +EXPORT_SYMBOL(vchi_msg_peek);
7166 +EXPORT_SYMBOL(vchi_msg_remove);
7167  EXPORT_SYMBOL(vchi_service_close);
7168  EXPORT_SYMBOL(vchi_service_open);
7169  EXPORT_SYMBOL(vchi_service_create);
7170 +EXPORT_SYMBOL(vchi_service_destroy);
7171  EXPORT_SYMBOL(vchi_service_use);
7172  EXPORT_SYMBOL(vchi_service_release);
7173  #endif
7174 --- a/drivers/mmc/host/sdhci-bcm2708.c
7175 +++ b/drivers/mmc/host/sdhci-bcm2708.c
7176 @@ -26,7 +26,9 @@
7177  #include <linux/highmem.h>
7178  #include <linux/platform_device.h>
7179  #include <linux/module.h>
7180 +#include <linux/mmc/mmc.h>
7181  #include <linux/mmc/host.h>
7182 +#include <linux/mmc/sd.h>
7183  
7184  #include <linux/io.h>
7185  #include <linux/dma-mapping.h>
7186 @@ -57,6 +59,9 @@
7187  //#define LOG_REGISTERS
7188  
7189  #define USE_SCHED_TIME
7190 +#define USE_SPACED_WRITES_2CLK 1  /* space consecutive register writes */
7191 +#define USE_SOFTWARE_TIMEOUTS 1   /* not hardware timeouts */
7192 +#define SOFTWARE_ERASE_TIMEOUT_SEC 30
7193  
7194  #define SDHCI_BCM_DMA_CHAN 4   /* this default is normally overriden */
7195  #define SDHCI_BCM_DMA_WAITS 0  /* delays slowing DMA transfers: 0-31 */
7196 @@ -68,6 +73,9 @@
7197  
7198  #define BCM2708_SDHCI_SLEEP_TIMEOUT 1000   /* msecs */
7199  
7200 +/* Mhz clock that the EMMC core is running at. Should match the platform clockman settings */
7201 +#define BCM2708_EMMC_CLOCK_FREQ 80000000
7202 +
7203  #define POWER_OFF 0
7204  #define POWER_LAZY_OFF 1
7205  #define POWER_ON  2
7206 @@ -222,6 +230,12 @@ u8 sdhci_bcm2708_readb(struct sdhci_host
7207  
7208  static void sdhci_bcm2708_raw_writel(struct sdhci_host *host, u32 val, int reg)
7209  {
7210 +       u32 ier;
7211 +
7212 +#if USE_SPACED_WRITES_2CLK
7213 +       static bool timeout_disabled = false;
7214 +       unsigned int ns_2clk = 0;
7215 +        
7216         /* The Arasan has a bugette whereby it may lose the content of
7217          * successive writes to registers that are within two SD-card clock
7218          * cycles of each other (a clock domain crossing problem).
7219 @@ -229,12 +243,11 @@ static void sdhci_bcm2708_raw_writel(str
7220          * (Which is just as well - otherwise we'd have to nobble the DMA engine
7221          * too)
7222          */
7223 -#if 1
7224         if (reg != SDHCI_BUFFER && host->clock != 0) {
7225                 /* host->clock is the clock freq in Hz */
7226                 static hptime_t last_write_hpt;
7227                 hptime_t now = hptime();
7228 -               unsigned int ns_2clk = 2000000000/host->clock;
7229 +               ns_2clk = 2000000000/host->clock;
7230  
7231                 if (now == last_write_hpt || now == last_write_hpt+1) {
7232                          /* we can't guarantee any significant time has
7233 @@ -250,6 +263,27 @@ static void sdhci_bcm2708_raw_writel(str
7234                 }
7235                 last_write_hpt = now;
7236         }
7237 +#if USE_SOFTWARE_TIMEOUTS
7238 +       /* The Arasan is clocked for timeouts using the SD clock which is too
7239 +        * fast for ERASE commands and causes issues. So we disable timeouts
7240 +        * for ERASE */
7241 +       if (host->cmd != NULL && host->cmd->opcode == MMC_ERASE &&
7242 +            reg == (SDHCI_COMMAND & ~3)) {
7243 +               mod_timer(&host->timer,
7244 +                          jiffies + SOFTWARE_ERASE_TIMEOUT_SEC * HZ);
7245 +               ier = readl(host->ioaddr + SDHCI_SIGNAL_ENABLE);
7246 +               ier &= ~SDHCI_INT_DATA_TIMEOUT;
7247 +               writel(ier, host->ioaddr + SDHCI_SIGNAL_ENABLE);
7248 +               timeout_disabled = true;
7249 +               udelay((ns_2clk+1000-1)/1000);
7250 +       } else if (timeout_disabled) {
7251 +               ier = readl(host->ioaddr + SDHCI_SIGNAL_ENABLE);
7252 +               ier |= SDHCI_INT_DATA_TIMEOUT;
7253 +               writel(ier, host->ioaddr + SDHCI_SIGNAL_ENABLE);
7254 +               timeout_disabled = false;
7255 +               udelay((ns_2clk+1000-1)/1000);
7256 +       }
7257 +#endif
7258         writel(val, host->ioaddr + reg);
7259  #else
7260         void __iomem * regaddr = host->ioaddr + reg;
7261 @@ -325,14 +359,68 @@ void sdhci_bcm2708_writeb(struct sdhci_h
7262  
7263  static unsigned int sdhci_bcm2708_get_max_clock(struct sdhci_host *host)
7264  {
7265 -       return 100000000;       // this value is in Hz (100MHz/4)
7266 +       return 20000000;        // this value is in Hz (20MHz)
7267  }
7268  
7269  static unsigned int sdhci_bcm2708_get_timeout_clock(struct sdhci_host *host)
7270  {
7271 -       return 100000;          // this value is in kHz (100MHz/4)
7272 +       if(host->clock)
7273 +               return (host->clock / 1000);            // this value is in kHz (100MHz)
7274 +       else
7275 +               return (sdhci_bcm2708_get_max_clock(host) / 1000);
7276  }
7277  
7278 +static void sdhci_bcm2708_set_clock(struct sdhci_host *host, unsigned int clock)
7279 +{
7280 +       int div = 0;
7281 +       u16 clk = 0;
7282 +       unsigned long timeout;
7283 +
7284 +        if (clock == host->clock)
7285 +                return;
7286 +
7287 +        sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
7288 +
7289 +        if (clock == 0)
7290 +                goto out;
7291 +
7292 +       if (BCM2708_EMMC_CLOCK_FREQ <= clock)
7293 +               div = 1;
7294 +       else {
7295 +               for (div = 2; div < SDHCI_MAX_DIV_SPEC_300; div += 2) {
7296 +                       if ((BCM2708_EMMC_CLOCK_FREQ / div) <= clock)
7297 +                               break;
7298 +               }
7299 +       }
7300 +
7301 +        DBG( "desired SD clock: %d, actual: %d\n",
7302 +                clock, BCM2708_EMMC_CLOCK_FREQ / div);
7303 +
7304 +       clk |= (div & SDHCI_DIV_MASK) << SDHCI_DIVIDER_SHIFT;
7305 +       clk |= ((div & SDHCI_DIV_HI_MASK) >> SDHCI_DIV_MASK_LEN)
7306 +               << SDHCI_DIVIDER_HI_SHIFT;
7307 +       clk |= SDHCI_CLOCK_INT_EN;
7308 +
7309 +       sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
7310 +
7311 +        timeout = 20;
7312 +        while (!((clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL))
7313 +                        & SDHCI_CLOCK_INT_STABLE)) {
7314 +                if (timeout == 0) {
7315 +                       printk(KERN_ERR "%s: Internal clock never "
7316 +                               "stabilised.\n", mmc_hostname(host->mmc));
7317 +                        return;
7318 +                }
7319 +                timeout--;
7320 +                mdelay(1);
7321 +        }
7322 +
7323 +        clk |= SDHCI_CLOCK_CARD_EN;
7324 +        sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
7325 +out:
7326 +        host->clock = clock;
7327 + }
7328 +
7329  /*****************************************************************************\
7330   *                                                                          *
7331   * DMA Operation                                                            *
7332 @@ -429,7 +517,8 @@ static void schci_bcm2708_cb_read(struct
7333         cb->stride = 0;
7334  
7335         if (is_last) {
7336 -               cb->info |= BCM2708_DMA_INT_EN;
7337 +               cb->info |= BCM2708_DMA_INT_EN |
7338 +                    BCM2708_DMA_WAIT_RESP;
7339                 cb->next = 0;
7340         } else
7341                 cb->next = host->cb_handle +
7342 @@ -460,7 +549,8 @@ static void schci_bcm2708_cb_write(struc
7343         cb->stride = 0;
7344  
7345         if (is_last) {
7346 -               cb->info |= BCM2708_DMA_INT_EN;
7347 +               cb->info |= BCM2708_DMA_INT_EN |
7348 +                    BCM2708_DMA_WAIT_RESP;
7349                 cb->next = 0;
7350         } else
7351                 cb->next = host->cb_handle +
7352 @@ -806,8 +896,7 @@ static void sdhci_bcm2708_dma_complete_i
7353                    We get CRC and DEND errors unless we wait for
7354                    the SD controller to finish reading/writing to the card. */
7355                 u32 state_mask;
7356 -               int timeout=1000000;
7357 -               hptime_t now = hptime();
7358 +               int timeout=1000;
7359  
7360                 DBG("PDMA over - sync card\n");
7361                 if (data->flags & MMC_DATA_READ)
7362 @@ -815,17 +904,12 @@ static void sdhci_bcm2708_dma_complete_i
7363                 else
7364                         state_mask = SDHCI_DOING_WRITE;
7365  
7366 -               while (0 != (sdhci_bcm2708_raw_readl(host,
7367 -                                                    SDHCI_PRESENT_STATE) &
7368 -                            state_mask) && --timeout > 0)
7369 +               while (0 != (sdhci_bcm2708_raw_readl(host, SDHCI_PRESENT_STATE) 
7370 +                       & state_mask) && --timeout > 0)
7371 +               {
7372 +                       udelay(100);
7373                         continue;
7374 -
7375 -               if (1000000-timeout > 4000) /*ave. is about 3250*/
7376 -                       printk(KERN_INFO "%s: note - long %s sync %luns - "
7377 -                              "%d its.\n",
7378 -                              mmc_hostname(host->mmc),
7379 -                              data->flags & MMC_DATA_READ? "read": "write",
7380 -                              since_ns(now), 1000000-timeout);
7381 +               }
7382                 if (timeout <= 0)
7383                         printk(KERN_ERR"%s: final %s to SD card still "
7384                                "running\n",
7385 @@ -1201,6 +1285,11 @@ static unsigned int sdhci_bcm2708_uhs_br
7386          return 1;
7387  }
7388  
7389 +static unsigned int sdhci_bcm2708_missing_status(struct sdhci_host *host)
7390 +{
7391 +       return 1;
7392 +}
7393 +
7394  /***************************************************************************** \
7395   *                                                                          *
7396   * Device ops                                                               *
7397 @@ -1219,7 +1308,7 @@ static struct sdhci_ops sdhci_bcm2708_op
7398  #error The BCM2708 SDHCI driver needs CONFIG_MMC_SDHCI_IO_ACCESSORS to be set
7399  #endif
7400         //.enable_dma = NULL,
7401 -       //.set_clock = NULL,
7402 +       .set_clock = sdhci_bcm2708_set_clock,
7403         .get_max_clock = sdhci_bcm2708_get_max_clock,
7404         //.get_min_clock = NULL,
7405         .get_timeout_clock = sdhci_bcm2708_get_timeout_clock,
7406 @@ -1238,6 +1327,7 @@ static struct sdhci_ops sdhci_bcm2708_op
7407         .spurious_crc_acmd51 = sdhci_bcm2708_quirk_spurious_crc,
7408         .voltage_broken = sdhci_bcm2708_quirk_voltage_broken,
7409         .uhs_broken = sdhci_bcm2708_uhs_broken,
7410 +       .missing_status = sdhci_bcm2708_missing_status,
7411  };
7412  
7413  /*****************************************************************************\
7414 @@ -1282,7 +1372,9 @@ static int __devinit sdhci_bcm2708_probe
7415         host->irq = platform_get_irq(pdev, 0);
7416  
7417         host->quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION |
7418 -                      SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK;
7419 +                      SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
7420 +                      SDHCI_QUIRK_BROKEN_TIMEOUT_VAL |
7421 +                      SDHCI_QUIRK_NONSTANDARD_CLOCK;
7422  #ifdef CONFIG_MMC_SDHCI_BCM2708_DMA
7423         host->flags = SDHCI_USE_PLATDMA;
7424  #endif
7425 @@ -1349,6 +1441,8 @@ static int __devinit sdhci_bcm2708_probe
7426             host_priv->cb_base, (unsigned)host_priv->cb_handle,
7427             host_priv->dma_chan, host_priv->dma_chan_base,
7428             host_priv->dma_irq);
7429 +
7430 +       host->mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;
7431  #endif
7432  
7433         ret = sdhci_add_host(host);
7434 --- a/drivers/mmc/host/sdhci.c
7435 +++ b/drivers/mmc/host/sdhci.c
7436 @@ -974,6 +974,12 @@ static void sdhci_send_command(struct sd
7437         if ((cmd->data != NULL) || (cmd->flags & MMC_RSP_BUSY))
7438                 mask |= SDHCI_DATA_INHIBIT;
7439  
7440 +       if(host->ops->missing_status && (cmd->opcode == MMC_SEND_STATUS)) {
7441 +               timeout = 5000; // Really obscenely large delay to send the status, due to bug in controller
7442 +                               // which might cause the STATUS command to get stuck when a data operation is in flow
7443 +               mask |= SDHCI_DATA_INHIBIT;
7444 +       }
7445 +
7446         /* We shouldn't wait for data inihibit for stop commands, even
7447            though they might use busy signaling */
7448         if (host->mrq->data && (cmd == host->mrq->data->stop))
7449 @@ -2098,7 +2104,7 @@ static void sdhci_timeout_timer(unsigned
7450  
7451         if (host->mrq) {
7452                 pr_err("%s: Timeout waiting for hardware "
7453 -                       "interrupt.\n", mmc_hostname(host->mmc));
7454 +                               "interrupt - cmd%d.\n", mmc_hostname(host->mmc), host->last_cmdop);
7455                 sdhci_dumpregs(host);
7456  
7457                 if (host->data) {
7458 @@ -3065,8 +3071,11 @@ int sdhci_add_host(struct sdhci_host *ho
7459                         mmc->caps |= MMC_CAP_MAX_CURRENT_200;
7460         }
7461  
7462 -       if(host->ops->voltage_broken)
7463 -               ocr_avail |= MMC_VDD_29_30 | MMC_VDD_30_31;
7464 +       if(host->ops->voltage_broken) {
7465 +               ocr_avail |= MMC_VDD_32_33 | MMC_VDD_33_34;
7466 +               // Cannot support UHS modes is we are stuck at 3.3V;
7467 +               mmc->caps &= ~(MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | MMC_CAP_UHS_SDR104 | MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50);
7468 +       }
7469  
7470         mmc->ocr_avail = ocr_avail;
7471         mmc->ocr_avail_sdio = ocr_avail;
7472 --- a/drivers/mmc/host/sdhci.h
7473 +++ b/drivers/mmc/host/sdhci.h
7474 @@ -291,6 +291,7 @@ struct sdhci_ops {
7475         unsigned int    (*spurious_crc_acmd51)(struct sdhci_host *host);
7476         unsigned int    (*voltage_broken)(struct sdhci_host *host);
7477         unsigned int    (*uhs_broken)(struct sdhci_host *host);
7478 +       unsigned int    (*missing_status)(struct sdhci_host *host);
7479  
7480         void    (*hw_reset)(struct sdhci_host *host);
7481  };
7482 --- a/drivers/net/usb/smsc95xx.c
7483 +++ b/drivers/net/usb/smsc95xx.c
7484 @@ -1073,6 +1073,7 @@ static int smsc95xx_bind(struct usbnet *
7485         dev->net->ethtool_ops = &smsc95xx_ethtool_ops;
7486         dev->net->flags |= IFF_MULTICAST;
7487         dev->net->hard_header_len += SMSC95XX_TX_OVERHEAD_CSUM;
7488 +       dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;
7489         return 0;
7490  }
7491  
7492 --- a/drivers/usb/gadget/Kconfig
7493 +++ b/drivers/usb/gadget/Kconfig
7494 @@ -536,28 +536,6 @@ config USB_GADGET_SUPERSPEED
7495         bool
7496         depends on USB_GADGET_DUALSPEED
7497  
7498 -config USB_GADGET_SNPS_DWC_OTG
7499 -       boolean "Synopsys Driver for DWC_otg Controller"
7500 -       depends on USB && EXPERIMENTAL
7501 -       select USB_OTG
7502 -       select USB_GADGET_DUALSPEED
7503 -       help
7504 -          Selects the Synopsys Driver for the DWC_otg Controller.
7505 -
7506 -config USB_DWC_OTG_LPM
7507 -       boolean "Enable LPM support"
7508 -       depends on USB && EXPERIMENTAL
7509 -       help
7510 -          Enables LPM support.
7511 -
7512 -config USB_GADGET_SNPS_DWC_OTG
7513 -       boolean "Synopsys Driver for DWC_otg Controller"
7514 -       depends on USB && EXPERIMENTAL
7515 -       select USB_OTG
7516 -       select USB_GADGET_DUALSPEED
7517 -       help
7518 -          Selects the Synopsys Driver for the DWC_otg Controller.
7519 -
7520  config USB_DWC_OTG_LPM
7521         boolean "Enable LPM support"
7522         depends on USB && EXPERIMENTAL
7523 --- a/drivers/usb/host/dwc_common_port/Makefile
7524 +++ b/drivers/usb/host/dwc_common_port/Makefile
7525 @@ -6,7 +6,9 @@ ifneq ($(KERNELRELEASE),)
7526  
7527  #CPPFLAGS      += -DDEBUG_MEMORY
7528  
7529 +ifeq ($(CONFIG_USB_DEBUG),y)
7530  CPPFLAGS       += -DDEBUG
7531 +endif
7532  CPPFLAGS       += -DDWC_LINUX
7533  
7534  obj-$(CONFIG_USB_DWCOTG)       += dwc_common_port_lib.o
7535 --- a/drivers/usb/host/dwc_common_port/dwc_os.h
7536 +++ b/drivers/usb/host/dwc_common_port/dwc_os.h
7537 @@ -216,6 +216,7 @@ extern void __DWC_DEBUG(char *format, ..
7538  #endif
7539  #else
7540  #define __DWC_DEBUG printk
7541 +#include <linux/kernel.h>
7542  #endif
7543  
7544  /**
7545 --- a/drivers/usb/host/dwc_otg/Makefile
7546 +++ b/drivers/usb/host/dwc_otg/Makefile
7547 @@ -9,7 +9,9 @@ ifeq ($(BUS_INTERFACE),)
7548         BUS_INTERFACE = -DPLATFORM_INTERFACE=1
7549  endif
7550  
7551 -CPPFLAGS       += -DDEBUG 
7552 +ifeq ($(CONFIG_USB_DEBUG),y)
7553 +CPPFLAGS       += -DDEBUG
7554 +endif
7555  
7556  # Use one of the following flags to compile the software in host-only or
7557  # device-only mode.
7558 --- a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c
7559 +++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c
7560 @@ -909,6 +909,10 @@ static void assign_and_init_hc(dwc_otg_h
7561                 return 0;
7562  #endif
7563  
7564 +       if (((urb->actual_length < 0) || (urb->actual_length > urb->length)) && !dwc_otg_hcd_is_pipe_in(&urb->pipe_info))
7565 +               urb->actual_length = urb->length;
7566 +
7567 +
7568         hc = DWC_CIRCLEQ_FIRST(&hcd->free_hc_list);
7569  
7570         /* Remove the host channel from the free list. */
7571 --- a/drivers/usb/host/dwc_otg/dwc_otg_hcd.h
7572 +++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.h
7573 @@ -628,7 +628,7 @@ static inline void dwc_otg_hcd_qh_remove
7574   * @return Returns the memory allocate or NULL on error. */
7575  static inline dwc_otg_qh_t *dwc_otg_hcd_qh_alloc(void)
7576  {
7577 -       return (dwc_otg_qh_t *) dwc_alloc(sizeof(dwc_otg_qh_t));
7578 +       return (dwc_otg_qh_t *) dwc_alloc_atomic(sizeof(dwc_otg_qh_t));
7579  }
7580  
7581  extern dwc_otg_qtd_t *dwc_otg_hcd_qtd_create(dwc_otg_hcd_urb_t * urb);
7582 @@ -640,7 +640,7 @@ extern int dwc_otg_hcd_qtd_add(dwc_otg_q
7583   * @return Returns the memory allocate or NULL on error. */
7584  static inline dwc_otg_qtd_t *dwc_otg_hcd_qtd_alloc(void)
7585  {
7586 -       return (dwc_otg_qtd_t *) dwc_alloc(sizeof(dwc_otg_qtd_t));
7587 +       return (dwc_otg_qtd_t *) dwc_alloc_atomic(sizeof(dwc_otg_qtd_t));
7588  }
7589  
7590  /** Frees the memory for a QTD structure.  QTD should already be removed from
7591 --- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
7592 +++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
7593 @@ -417,6 +417,9 @@ int hcd_init(
7594  
7595         hcd->regs = otg_dev->base;
7596  
7597 +       /* Integrate TT in root hub */
7598 +       hcd->has_tt = 1;
7599 +
7600         /* Initialize the DWC OTG HCD. */
7601         dwc_otg_hcd = dwc_otg_hcd_alloc_hcd();
7602         if (!dwc_otg_hcd) {
7603 @@ -668,6 +671,9 @@ static int urb_enqueue(struct usb_hcd *h
7604                                             urb->number_of_packets,
7605                                             mem_flags == GFP_ATOMIC ? 1 : 0);
7606  
7607 +       if(dwc_otg_urb == NULL)
7608 +               return -ENOMEM;
7609 +
7610          urb->hcpriv = dwc_otg_urb;
7611          
7612         dwc_otg_hcd_urb_set_pipeinfo(dwc_otg_urb, usb_pipedevice(urb->pipe),
7613 @@ -755,10 +761,12 @@ static int urb_dequeue(struct usb_hcd *h
7614                 dump_urb_info(urb, "urb_dequeue");
7615         }
7616  #endif
7617 -       dwc_otg_hcd_urb_dequeue(dwc_otg_hcd, (dwc_otg_hcd_urb_t *)urb->hcpriv);
7618 +       if(urb->hcpriv != NULL) {
7619 +               dwc_otg_hcd_urb_dequeue(dwc_otg_hcd, (dwc_otg_hcd_urb_t *)urb->hcpriv);
7620  
7621 -       dwc_free(urb->hcpriv);
7622 -       urb->hcpriv = NULL;
7623 +               urb->hcpriv = NULL;
7624 +               dwc_free(urb->hcpriv);
7625 +       }
7626  
7627         /* Higher layer software sets URB status. */
7628  #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30))
7629 --- a/drivers/video/bcm2708_fb.c
7630 +++ b/drivers/video/bcm2708_fb.c
7631 @@ -7,14 +7,17 @@
7632   * License.  See the file COPYING in the main directory of this archive
7633   * for more details.
7634   *
7635 - *  Broadcom simple framebuffer driver
7636 + * Broadcom simple framebuffer driver
7637 + *
7638 + * This file is derived from cirrusfb.c
7639 + * Copyright 1999-2001 Jeff Garzik <jgarzik@pobox.com>
7640 + *
7641   */
7642  #include <linux/module.h>
7643  #include <linux/kernel.h>
7644  #include <linux/errno.h>
7645  #include <linux/string.h>
7646  #include <linux/slab.h>
7647 -#include <linux/delay.h>
7648  #include <linux/mm.h>
7649  #include <linux/fb.h>
7650  #include <linux/init.h>
7651 @@ -22,6 +25,8 @@
7652  #include <linux/list.h>
7653  #include <linux/platform_device.h>
7654  #include <linux/clk.h>
7655 +#include <linux/printk.h>
7656 +#include <linux/console.h>
7657  
7658  #include <mach/platform.h>
7659  #include <mach/vcio.h>
7660 @@ -38,26 +43,24 @@ static const char *bcm2708_name = "BCM27
7661  /* this data structure describes each frame buffer device we find */
7662  
7663  struct fbinfo_s {
7664 -   int xres, yres, xres_virtual, yres_virtual;
7665 -   int pitch, bpp;
7666 -   int xoffset, yoffset;
7667 -   int base;
7668 -   int screen_size;
7669 +       u32 xres, yres, xres_virtual, yres_virtual;
7670 +       u32 pitch, bpp;
7671 +       u32 xoffset, yoffset;
7672 +       u32 base;
7673 +       u32 screen_size;
7674  };
7675  
7676  struct bcm2708_fb {
7677 -       struct fb_info          fb;
7678 -       struct platform_device  *dev;
7679 -       void __iomem            *regs;
7680 -        volatile struct fbinfo_s         *info;
7681 -        dma_addr_t              dma;
7682 -       u32                     cmap[16];
7683 +       struct fb_info fb;
7684 +       struct platform_device *dev;
7685 +       struct fbinfo_s *info;
7686 +       dma_addr_t dma;
7687 +       u32 cmap[16];
7688  };
7689  
7690  #define to_bcm2708(info)       container_of(info, struct bcm2708_fb, fb)
7691  
7692 -static int
7693 -bcm2708_fb_set_bitfields(struct fb_var_screeninfo *var)
7694 +static int bcm2708_fb_set_bitfields(struct fb_var_screeninfo *var)
7695  {
7696         int ret = 0;
7697  
7698 @@ -72,12 +75,12 @@ bcm2708_fb_set_bitfields(struct fb_var_s
7699         case 2:
7700         case 4:
7701         case 8:
7702 -               var->red.length         = var->bits_per_pixel;
7703 -               var->red.offset         = 0;
7704 -               var->green.length       = var->bits_per_pixel;
7705 -               var->green.offset       = 0;
7706 -               var->blue.length        = var->bits_per_pixel;
7707 -               var->blue.offset        = 0;
7708 +               var->red.length = var->bits_per_pixel;
7709 +               var->red.offset = 0;
7710 +               var->green.length = var->bits_per_pixel;
7711 +               var->green.offset = 0;
7712 +               var->blue.length = var->bits_per_pixel;
7713 +               var->blue.offset = 0;
7714                 break;
7715         case 16:
7716                 var->red.length = 5;
7717 @@ -89,10 +92,16 @@ bcm2708_fb_set_bitfields(struct fb_var_s
7718                 if (var->green.length != 5 && var->green.length != 6)
7719                         var->green.length = 6;
7720                 break;
7721 +       case 24:
7722 +               var->red.length = 8;
7723 +               var->blue.length = 8;
7724 +               var->green.length = 8;
7725 +               break;
7726         case 32:
7727 -               var->red.length         = 8;
7728 -               var->green.length       = 8;
7729 -               var->blue.length        = 8;
7730 +               var->red.length = 8;
7731 +               var->green.length = 8;
7732 +               var->blue.length = 8;
7733 +               var->transp.length = 8;
7734                 break;
7735         default:
7736                 ret = -EINVAL;
7737 @@ -104,134 +113,148 @@ bcm2708_fb_set_bitfields(struct fb_var_s
7738          * encoded in the pixel data.  Calculate their position from
7739          * the bitfield length defined above.
7740          */
7741 -       if (ret == 0 && var->bits_per_pixel >= 16) {
7742 +       if (ret == 0 && var->bits_per_pixel >= 24) {
7743 +               var->red.offset = 0;
7744 +               var->green.offset = var->red.offset + var->red.length;
7745 +               var->blue.offset = var->green.offset + var->green.length;
7746 +               var->transp.offset = var->blue.offset + var->blue.length;
7747 +       } else if (ret == 0 && var->bits_per_pixel >= 16) {
7748                 var->blue.offset = 0;
7749                 var->green.offset = var->blue.offset + var->blue.length;
7750                 var->red.offset = var->green.offset + var->green.length;
7751 +               var->transp.offset = var->red.offset + var->red.length;
7752         }
7753  
7754         return ret;
7755  }
7756  
7757 -static int bcm2708_fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
7758 +static int bcm2708_fb_check_var(struct fb_var_screeninfo *var,
7759 +                               struct fb_info *info)
7760  {
7761 +       /* info input, var output */
7762 +       int yres;
7763 +       /* memory size in pixels */
7764 +       unsigned pixels = info->screen_size * 8 / var->bits_per_pixel;
7765 +
7766 +       /* info input, var output */
7767 +       pr_info("bcm2708_fb_check_var info(%p) %dx%d (%dx%d), %d, %d\n", info,
7768 +               info->var.xres, info->var.yres, info->var.xres_virtual,
7769 +               info->var.yres_virtual, (int)info->screen_size,
7770 +               info->var.bits_per_pixel);
7771 +       pr_info("bcm2708_fb_check_var var(%p) %dx%d (%dx%d), %d, %d\n", var,
7772 +               var->xres, var->yres, var->xres_virtual, var->yres_virtual,
7773 +               var->bits_per_pixel, pixels);
7774 +
7775 +       if (!var->bits_per_pixel)
7776 +               var->bits_per_pixel = 16;
7777 +
7778 +       if (bcm2708_fb_set_bitfields(var) != 0) {
7779 +               pr_err("bcm2708_fb_check_var: invalid bits_per_pixel %d\n",
7780 +                    var->bits_per_pixel);
7781 +               return -EINVAL;
7782 +       }
7783  
7784 -         // info input, var output
7785 -         int yres;
7786 -         /* memory size in pixels */
7787 -         unsigned pixels = info->screen_size * 8 / var->bits_per_pixel;
7788 -
7789 -         // info input, var output
7790 -        printk(KERN_ERR "bcm2708_fb_check_var info(%p) %dx%d (%dx%d), %d, %d\n", info, info->var.xres, info->var.yres, info->var.xres_virtual, info->var.yres_virtual, (int)info->screen_size, info->var.bits_per_pixel );
7791 -        printk(KERN_ERR "bcm2708_fb_check_var var(%p) %dx%d (%dx%d), %d, %d\n", var, var->xres, var->yres, var->xres_virtual, var->yres_virtual, var->bits_per_pixel, pixels);
7792 -
7793 -         if (!var->bits_per_pixel) var->bits_per_pixel = 16;
7794 -
7795 -         if (0 && var->bits_per_pixel != 16 && var->bits_per_pixel != 32) {
7796 -                 printk(KERN_ERR "bcm2708_fb_check_var: ERROR: bits_per_pixel=%d\n", var->bits_per_pixel);
7797 -                 return -EINVAL;
7798 -         }
7799 -
7800 -         bcm2708_fb_set_bitfields(var);
7801 -
7802 -         if (var->xres_virtual < var->xres)
7803 -                 var->xres_virtual = var->xres;
7804 -         /* use highest possible virtual resolution */
7805 -         if (var->yres_virtual == -1) {
7806 -                 var->yres_virtual = 480; //pixels / var->xres_virtual;
7807 -
7808 -                 printk(KERN_ERR
7809 -                          "bcm2708_fb_check_var: virtual resolution set to maximum of %dx%d\n",
7810 -                          var->xres_virtual, var->yres_virtual);
7811 -         }
7812 -         if (var->yres_virtual < var->yres)
7813 -                 var->yres_virtual = var->yres;
7814 -
7815 -         #if 0
7816 -         if (var->xres_virtual * var->yres_virtual > pixels) {
7817 -                 printk(KERN_ERR "bcm2708_fb_check_var: mode %dx%dx%d rejected... "
7818 -                       "virtual resolution too high to fit into video memory!\n",
7819 -                         var->xres_virtual, var->yres_virtual,
7820 -                         var->bits_per_pixel);
7821 -                 return -EINVAL;
7822 -         }
7823 -         #endif
7824 -         if (var->xoffset < 0)
7825 -                 var->xoffset = 0;
7826 -         if (var->yoffset < 0)
7827 -                 var->yoffset = 0;
7828 -
7829 -         /* truncate xoffset and yoffset to maximum if too high */
7830 -         if (var->xoffset > var->xres_virtual - var->xres)
7831 -                 var->xoffset = var->xres_virtual - var->xres - 1;
7832 -         if (var->yoffset > var->yres_virtual - var->yres)
7833 -                 var->yoffset = var->yres_virtual - var->yres - 1;
7834 -
7835 -         var->red.msb_right =
7836 -             var->green.msb_right =
7837 -             var->blue.msb_right =
7838 -             var->transp.offset =
7839 -             var->transp.length =
7840 -             var->transp.msb_right = 0;
7841 -
7842 -         yres = var->yres;
7843 -         if (var->vmode & FB_VMODE_DOUBLE)
7844 -                 yres *= 2;
7845 -         else if (var->vmode & FB_VMODE_INTERLACED)
7846 -                 yres = (yres + 1) / 2;
7847 -
7848 -         if (yres > 1200) {
7849 -                 printk(KERN_ERR "bcm2708_fb_check_var: ERROR: VerticalTotal >= 1200; "
7850 -                         "special treatment required! (TODO)\n");
7851 -                 return -EINVAL;
7852 -         }
7853  
7854 -         //if (cirrusfb_check_pixclock(var, info))
7855 -         //        return -EINVAL;
7856 +       if (var->xres_virtual < var->xres)
7857 +               var->xres_virtual = var->xres;
7858 +       /* use highest possible virtual resolution */
7859 +       if (var->yres_virtual == -1) {
7860 +               var->yres_virtual = 480;
7861 +
7862 +               pr_err
7863 +                   ("bcm2708_fb_check_var: virtual resolution set to maximum of %dx%d\n",
7864 +                    var->xres_virtual, var->yres_virtual);
7865 +       }
7866 +       if (var->yres_virtual < var->yres)
7867 +               var->yres_virtual = var->yres;
7868  
7869 -         //if (!is_laguna(cinfo))
7870 -         //        var->accel_flags = FB_ACCELF_TEXT;
7871 +       if (var->xoffset < 0)
7872 +               var->xoffset = 0;
7873 +       if (var->yoffset < 0)
7874 +               var->yoffset = 0;
7875 +
7876 +       /* truncate xoffset and yoffset to maximum if too high */
7877 +       if (var->xoffset > var->xres_virtual - var->xres)
7878 +               var->xoffset = var->xres_virtual - var->xres - 1;
7879 +       if (var->yoffset > var->yres_virtual - var->yres)
7880 +               var->yoffset = var->yres_virtual - var->yres - 1;
7881 +
7882 +       yres = var->yres;
7883 +       if (var->vmode & FB_VMODE_DOUBLE)
7884 +               yres *= 2;
7885 +       else if (var->vmode & FB_VMODE_INTERLACED)
7886 +               yres = (yres + 1) / 2;
7887 +
7888 +       if (yres > 1200) {
7889 +               pr_err("bcm2708_fb_check_var: ERROR: VerticalTotal >= 1200; "
7890 +                      "special treatment required! (TODO)\n");
7891 +               return -EINVAL;
7892 +       }
7893  
7894 -         return 0;
7895 +       return 0;
7896  }
7897  
7898  static int bcm2708_fb_set_par(struct fb_info *info)
7899  {
7900 -        unsigned val = 0;
7901 +       uint32_t val = 0;
7902         struct bcm2708_fb *fb = to_bcm2708(info);
7903 -        volatile struct fbinfo_s *fbinfo = fb->info;
7904 -        fbinfo->xres = info->var.xres;
7905 -        fbinfo->yres = info->var.yres;
7906 -        fbinfo->xres_virtual = info->var.xres_virtual;
7907 -        fbinfo->yres_virtual = info->var.yres_virtual;
7908 -        fbinfo->bpp = info->var.bits_per_pixel;
7909 -        fbinfo->xoffset = info->var.xoffset;
7910 -        fbinfo->yoffset = info->var.yoffset;
7911 -        fbinfo->base = 0; // filled in by VC
7912 -        fbinfo->pitch = 0; // filled in by VC
7913 +       volatile struct fbinfo_s *fbinfo = fb->info;
7914 +       fbinfo->xres = info->var.xres;
7915 +       fbinfo->yres = info->var.yres;
7916 +       fbinfo->xres_virtual = info->var.xres_virtual;
7917 +       fbinfo->yres_virtual = info->var.yres_virtual;
7918 +       fbinfo->bpp = info->var.bits_per_pixel;
7919 +       fbinfo->xoffset = info->var.xoffset;
7920 +       fbinfo->yoffset = info->var.yoffset;
7921 +       fbinfo->base = 0;       /* filled in by VC */
7922 +       fbinfo->pitch = 0;      /* filled in by VC */
7923 +
7924 +       pr_info("bcm2708_fb_set_par info(%p) %dx%d (%dx%d), %d, %d\n", info,
7925 +               info->var.xres, info->var.yres, info->var.xres_virtual,
7926 +               info->var.yres_virtual, (int)info->screen_size,
7927 +               info->var.bits_per_pixel);
7928  
7929 -        printk(KERN_ERR "bcm2708_fb_set_par info(%p) %dx%d (%dx%d), %d, %d\n", info, info->var.xres, info->var.yres, info->var.xres_virtual, info->var.yres_virtual, (int)info->screen_size, info->var.bits_per_pixel );
7930 +       /* ensure last write to fbinfo is visible to GPU */
7931 +       wmb();
7932  
7933 -       // inform vc about new framebuffer
7934 +       /* inform vc about new framebuffer */
7935         bcm_mailbox_write(MBOX_CHAN_FB, fb->dma);
7936  
7937 -       // wait for response
7938 -        bcm_mailbox_read(MBOX_CHAN_FB, &val);
7939 -
7940 -       fb->fb.fix.line_length = fbinfo->pitch;
7941 +       /* TODO: replace fb driver with vchiq version */
7942 +       /* wait for response */
7943 +       bcm_mailbox_read(MBOX_CHAN_FB, &val);
7944 +
7945 +       /* ensure GPU writes are visible to us */
7946 +       rmb();
7947 +
7948 +        if (val == 0) {
7949 +               fb->fb.fix.line_length = fbinfo->pitch;
7950 +
7951 +               if (info->var.bits_per_pixel <= 8)
7952 +                       fb->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR;
7953 +               else
7954 +                       fb->fb.fix.visual = FB_VISUAL_TRUECOLOR;
7955 +
7956 +               fb->fb.fix.smem_start = fbinfo->base;
7957 +               fb->fb.fix.smem_len = fbinfo->pitch * fbinfo->yres_virtual;
7958 +               fb->fb.screen_size = fbinfo->screen_size;
7959 +               if (fb->fb.screen_base)
7960 +                       iounmap(fb->fb.screen_base);
7961 +               fb->fb.screen_base =
7962 +                       (void *)ioremap_wc(fb->fb.fix.smem_start, fb->fb.screen_size);
7963 +               if (!fb->fb.screen_base) {
7964 +                       /* the console may currently be locked */
7965 +                       console_trylock();
7966 +                       console_unlock();
7967  
7968 -       if (info->var.bits_per_pixel <= 8)
7969 -               fb->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR;
7970 -       else
7971 -               fb->fb.fix.visual = FB_VISUAL_TRUECOLOR;
7972 -
7973 -        fb->fb.fix.smem_start = fbinfo->base;
7974 -        fb->fb.fix.smem_len = fbinfo->pitch * fbinfo->yres_virtual;
7975 -        fb->fb.screen_size = fbinfo->screen_size;
7976 -        fb->fb.screen_base = (void *)ioremap_nocache(fb->fb.fix.smem_start, fb->fb.screen_size);
7977 -
7978 -       printk(KERN_ERR "BCM2708FB: start = %p,%p,%p width=%d, height=%d, bpp=%d, pitch=%d\n",
7979 -              (void *)fb->fb.screen_base, (void *)fb->fb.fix.smem_start, (void *)val, fbinfo->xres, fbinfo->yres, fbinfo->bpp, fbinfo->pitch);
7980 +                       BUG();          /* what can we do here */
7981 +               }
7982 +       }
7983 +       pr_info
7984 +           ("BCM2708FB: start = %p,%p width=%d, height=%d, bpp=%d, pitch=%d size=%d success=%d\n",
7985 +            (void *)fb->fb.screen_base, (void *)fb->fb.fix.smem_start,
7986 +            fbinfo->xres, fbinfo->yres, fbinfo->bpp,
7987 +            fbinfo->pitch, (int)fb->fb.screen_size, val);
7988  
7989         return val;
7990  }
7991 @@ -243,58 +266,62 @@ static inline u32 convert_bitfield(int v
7992         return (val >> (16 - bf->length) & mask) << bf->offset;
7993  }
7994  
7995 -static int bcm2708_fb_setcolreg(unsigned int regno, unsigned int red, unsigned int green,
7996 -                unsigned int blue, unsigned int transp, struct fb_info *info)
7997 +static int bcm2708_fb_setcolreg(unsigned int regno, unsigned int red,
7998 +                               unsigned int green, unsigned int blue,
7999 +                               unsigned int transp, struct fb_info *info)
8000  {
8001         struct bcm2708_fb *fb = to_bcm2708(info);
8002  
8003         if (regno < 16)
8004                 fb->cmap[regno] = convert_bitfield(transp, &fb->fb.var.transp) |
8005 -                                 convert_bitfield(blue, &fb->fb.var.blue) |
8006 -                                 convert_bitfield(green, &fb->fb.var.green) |
8007 -                                 convert_bitfield(red, &fb->fb.var.red);
8008 +                   convert_bitfield(blue, &fb->fb.var.blue) |
8009 +                   convert_bitfield(green, &fb->fb.var.green) |
8010 +                   convert_bitfield(red, &fb->fb.var.red);
8011  
8012         return regno > 255;
8013  }
8014  
8015  static int bcm2708_fb_blank(int blank_mode, struct fb_info *info)
8016  {
8017 -//printk(KERN_ERR "bcm2708_fb_blank\n");
8018 +       /*pr_info("bcm2708_fb_blank\n"); */
8019         return -1;
8020  }
8021  
8022 -static void bcm2708_fb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
8023 +static void bcm2708_fb_fillrect(struct fb_info *info,
8024 +                               const struct fb_fillrect *rect)
8025  {
8026 -// (is called) printk(KERN_ERR "bcm2708_fb_fillrect\n");
8027 +       /* (is called) pr_info("bcm2708_fb_fillrect\n"); */
8028         cfb_fillrect(info, rect);
8029  }
8030  
8031 -static void bcm2708_fb_copyarea(struct fb_info *info, const struct fb_copyarea *region)
8032 +static void bcm2708_fb_copyarea(struct fb_info *info,
8033 +                               const struct fb_copyarea *region)
8034  {
8035 -//printk(KERN_ERR "bcm2708_fb_copyarea\n");
8036 +       /*pr_info("bcm2708_fb_copyarea\n"); */
8037         cfb_copyarea(info, region);
8038  }
8039  
8040 -static void bcm2708_fb_imageblit(struct fb_info *info, const struct fb_image *image)
8041 +static void bcm2708_fb_imageblit(struct fb_info *info,
8042 +                                const struct fb_image *image)
8043  {
8044 -// (is called) printk(KERN_ERR "bcm2708_fb_imageblit\n");
8045 +       /* (is called) pr_info("bcm2708_fb_imageblit\n"); */
8046         cfb_imageblit(info, image);
8047  }
8048  
8049  static struct fb_ops bcm2708_fb_ops = {
8050 -       .owner          = THIS_MODULE,
8051 -       .fb_check_var   = bcm2708_fb_check_var,
8052 -       .fb_set_par     = bcm2708_fb_set_par,
8053 -       .fb_setcolreg   = bcm2708_fb_setcolreg,
8054 -       .fb_blank       = bcm2708_fb_blank,
8055 -       .fb_fillrect    = bcm2708_fb_fillrect,
8056 -       .fb_copyarea    = bcm2708_fb_copyarea,
8057 -       .fb_imageblit   = bcm2708_fb_imageblit,
8058 +       .owner = THIS_MODULE,
8059 +       .fb_check_var = bcm2708_fb_check_var,
8060 +       .fb_set_par = bcm2708_fb_set_par,
8061 +       .fb_setcolreg = bcm2708_fb_setcolreg,
8062 +       .fb_blank = bcm2708_fb_blank,
8063 +       .fb_fillrect = bcm2708_fb_fillrect,
8064 +       .fb_copyarea = bcm2708_fb_copyarea,
8065 +       .fb_imageblit = bcm2708_fb_imageblit,
8066  };
8067  
8068 -static int FBWIDTH =800; /* module parameter */
8069 -static int FBHEIGHT =480; /* module parameter */
8070 -
8071 +static int fbwidth = 800;      /* module parameter */
8072 +static int fbheight = 480;     /* module parameter */
8073 +static int fbdepth = 16;       /* module parameter */
8074  
8075  static int bcm2708_fb_register(struct bcm2708_fb *fb)
8076  {
8077 @@ -302,45 +329,47 @@ static int bcm2708_fb_register(struct bc
8078         dma_addr_t dma;
8079         void *mem;
8080  
8081 -       mem = dma_alloc_coherent(NULL, PAGE_ALIGN(sizeof(*fb->info)), &dma, GFP_KERNEL);
8082 +       mem =
8083 +           dma_alloc_coherent(NULL, PAGE_ALIGN(sizeof(*fb->info)), &dma,
8084 +                              GFP_KERNEL);
8085  
8086         if (NULL == mem) {
8087 -               printk(KERN_ERR ": unable to allocate fbinfo buffer\n");
8088 +               pr_err(": unable to allocate fbinfo buffer\n");
8089                 ret = -ENOMEM;
8090         } else {
8091                 fb->info = (struct fbinfo_s *)mem;
8092 -                fb->dma = dma;
8093 -        }
8094 -       fb->fb.fbops            = &bcm2708_fb_ops;
8095 -       fb->fb.flags            = FBINFO_FLAG_DEFAULT | FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT |  FBINFO_HWACCEL_IMAGEBLIT;
8096 -       fb->fb.pseudo_palette   = fb->cmap;
8097 +               fb->dma = dma;
8098 +       }
8099 +       fb->fb.fbops = &bcm2708_fb_ops;
8100 +       fb->fb.flags = FBINFO_FLAG_DEFAULT;
8101 +       fb->fb.pseudo_palette = fb->cmap;
8102  
8103         strncpy(fb->fb.fix.id, bcm2708_name, sizeof(fb->fb.fix.id));
8104 -       fb->fb.fix.type         = FB_TYPE_PACKED_PIXELS;
8105 -       fb->fb.fix.type_aux     = 0;
8106 -       fb->fb.fix.xpanstep     = 0;
8107 -       fb->fb.fix.ypanstep     = 0;
8108 -       fb->fb.fix.ywrapstep    = 0;
8109 -       fb->fb.fix.accel        = FB_ACCEL_NONE;
8110 -
8111 -       fb->fb.var.xres         = FBWIDTH;
8112 -       fb->fb.var.yres         = FBHEIGHT;
8113 -       fb->fb.var.xres_virtual = FBWIDTH;
8114 -       fb->fb.var.yres_virtual = FBHEIGHT;
8115 -       fb->fb.var.bits_per_pixel = 16;
8116 -       fb->fb.var.vmode        = FB_VMODE_NONINTERLACED;
8117 -       fb->fb.var.activate     = FB_ACTIVATE_NOW;
8118 -       fb->fb.var.nonstd       = 0;
8119 -       fb->fb.var.height       = FBWIDTH;
8120 -       fb->fb.var.width        = FBHEIGHT;
8121 -       fb->fb.var.accel_flags  = 0;
8122 -
8123 -       fb->fb.monspecs.hfmin   = 0;
8124 -       fb->fb.monspecs.hfmax   = 100000;
8125 -       fb->fb.monspecs.vfmin   = 0;
8126 -       fb->fb.monspecs.vfmax   = 400;
8127 +       fb->fb.fix.type = FB_TYPE_PACKED_PIXELS;
8128 +       fb->fb.fix.type_aux = 0;
8129 +       fb->fb.fix.xpanstep = 0;
8130 +       fb->fb.fix.ypanstep = 0;
8131 +       fb->fb.fix.ywrapstep = 0;
8132 +       fb->fb.fix.accel = FB_ACCEL_NONE;
8133 +
8134 +       fb->fb.var.xres = fbwidth;
8135 +       fb->fb.var.yres = fbheight;
8136 +       fb->fb.var.xres_virtual = fbwidth;
8137 +       fb->fb.var.yres_virtual = fbheight;
8138 +       fb->fb.var.bits_per_pixel = fbdepth;
8139 +       fb->fb.var.vmode = FB_VMODE_NONINTERLACED;
8140 +       fb->fb.var.activate = FB_ACTIVATE_NOW;
8141 +       fb->fb.var.nonstd = 0;
8142 +       fb->fb.var.height = fbwidth;
8143 +       fb->fb.var.width = fbheight;
8144 +       fb->fb.var.accel_flags = 0;
8145 +
8146 +       fb->fb.monspecs.hfmin = 0;
8147 +       fb->fb.monspecs.hfmax = 100000;
8148 +       fb->fb.monspecs.vfmin = 0;
8149 +       fb->fb.monspecs.vfmax = 400;
8150         fb->fb.monspecs.dclkmin = 1000000;
8151 -       fb->fb.monspecs.dclkmax = 100000000;
8152 +       fb->fb.monspecs.dclkmax = 100000000;
8153  
8154         bcm2708_fb_set_bitfields(&fb->fb.var);
8155  
8156 @@ -350,17 +379,16 @@ static int bcm2708_fb_register(struct bc
8157  
8158         fb_set_var(&fb->fb, &fb->fb.var);
8159  
8160 -       printk(KERN_INFO "BCM2708FB: registering framebuffer (%d, %d)\n", FBWIDTH, FBHEIGHT);
8161 +       pr_info("BCM2708FB: registering framebuffer (%dx%d@%d)\n", fbwidth,
8162 +               fbheight, fbdepth);
8163  
8164         ret = register_framebuffer(&fb->fb);
8165 -       printk(KERN_ERR "BCM2708FB: register framebuffer (%d)\n", ret);
8166 +       pr_info("BCM2708FB: register framebuffer (%d)\n", ret);
8167         if (ret == 0)
8168                 goto out;
8169  
8170 -       printk(KERN_ERR "BCM2708FB: cannot register framebuffer (%d)\n", ret);
8171 -
8172 -       iounmap(fb->regs);
8173 - out:
8174 +       pr_info("BCM2708FB: cannot register framebuffer (%d)\n", ret);
8175 +out:
8176         return ret;
8177  }
8178  
8179 @@ -371,7 +399,8 @@ static int bcm2708_fb_probe(struct platf
8180  
8181         fb = kmalloc(sizeof(struct bcm2708_fb), GFP_KERNEL);
8182         if (!fb) {
8183 -               dev_err(&dev->dev, "could not allocate new bcm2708_fb struct\n");
8184 +               dev_err(&dev->dev,
8185 +                       "could not allocate new bcm2708_fb struct\n");
8186                 ret = -ENOMEM;
8187                 goto free_region;
8188         }
8189 @@ -386,9 +415,9 @@ static int bcm2708_fb_probe(struct platf
8190         }
8191  
8192         kfree(fb);
8193 - free_region:
8194 +free_region:
8195         dev_err(&dev->dev, "probe failed, err %d\n", ret);
8196 - out:
8197 +out:
8198         return ret;
8199  }
8200  
8201 @@ -398,22 +427,24 @@ static int bcm2708_fb_remove(struct plat
8202  
8203         platform_set_drvdata(dev, NULL);
8204  
8205 +       if (fb->fb.screen_base)
8206 +               iounmap(fb->fb.screen_base);
8207         unregister_framebuffer(&fb->fb);
8208 -       iounmap(fb->regs);
8209  
8210 -        dma_free_coherent(NULL, PAGE_ALIGN(sizeof(*fb->info)), (void *)fb->info, fb->dma);
8211 +       dma_free_coherent(NULL, PAGE_ALIGN(sizeof(*fb->info)), (void *)fb->info,
8212 +                         fb->dma);
8213         kfree(fb);
8214  
8215         return 0;
8216  }
8217  
8218  static struct platform_driver bcm2708_fb_driver = {
8219 -       .probe          = bcm2708_fb_probe,
8220 -       .remove         = bcm2708_fb_remove,
8221 -       .driver         = {
8222 -               .name   = DRIVER_NAME,
8223 -               .owner  = THIS_MODULE,
8224 -       },
8225 +       .probe = bcm2708_fb_probe,
8226 +       .remove = bcm2708_fb_remove,
8227 +       .driver = {
8228 +                  .name = DRIVER_NAME,
8229 +                  .owner = THIS_MODULE,
8230 +                  },
8231  };
8232  
8233  static int __init bcm2708_fb_init(void)
8234 @@ -430,11 +461,13 @@ static void __exit bcm2708_fb_exit(void)
8235  
8236  module_exit(bcm2708_fb_exit);
8237  
8238 -module_param(FBWIDTH, int, 0644);
8239 -module_param(FBHEIGHT, int, 0644);
8240 +module_param(fbwidth, int, 0644);
8241 +module_param(fbheight, int, 0644);
8242 +module_param(fbdepth, int, 0644);
8243  
8244  MODULE_DESCRIPTION("BCM2708 framebuffer driver");
8245  MODULE_LICENSE("GPL");
8246  
8247 -MODULE_PARM_DESC(FBWIDTH, "Width of ARM Framebuffer");
8248 -MODULE_PARM_DESC(FBHEIGHT, "Height of ARM Framebuffer");
8249 +MODULE_PARM_DESC(fbwidth, "Width of ARM Framebuffer");
8250 +MODULE_PARM_DESC(fbheight, "Height of ARM Framebuffer");
8251 +MODULE_PARM_DESC(fbdepth, "Bit depth of ARM Framebuffer");
8252 --- a/sound/arm/Kconfig
8253 +++ b/sound/arm/Kconfig
8254 @@ -39,5 +39,12 @@ config SND_PXA2XX_AC97
8255           Say Y or M if you want to support any AC97 codec attached to
8256           the PXA2xx AC97 interface.
8257  
8258 +config SND_BCM2835
8259 +       tristate "BCM2835 ALSA driver"
8260 +       depends on ARCH_BCM2708 && SND
8261 +       select SND_PCM
8262 +       help
8263 +         Say Y or M if you want to support BCM2835 Alsa pcm card driver
8264 +
8265  endif  # SND_ARM
8266  
8267 --- a/sound/arm/Makefile
8268 +++ b/sound/arm/Makefile
8269 @@ -14,3 +14,9 @@ snd-pxa2xx-lib-$(CONFIG_SND_PXA2XX_LIB_A
8270  
8271  obj-$(CONFIG_SND_PXA2XX_AC97)  += snd-pxa2xx-ac97.o
8272  snd-pxa2xx-ac97-objs           := pxa2xx-ac97.o
8273 +
8274 +obj-$(CONFIG_SND_BCM2835)      += snd-bcm2835.o
8275 +snd-bcm2835-objs               := bcm2835.o bcm2835-ctl.o bcm2835-pcm.o bcm2835-vchiq.o
8276 +
8277 +EXTRA_CFLAGS += -Idrivers/misc/vc04_services -Idrivers/misc/vc04_services/interface/vcos/linuxkernel -D__VCCOREVER__=0x04000000
8278 +
8279 --- /dev/null
8280 +++ b/sound/arm/bcm2835-ctl.c
8281 @@ -0,0 +1,172 @@
8282 +/*****************************************************************************
8283 +* Copyright 2011 Broadcom Corporation.  All rights reserved.
8284 +*
8285 +* Unless you and Broadcom execute a separate written software license
8286 +* agreement governing use of this software, this software is licensed to you
8287 +* under the terms of the GNU General Public License version 2, available at
8288 +* http://www.broadcom.com/licenses/GPLv2.php (the "GPL").
8289 +*      
8290 +* Notwithstanding the above, under no circumstances may you combine this
8291 +* software in any way with any other Broadcom software provided under a
8292 +* license other than the GPL, without Broadcom's express prior written
8293 +* consent.
8294 +*****************************************************************************/
8295 +
8296 +#include <linux/platform_device.h>
8297 +#include <linux/init.h>
8298 +#include <linux/io.h>
8299 +#include <linux/jiffies.h>
8300 +#include <linux/slab.h>
8301 +#include <linux/time.h>
8302 +#include <linux/wait.h>
8303 +#include <linux/delay.h>
8304 +#include <linux/moduleparam.h>
8305 +#include <linux/sched.h>
8306 +
8307 +#include <sound/core.h>
8308 +#include <sound/control.h>
8309 +#include <sound/pcm.h>
8310 +#include <sound/pcm_params.h>
8311 +#include <sound/rawmidi.h>
8312 +#include <sound/initval.h>
8313 +#include <sound/tlv.h>
8314 +
8315 +#include "bcm2835.h"
8316 +
8317 +static int snd_bcm2835_ctl_info(struct snd_kcontrol *kcontrol,
8318 +                               struct snd_ctl_elem_info *uinfo)
8319 +{
8320 +       if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) {
8321 +               uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
8322 +               uinfo->count = 1;
8323 +               uinfo->value.integer.min = -10240;
8324 +               uinfo->value.integer.max = 2303;
8325 +       } else if (kcontrol->private_value == PCM_PLAYBACK_MUTE) {
8326 +               uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
8327 +               uinfo->count = 1;
8328 +               uinfo->value.integer.min = 0;
8329 +               uinfo->value.integer.max = 1;
8330 +       } else if (kcontrol->private_value == PCM_PLAYBACK_DEVICE) {
8331 +               uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
8332 +               uinfo->count = 1;
8333 +               uinfo->value.integer.min = 0;
8334 +               uinfo->value.integer.max = AUDIO_DEST_MAX-0;
8335 +       }
8336 +
8337 +       return 0;
8338 +}
8339 +
8340 +static int snd_bcm2835_ctl_get(struct snd_kcontrol *kcontrol,
8341 +                              struct snd_ctl_elem_value *ucontrol)
8342 +{
8343 +       struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol);
8344 +
8345 +       BUG_ON(!chip && !(chip->avail_substreams & AVAIL_SUBSTREAMS_MASK));
8346 +
8347 +       if (kcontrol->private_value == PCM_PLAYBACK_VOLUME)
8348 +               ucontrol->value.integer.value[0] = chip->volume;
8349 +       else if (kcontrol->private_value == PCM_PLAYBACK_MUTE)
8350 +               ucontrol->value.integer.value[0] = chip->mute;
8351 +       else if (kcontrol->private_value == PCM_PLAYBACK_DEVICE)
8352 +               ucontrol->value.integer.value[0] = chip->dest;
8353 +
8354 +       return 0;
8355 +}
8356 +
8357 +static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol,
8358 +                              struct snd_ctl_elem_value *ucontrol)
8359 +{
8360 +       struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol);
8361 +       int changed = 0;
8362 +
8363 +       if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) {
8364 +               if (chip->mute) {
8365 +                       chip->mute = 0;
8366 +                       changed = 1;
8367 +               }
8368 +               if (changed
8369 +                   || (ucontrol->value.integer.value[0] != chip->volume)) {
8370 +                       int atten;
8371 +
8372 +                       chip->volume = ucontrol->value.integer.value[0];
8373 +                       changed = 1;
8374 +                       atten = -((chip->volume << 8) / 100);
8375 +                       chip->volume = atten;
8376 +               }
8377 +
8378 +       } else if (kcontrol->private_value == PCM_PLAYBACK_MUTE) {
8379 +               /* Not implemented */
8380 +               if (ucontrol->value.integer.value[0] != chip->mute) {
8381 +                       chip->mute = ucontrol->value.integer.value[0];
8382 +                       changed = 0;
8383 +               }
8384 +       } else if (kcontrol->private_value == PCM_PLAYBACK_DEVICE) {
8385 +               if (ucontrol->value.integer.value[0] != chip->dest) {
8386 +                       chip->dest = ucontrol->value.integer.value[0];
8387 +                       changed = 1;
8388 +               }
8389 +       }
8390 +
8391 +       if (changed) {
8392 +               if (bcm2835_audio_set_ctls(chip))
8393 +                       printk(KERN_ERR "Failed to set ALSA controls..\n");
8394 +       }
8395 +
8396 +       return changed;
8397 +}
8398 +
8399 +static DECLARE_TLV_DB_SCALE(snd_bcm2835_db_scale, -10240, 1, 1);
8400 +
8401 +static struct snd_kcontrol_new snd_bcm2835_ctl[] __devinitdata = {
8402 +       {
8403 +        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8404 +        .name = "PCM Playback Volume",
8405 +        .index = 0,
8406 +        .access =
8407 +        SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE,
8408 +        .private_value = PCM_PLAYBACK_VOLUME,
8409 +        .info = snd_bcm2835_ctl_info,
8410 +        .get = snd_bcm2835_ctl_get,
8411 +        .put = snd_bcm2835_ctl_put,
8412 +        .count = 1,
8413 +        .tlv = {.p = snd_bcm2835_db_scale}
8414 +        },
8415 +       {
8416 +        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8417 +        .name = "PCM Playback Switch",
8418 +        .index = 0,
8419 +        .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
8420 +        .private_value = PCM_PLAYBACK_MUTE,
8421 +        .info = snd_bcm2835_ctl_info,
8422 +        .get = snd_bcm2835_ctl_get,
8423 +        .put = snd_bcm2835_ctl_put,
8424 +        .count = 1,
8425 +        },
8426 +       {
8427 +        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8428 +        .name = "PCM Playback Route",
8429 +        .index = 0,
8430 +        .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
8431 +        .private_value = PCM_PLAYBACK_DEVICE,
8432 +        .info = snd_bcm2835_ctl_info,
8433 +        .get = snd_bcm2835_ctl_get,
8434 +        .put = snd_bcm2835_ctl_put,
8435 +        .count = 1,
8436 +        },
8437 +};
8438 +
8439 +int __devinit snd_bcm2835_new_ctl(bcm2835_chip_t * chip)
8440 +{
8441 +       int err;
8442 +       unsigned int idx;
8443 +
8444 +       strcpy(chip->card->mixername, "Broadcom Mixer");
8445 +       for (idx = 0; idx < ARRAY_SIZE(snd_bcm2835_ctl); idx++) {
8446 +               err =
8447 +                   snd_ctl_add(chip->card,
8448 +                               snd_ctl_new1(&snd_bcm2835_ctl[idx], chip));
8449 +               if (err < 0)
8450 +                       return err;
8451 +       }
8452 +       return 0;
8453 +}
8454 --- /dev/null
8455 +++ b/sound/arm/bcm2835-pcm.c
8456 @@ -0,0 +1,424 @@
8457 +/*****************************************************************************
8458 +* Copyright 2011 Broadcom Corporation.  All rights reserved.
8459 +*
8460 +* Unless you and Broadcom execute a separate written software license
8461 +* agreement governing use of this software, this software is licensed to you
8462 +* under the terms of the GNU General Public License version 2, available at
8463 +* http://www.broadcom.com/licenses/GPLv2.php (the "GPL").
8464 +*      
8465 +* Notwithstanding the above, under no circumstances may you combine this
8466 +* software in any way with any other Broadcom software provided under a
8467 +* license other than the GPL, without Broadcom's express prior written
8468 +* consent.
8469 +*****************************************************************************/
8470 +
8471 +#include <linux/interrupt.h>
8472 +#include <linux/slab.h>
8473 +
8474 +#include "bcm2835.h"
8475 +
8476 +/* hardware definition */
8477 +static struct snd_pcm_hardware snd_bcm2835_playback_hw = {
8478 +       .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER),
8479 +       .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE,
8480 +       .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
8481 +       .rate_min = 8000,
8482 +       .rate_max = 48000,
8483 +       .channels_min = 1,
8484 +       .channels_max = 2,
8485 +       .buffer_bytes_max = (4 * 8 - 1) * 1024, /* Needs to be less than audioplay buffer size */
8486 +       .period_bytes_min = 1 * 1024,
8487 +       .period_bytes_max = (4 * 8 - 1) * 1024,
8488 +       .periods_min = 1,
8489 +       .periods_max = 4 * 8 - 1,
8490 +};
8491 +
8492 +static void snd_bcm2835_playback_free(struct snd_pcm_runtime *runtime)
8493 +{
8494 +       audio_info("Freeing up alsa stream here ..\n");
8495 +       if (runtime->private_data)
8496 +               kfree(runtime->private_data);
8497 +       runtime->private_data = NULL;
8498 +}
8499 +
8500 +static irqreturn_t bcm2835_playback_fifo_irq(int irq, void *dev_id)
8501 +{
8502 +       bcm2835_alsa_stream_t *alsa_stream = (bcm2835_alsa_stream_t *) dev_id;
8503 +       uint32_t consumed = 0;
8504 +       int new_period = 0;
8505 +
8506 +       audio_info(" .. IN\n");
8507 +
8508 +       audio_info("alsa_stream=%p substream=%p\n", alsa_stream,
8509 +                  alsa_stream ? alsa_stream->substream : 0);
8510 +
8511 +       if (alsa_stream->open)
8512 +               consumed = bcm2835_audio_retrieve_buffers(alsa_stream);
8513 +
8514 +       /* We get called only if playback was triggered, So, the number of buffers we retrieve in
8515 +        * each iteration are the buffers that have been played out already
8516 +        */
8517 +
8518 +       if (alsa_stream->period_size) {
8519 +               if ((alsa_stream->pos / alsa_stream->period_size) !=
8520 +                   ((alsa_stream->pos + consumed) / alsa_stream->period_size))
8521 +                       new_period = 1;
8522 +       }
8523 +       audio_debug("updating pos cur: %d + %d max:%d new_period:%d\n",
8524 +                     alsa_stream->pos,
8525 +                     (consumed /** AUDIO_IPC_BLOCK_BUFFER_SIZE*/ ),
8526 +                     alsa_stream->buffer_size, new_period);
8527 +       if (alsa_stream->buffer_size) {
8528 +               alsa_stream->pos += consumed;
8529 +               alsa_stream->pos %= alsa_stream->buffer_size;
8530 +       }
8531 +       if (alsa_stream->substream) {
8532 +               if (new_period)
8533 +                       snd_pcm_period_elapsed(alsa_stream->substream);
8534 +       } else {
8535 +               audio_warning(" unexpected NULL substream\n");
8536 +       }
8537 +       audio_info(" .. OUT\n");
8538 +
8539 +       return IRQ_HANDLED;
8540 +}
8541 +
8542 +/* open callback */
8543 +static int snd_bcm2835_playback_open(struct snd_pcm_substream *substream)
8544 +{
8545 +       bcm2835_chip_t *chip = snd_pcm_substream_chip(substream);
8546 +       struct snd_pcm_runtime *runtime = substream->runtime;
8547 +       bcm2835_alsa_stream_t *alsa_stream;
8548 +       int idx;
8549 +       int err;
8550 +
8551 +       audio_info(" .. IN (%d)\n", substream->number);
8552 +
8553 +       audio_warning("Alsa open (%d)\n", substream->number);
8554 +       idx = substream->number;
8555 +
8556 +       if (idx > MAX_SUBSTREAMS) {
8557 +               audio_error
8558 +                   ("substream(%d) device doesn't exist max(%d) substreams allowed\n",
8559 +                    idx, MAX_SUBSTREAMS);
8560 +               err = -ENODEV;
8561 +               goto out;
8562 +       }
8563 +
8564 +       /* Check if we are ready */
8565 +       if (!(chip->avail_substreams & (1 << idx))) {
8566 +               /* We are not ready yet */
8567 +               audio_error("substream(%d) device is not ready yet\n", idx);
8568 +               err = -EAGAIN;
8569 +               goto out;
8570 +       }
8571 +
8572 +       alsa_stream = kzalloc(sizeof(bcm2835_alsa_stream_t), GFP_KERNEL);
8573 +       if (alsa_stream == NULL) {
8574 +               return -ENOMEM;
8575 +       }
8576 +
8577 +       /* Initialise alsa_stream */
8578 +       alsa_stream->chip = chip;
8579 +       alsa_stream->substream = substream;
8580 +       alsa_stream->idx = idx;
8581 +       chip->alsa_stream[idx] = alsa_stream;
8582 +
8583 +       sema_init(&alsa_stream->buffers_update_sem, 0);
8584 +       sema_init(&alsa_stream->control_sem, 0);
8585 +       spin_lock_init(&alsa_stream->lock);
8586 +
8587 +       /* Enabled in start trigger, called on each "fifo irq" after that */
8588 +       alsa_stream->enable_fifo_irq = 0;
8589 +       alsa_stream->fifo_irq_handler = bcm2835_playback_fifo_irq;
8590 +
8591 +       runtime->private_data = alsa_stream;
8592 +       runtime->private_free = snd_bcm2835_playback_free;
8593 +       runtime->hw = snd_bcm2835_playback_hw;
8594 +
8595 +       /* minimum 16 bytes alignment (for vchiq bulk transfers) */
8596 +       snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
8597 +                                  16);
8598 +
8599 +       err = bcm2835_audio_open(alsa_stream);
8600 +       if (err != 0) {
8601 +               kfree(alsa_stream);
8602 +               return err;
8603 +       }
8604 +
8605 +       alsa_stream->open = 1;
8606 +       alsa_stream->draining = 1;
8607 +
8608 +out:
8609 +       audio_info(" .. OUT =%d\n", err);
8610 +
8611 +       return err;
8612 +}
8613 +
8614 +/* close callback */
8615 +static int snd_bcm2835_playback_close(struct snd_pcm_substream *substream)
8616 +{
8617 +       /* the hardware-specific codes will be here */
8618 +
8619 +       struct snd_pcm_runtime *runtime = substream->runtime;
8620 +       bcm2835_alsa_stream_t *alsa_stream = runtime->private_data;
8621 +
8622 +       audio_info(" .. IN\n");
8623 +       audio_warning("Alsa close\n");
8624 +
8625 +       /*
8626 +        * Call stop if it's still running. This happens when app
8627 +        * is force killed and we don't get a stop trigger.
8628 +        */
8629 +       if (alsa_stream->running) {
8630 +               int err;
8631 +               err = bcm2835_audio_stop(alsa_stream);
8632 +               alsa_stream->running = 0;
8633 +               if (err != 0)
8634 +                       audio_error(" Failed to STOP alsa device\n");
8635 +       }
8636 +
8637 +       alsa_stream->period_size = 0;
8638 +       alsa_stream->buffer_size = 0;
8639 +
8640 +       if (alsa_stream->open) {
8641 +               alsa_stream->open = 0;
8642 +               bcm2835_audio_close(alsa_stream);
8643 +       }
8644 +       if (alsa_stream->chip)
8645 +               alsa_stream->chip->alsa_stream[alsa_stream->idx] = NULL;
8646 +       /*
8647 +        * Do not free up alsa_stream here, it will be freed up by
8648 +        * runtime->private_free callback we registered in *_open above
8649 +        */
8650 +
8651 +       audio_info(" .. OUT\n");
8652 +
8653 +       return 0;
8654 +}
8655 +
8656 +/* hw_params callback */
8657 +static int snd_bcm2835_pcm_hw_params(struct snd_pcm_substream *substream,
8658 +                                    struct snd_pcm_hw_params *params)
8659 +{
8660 +       int err;
8661 +       struct snd_pcm_runtime *runtime = substream->runtime;
8662 +       bcm2835_alsa_stream_t *alsa_stream =
8663 +           (bcm2835_alsa_stream_t *) runtime->private_data;
8664 +
8665 +       audio_info(" .. IN\n");
8666 +
8667 +       err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params));
8668 +       if (err < 0) {
8669 +               audio_error
8670 +                   (" pcm_lib_malloc failed to allocated pages for buffers\n");
8671 +               return err;
8672 +       }
8673 +
8674 +       err = bcm2835_audio_set_params(alsa_stream, params_channels(params),
8675 +                                      params_rate(params),
8676 +                                      snd_pcm_format_width(params_format
8677 +                                                           (params)));
8678 +       if (err < 0) {
8679 +               audio_error(" error setting hw params\n");
8680 +       }
8681 +
8682 +       bcm2835_audio_setup(alsa_stream);
8683 +       audio_info(" .. OUT\n");
8684 +
8685 +       return err;
8686 +}
8687 +
8688 +/* hw_free callback */
8689 +static int snd_bcm2835_pcm_hw_free(struct snd_pcm_substream *substream)
8690 +{
8691 +       audio_info(" .. IN\n");
8692 +       return snd_pcm_lib_free_pages(substream);
8693 +}
8694 +
8695 +/* prepare callback */
8696 +static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream)
8697 +{
8698 +       struct snd_pcm_runtime *runtime = substream->runtime;
8699 +       bcm2835_alsa_stream_t *alsa_stream = runtime->private_data;
8700 +
8701 +       audio_info(" .. IN\n");
8702 +
8703 +       alsa_stream->buffer_size = snd_pcm_lib_buffer_bytes(substream);
8704 +       alsa_stream->period_size = snd_pcm_lib_period_bytes(substream);
8705 +       alsa_stream->pos = 0;
8706 +
8707 +       audio_debug("buffer_size=%d, period_size=%d pos=%d frame_bits=%d\n",
8708 +                     alsa_stream->buffer_size, alsa_stream->period_size,
8709 +                     alsa_stream->pos, runtime->frame_bits);
8710 +
8711 +       audio_info(" .. OUT\n");
8712 +       return 0;
8713 +}
8714 +
8715 +/* trigger callback */
8716 +static int snd_bcm2835_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
8717 +{
8718 +       struct snd_pcm_runtime *runtime = substream->runtime;
8719 +       bcm2835_alsa_stream_t *alsa_stream = runtime->private_data;
8720 +       int err = 0;
8721 +
8722 +       audio_info(" .. IN\n");
8723 +
8724 +       switch (cmd) {
8725 +       case SNDRV_PCM_TRIGGER_START:
8726 +               audio_debug("bcm2835_AUDIO_TRIGGER_START running=%d\n",
8727 +                             alsa_stream->running);
8728 +               if (!alsa_stream->running) {
8729 +                       err = bcm2835_audio_start(alsa_stream);
8730 +                       if (err == 0) {
8731 +                               alsa_stream->running = 1;
8732 +                               alsa_stream->draining = 1;
8733 +                       }
8734 +               }
8735 +               break;
8736 +       case SNDRV_PCM_TRIGGER_STOP:
8737 +               audio_debug
8738 +                   ("bcm2835_AUDIO_TRIGGER_STOP running=%d draining=%d\n",
8739 +                    runtime->status->state == SNDRV_PCM_STATE_DRAINING,
8740 +                    alsa_stream->running);
8741 +               if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) {
8742 +                       audio_info("DRAINING\n");
8743 +                       alsa_stream->draining = 1;
8744 +               } else {
8745 +                       audio_info("DROPPING\n");
8746 +                       alsa_stream->draining = 0;
8747 +               }
8748 +               if (alsa_stream->running) {
8749 +                       err = bcm2835_audio_stop(alsa_stream);
8750 +                       if (err != 0)
8751 +                               audio_error(" Failed to STOP alsa device\n");
8752 +                       alsa_stream->running = 0;
8753 +               }
8754 +               break;
8755 +       default:
8756 +               err = -EINVAL;
8757 +       }
8758 +
8759 +       audio_info(" .. OUT\n");
8760 +       return err;
8761 +}
8762 +
8763 +/* pointer callback */
8764 +static snd_pcm_uframes_t
8765 +snd_bcm2835_pcm_pointer(struct snd_pcm_substream *substream)
8766 +{
8767 +       struct snd_pcm_runtime *runtime = substream->runtime;
8768 +       bcm2835_alsa_stream_t *alsa_stream = runtime->private_data;
8769 +
8770 +       audio_info(" .. IN\n");
8771 +
8772 +       audio_debug("pcm_pointer... (%d) hwptr=%d appl=%d pos=%d\n", 0,
8773 +                     frames_to_bytes(runtime, runtime->status->hw_ptr),
8774 +                     frames_to_bytes(runtime, runtime->control->appl_ptr),
8775 +                     alsa_stream->pos);
8776 +
8777 +       audio_info(" .. OUT\n");
8778 +       return bytes_to_frames(runtime, alsa_stream->pos);
8779 +}
8780 +
8781 +static int snd_bcm2835_pcm_copy(struct snd_pcm_substream *substream,
8782 +                               int channel, snd_pcm_uframes_t pos, void *src,
8783 +                               snd_pcm_uframes_t count)
8784 +{
8785 +       int ret;
8786 +       struct snd_pcm_runtime *runtime = substream->runtime;
8787 +       bcm2835_alsa_stream_t *alsa_stream = runtime->private_data;
8788 +
8789 +       audio_info(" .. IN\n");
8790 +       audio_debug("copy.......... (%d) hwptr=%d appl=%d pos=%d\n",
8791 +                     frames_to_bytes(runtime, count), frames_to_bytes(runtime,
8792 +                                                                      runtime->
8793 +                                                                      status->
8794 +                                                                      hw_ptr),
8795 +                     frames_to_bytes(runtime, runtime->control->appl_ptr),
8796 +                     alsa_stream->pos);
8797 +       ret =
8798 +           bcm2835_audio_write(alsa_stream, frames_to_bytes(runtime, count),
8799 +                               src);
8800 +       audio_info(" .. OUT\n");
8801 +       return ret;
8802 +}
8803 +
8804 +static int snd_bcm2835_pcm_silence(struct snd_pcm_substream *substream,
8805 +                                  int channel, snd_pcm_uframes_t post,
8806 +                                  snd_pcm_uframes_t count)
8807 +{
8808 +       int ret;
8809 +       struct snd_pcm_runtime *runtime = substream->runtime;
8810 +       bcm2835_alsa_stream_t *alsa_stream = runtime->private_data;
8811 +
8812 +       audio_info(" .. IN\n");
8813 +       audio_debug("silence....... (%d) hwptr=%d appl=%d pos=%d\n",
8814 +                     frames_to_bytes(runtime, count), frames_to_bytes(runtime,
8815 +                                                                      runtime->
8816 +                                                                      status->
8817 +                                                                      hw_ptr),
8818 +                     frames_to_bytes(runtime, runtime->control->appl_ptr),
8819 +                     alsa_stream->pos);
8820 +       ret =
8821 +           bcm2835_audio_write(alsa_stream, frames_to_bytes(runtime, count),
8822 +                               NULL);
8823 +       audio_info(" .. OUT\n");
8824 +       return ret;
8825 +}
8826 +
8827 +static int snd_bcm2835_pcm_lib_ioctl(struct snd_pcm_substream *substream,
8828 +                                    unsigned int cmd, void *arg)
8829 +{
8830 +       int ret = snd_pcm_lib_ioctl(substream, cmd, arg);
8831 +       audio_info(" .. substream=%p, cmd=%d, arg=%p (%x) ret=%d\n", substream,
8832 +                   cmd, arg, arg ? *(unsigned *)arg : 0, ret);
8833 +       return ret;
8834 +}
8835 +
8836 +/* operators */
8837 +static struct snd_pcm_ops snd_bcm2835_playback_ops = {
8838 +       .open = snd_bcm2835_playback_open,
8839 +       .close = snd_bcm2835_playback_close,
8840 +       .ioctl = snd_bcm2835_pcm_lib_ioctl,
8841 +       .hw_params = snd_bcm2835_pcm_hw_params,
8842 +       .hw_free = snd_bcm2835_pcm_hw_free,
8843 +       .prepare = snd_bcm2835_pcm_prepare,
8844 +       .trigger = snd_bcm2835_pcm_trigger,
8845 +       .pointer = snd_bcm2835_pcm_pointer,
8846 +       .copy = snd_bcm2835_pcm_copy,
8847 +       .silence = snd_bcm2835_pcm_silence,
8848 +};
8849 +
8850 +/* create a pcm device */
8851 +int __devinit snd_bcm2835_new_pcm(bcm2835_chip_t * chip)
8852 +{
8853 +       struct snd_pcm *pcm;
8854 +       int err;
8855 +
8856 +       audio_info(" .. IN\n");
8857 +       err =
8858 +           snd_pcm_new(chip->card, "bcm2835 ALSA", 0, MAX_SUBSTREAMS, 0, &pcm);
8859 +       if (err < 0)
8860 +               return err;
8861 +       pcm->private_data = chip;
8862 +       strcpy(pcm->name, "bcm2835 ALSA");
8863 +       chip->pcm = pcm;
8864 +       chip->dest = AUDIO_DEST_AUTO;
8865 +       chip->volume = 100;
8866 +       /* set operators */
8867 +       snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
8868 +                       &snd_bcm2835_playback_ops);
8869 +
8870 +       /* pre-allocation of buffers */
8871 +       /* NOTE: this may fail */
8872 +       snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS,
8873 +                                             snd_dma_continuous_data
8874 +                                             (GFP_KERNEL), 64 * 1024,
8875 +                                             64 * 1024);
8876 +
8877 +       audio_info(" .. OUT\n");
8878 +
8879 +       return 0;
8880 +}
8881 --- /dev/null
8882 +++ b/sound/arm/bcm2835-vchiq.c
8883 @@ -0,0 +1,818 @@
8884 +/*****************************************************************************
8885 +* Copyright 2011 Broadcom Corporation.  All rights reserved.
8886 +*
8887 +* Unless you and Broadcom execute a separate written software license
8888 +* agreement governing use of this software, this software is licensed to you
8889 +* under the terms of the GNU General Public License version 2, available at
8890 +* http://www.broadcom.com/licenses/GPLv2.php (the "GPL").
8891 +*      
8892 +* Notwithstanding the above, under no circumstances may you combine this
8893 +* software in any way with any other Broadcom software provided under a
8894 +* license other than the GPL, without Broadcom's express prior written
8895 +* consent.
8896 +*****************************************************************************/
8897 +
8898 +#include <linux/device.h>
8899 +#include <sound/core.h>
8900 +#include <sound/initval.h>
8901 +#include <sound/pcm.h>
8902 +#include <linux/io.h>
8903 +#include <linux/interrupt.h>
8904 +#include <linux/fs.h>
8905 +#include <linux/file.h>
8906 +#include <linux/mm.h>
8907 +#include <linux/syscalls.h>
8908 +#include <asm/uaccess.h>
8909 +#include <linux/slab.h>
8910 +#include <linux/delay.h>
8911 +#include <linux/atomic.h>
8912 +
8913 +#include "bcm2835.h"
8914 +
8915 +/* ---- Include Files -------------------------------------------------------- */
8916 +
8917 +#include "interface/vchi/vchi.h"
8918 +#include "interface/vcos/vcos.h"
8919 +#include "interface/vcos/vcos_logging.h"
8920 +#include "vc_vchi_audioserv_defs.h"
8921 +
8922 +/* ---- Private Constants and Types ------------------------------------------ */
8923 +
8924 +/* VCOS logging category for this service */
8925 +#define VCOS_LOG_CATEGORY (&audio_log_category)
8926 +
8927 +/* Default VCOS logging level */
8928 +#define LOG_LEVEL  VCOS_LOG_WARN
8929 +
8930 +/* Logging macros (for remapping to other logging mechanisms, i.e., printf) */
8931 +#define LOG_ERR( fmt, arg... )   vcos_log_error( "%s:%d " fmt, __func__, __LINE__, ##arg)
8932 +#define LOG_WARN( fmt, arg... )  vcos_log_warn( "%s:%d " fmt, __func__, __LINE__, ##arg)
8933 +#define LOG_INFO( fmt, arg... )  vcos_log_info( "%s:%d " fmt, __func__, __LINE__, ##arg)
8934 +#define LOG_DBG( fmt, arg... )   vcos_log_info( "%s:%d " fmt, __func__, __LINE__, ##arg)
8935 +
8936 +typedef struct opaque_AUDIO_INSTANCE_T {
8937 +       uint32_t num_connections;
8938 +       VCHI_SERVICE_HANDLE_T vchi_handle[VCHI_MAX_NUM_CONNECTIONS];
8939 +       VCOS_EVENT_T msg_avail_event;
8940 +       VCOS_MUTEX_T vchi_mutex;
8941 +       bcm2835_alsa_stream_t *alsa_stream;
8942 +       int32_t result, got_result;
8943 +} AUDIO_INSTANCE_T;
8944 +
8945 +/* ---- Private Variables ---------------------------------------------------- */
8946 +
8947 +/* VCOS logging category for this service */
8948 +static VCOS_LOG_CAT_T audio_log_category;
8949 +
8950 +/* ---- Private Function Prototypes ------------------------------------------ */
8951 +
8952 +/* ---- Private Functions ---------------------------------------------------- */
8953 +
8954 +static int bcm2835_audio_stop_worker(bcm2835_alsa_stream_t * alsa_stream);
8955 +static int bcm2835_audio_start_worker(bcm2835_alsa_stream_t * alsa_stream);
8956 +
8957 +typedef struct {
8958 +       struct work_struct my_work;
8959 +       bcm2835_alsa_stream_t *alsa_stream;
8960 +       int x;
8961 +} my_work_t;
8962 +
8963 +static void my_wq_function(struct work_struct *work)
8964 +{
8965 +       my_work_t *w = (my_work_t *) work;
8966 +       int ret = -9;
8967 +       LOG_DBG(" .. IN %p:%d\n", w->alsa_stream, w->x);
8968 +       switch (w->x) {
8969 +       case 1:
8970 +               ret = bcm2835_audio_start_worker(w->alsa_stream);
8971 +               break;
8972 +       case 2:
8973 +               ret = bcm2835_audio_stop_worker(w->alsa_stream);
8974 +               break;
8975 +       default:
8976 +               LOG_ERR(" Unexpected work: %p:%d\n", w->alsa_stream, w->x);
8977 +               break;
8978 +       }
8979 +       kfree((void *)work);
8980 +       LOG_DBG(" .. OUT %d\n", ret);
8981 +}
8982 +
8983 +int bcm2835_audio_start(bcm2835_alsa_stream_t * alsa_stream)
8984 +{
8985 +       int ret = -1;
8986 +       LOG_DBG(" .. IN\n");
8987 +       if (alsa_stream->my_wq) {
8988 +               my_work_t *work = kmalloc(sizeof(my_work_t), GFP_KERNEL);
8989 +               /* Queue some work (item 1) */
8990 +               if (work) {
8991 +                       INIT_WORK((struct work_struct *)work, my_wq_function);
8992 +                       work->alsa_stream = alsa_stream;
8993 +                       work->x = 1;
8994 +                       if (queue_work
8995 +                           (alsa_stream->my_wq, (struct work_struct *)work))
8996 +                               ret = 0;
8997 +               } else
8998 +                       LOG_ERR(" .. Error: NULL work kmalloc\n");
8999 +       }
9000 +       LOG_DBG(" .. OUT %d\n", ret);
9001 +       return ret;
9002 +}
9003 +
9004 +int bcm2835_audio_stop(bcm2835_alsa_stream_t * alsa_stream)
9005 +{
9006 +       int ret = -1;
9007 +       LOG_DBG(" .. IN\n");
9008 +       if (alsa_stream->my_wq) {
9009 +               my_work_t *work = kmalloc(sizeof(my_work_t), GFP_KERNEL);
9010 +               /* Queue some work (item 1) */
9011 +               if (work) {
9012 +                       INIT_WORK((struct work_struct *)work, my_wq_function);
9013 +                       work->alsa_stream = alsa_stream;
9014 +                       work->x = 2;
9015 +                       if (queue_work
9016 +                           (alsa_stream->my_wq, (struct work_struct *)work))
9017 +                               ret = 0;
9018 +               } else
9019 +                       LOG_ERR(" .. Error: NULL work kmalloc\n");
9020 +       }
9021 +       LOG_DBG(" .. OUT %d\n", ret);
9022 +       return ret;
9023 +}
9024 +
9025 +void my_workqueue_init(bcm2835_alsa_stream_t * alsa_stream)
9026 +{
9027 +       alsa_stream->my_wq = create_workqueue("my_queue");
9028 +}
9029 +
9030 +void my_workqueue_quit(bcm2835_alsa_stream_t * alsa_stream)
9031 +{
9032 +       if (alsa_stream->my_wq) {
9033 +               flush_workqueue(alsa_stream->my_wq);
9034 +               destroy_workqueue(alsa_stream->my_wq);
9035 +               alsa_stream->my_wq = NULL;
9036 +       }
9037 +}
9038 +
9039 +static void audio_vchi_callback(void *param,
9040 +                               const VCHI_CALLBACK_REASON_T reason,
9041 +                               void *msg_handle)
9042 +{
9043 +       AUDIO_INSTANCE_T *instance = (AUDIO_INSTANCE_T *) param;
9044 +       int32_t status;
9045 +       int32_t msg_len;
9046 +       VC_AUDIO_MSG_T m;
9047 +       bcm2835_alsa_stream_t *alsa_stream = 0;
9048 +       LOG_DBG(" .. IN instance=%p, param=%p, reason=%d, handle=%p\n",
9049 +               instance, param, reason, msg_handle);
9050 +
9051 +       if (!instance || reason != VCHI_CALLBACK_MSG_AVAILABLE) {
9052 +               return;
9053 +       }
9054 +       alsa_stream = instance->alsa_stream;
9055 +       status = vchi_msg_dequeue(instance->vchi_handle[0],
9056 +                                 &m, sizeof m, &msg_len, VCHI_FLAGS_NONE);
9057 +       if (m.type == VC_AUDIO_MSG_TYPE_RESULT) {
9058 +               LOG_DBG
9059 +                   (" .. instance=%p, m.type=VC_AUDIO_MSG_TYPE_RESULT, success=%d\n",
9060 +                    instance, m.u.result.success);
9061 +               BUG_ON(instance->got_result);
9062 +               instance->result = m.u.result.success;
9063 +               instance->got_result = 1;
9064 +               vcos_event_signal(&instance->msg_avail_event);
9065 +       } else if (m.type == VC_AUDIO_MSG_TYPE_COMPLETE) {
9066 +               irq_handler_t callback = (irq_handler_t) m.u.complete.callback;
9067 +               LOG_DBG
9068 +                   (" .. instance=%p, m.type=VC_AUDIO_MSG_TYPE_COMPLETE, complete=%d\n",
9069 +                    instance, m.u.complete.count);
9070 +               if (alsa_stream && callback) {
9071 +                       atomic_add(m.u.complete.count, &alsa_stream->retrieved);
9072 +                       callback(0, alsa_stream);
9073 +               } else {
9074 +                       LOG_DBG(" .. unexpected alsa_stream=%p, callback=%p\n",
9075 +                               alsa_stream, callback);
9076 +               }
9077 +               vcos_event_signal(&instance->msg_avail_event);
9078 +       } else {
9079 +               LOG_DBG(" .. unexpected m.type=%d\n", m.type);
9080 +       }
9081 +}
9082 +
9083 +static AUDIO_INSTANCE_T *vc_vchi_audio_init(VCHI_INSTANCE_T vchi_instance,
9084 +                                           VCHI_CONNECTION_T **
9085 +                                           vchi_connections,
9086 +                                           uint32_t num_connections)
9087 +{
9088 +       uint32_t i;
9089 +       AUDIO_INSTANCE_T *instance;
9090 +       VCOS_STATUS_T status;
9091 +
9092 +       LOG_DBG("%s: start", __func__);
9093 +
9094 +       if (num_connections > VCHI_MAX_NUM_CONNECTIONS) {
9095 +               LOG_ERR("%s: unsupported number of connections %u (max=%u)",
9096 +                       __func__, num_connections, VCHI_MAX_NUM_CONNECTIONS);
9097 +
9098 +               return NULL;
9099 +       }
9100 +       /* Allocate memory for this instance */
9101 +       instance = vcos_malloc(sizeof(*instance), "audio_instance");
9102 +       memset(instance, 0, sizeof(*instance));
9103 +
9104 +       instance->num_connections = num_connections;
9105 +       /* Create the message available event */
9106 +       status =
9107 +           vcos_event_create(&instance->msg_avail_event, "audio_msg_avail");
9108 +       if (status != VCOS_SUCCESS) {
9109 +               LOG_ERR("%s: failed to create event (status=%d)", __func__,
9110 +                       status);
9111 +
9112 +               goto err_free_mem;
9113 +       }
9114 +       /* Create a lock for exclusive, serialized VCHI connection access */
9115 +       status = vcos_mutex_create(&instance->vchi_mutex, "audio_vchi_mutex");
9116 +       if (status != VCOS_SUCCESS) {
9117 +               LOG_ERR("%s: failed to create event (status=%d)", __func__,
9118 +                       status);
9119 +
9120 +               goto err_delete_event;
9121 +       }
9122 +       /* Open the VCHI service connections */
9123 +       for (i = 0; i < num_connections; i++) {
9124 +               SERVICE_CREATION_T params = {
9125 +                       VC_AUDIO_SERVER_NAME,   // 4cc service code
9126 +                       vchi_connections[i],    // passed in fn pointers
9127 +                       0,      // rx fifo size (unused)
9128 +                       0,      // tx fifo size (unused)
9129 +                       audio_vchi_callback,    // service callback
9130 +                       instance,       // service callback parameter
9131 +                       VCOS_TRUE,      //TODO: remove VCOS_FALSE,   // unaligned bulk recieves
9132 +                       VCOS_TRUE,      //TODO: remove VCOS_FALSE,   // unaligned bulk transmits
9133 +                       VCOS_FALSE      // want crc check on bulk transfers
9134 +               };
9135 +
9136 +               status = vchi_service_open(vchi_instance, &params,
9137 +                                          &instance->vchi_handle[i]);
9138 +               if (status != VCOS_SUCCESS) {
9139 +                       LOG_ERR
9140 +                           ("%s: failed to open VCHI service connection (status=%d)",
9141 +                            __func__, status);
9142 +
9143 +                       goto err_close_services;
9144 +               }
9145 +               /* Finished with the service for now */
9146 +               vchi_service_release(instance->vchi_handle[i]);
9147 +       }
9148 +
9149 +       return instance;
9150 +
9151 +err_close_services:
9152 +       for (i = 0; i < instance->num_connections; i++) {
9153 +               vchi_service_close(instance->vchi_handle[i]);
9154 +       }
9155 +
9156 +       vcos_mutex_delete(&instance->vchi_mutex);
9157 +
9158 +err_delete_event:
9159 +       vcos_event_delete(&instance->msg_avail_event);
9160 +
9161 +err_free_mem:
9162 +       vcos_free(instance);
9163 +
9164 +       return NULL;
9165 +}
9166 +
9167 +static int32_t vc_vchi_audio_deinit(AUDIO_INSTANCE_T * instance)
9168 +{
9169 +       uint32_t i;
9170 +
9171 +       LOG_DBG(" .. IN\n");
9172 +
9173 +       if (instance == NULL) {
9174 +               LOG_ERR("%s: invalid handle %p", __func__, instance);
9175 +
9176 +               return -1;
9177 +       }
9178 +
9179 +       LOG_DBG(" .. about to lock (%d)\n", instance->num_connections);
9180 +       vcos_mutex_lock(&instance->vchi_mutex);
9181 +
9182 +       /* Close all VCHI service connections */
9183 +       for (i = 0; i < instance->num_connections; i++) {
9184 +               int32_t success;
9185 +               LOG_DBG(" .. %i:closing %p\n", i, instance->vchi_handle[i]);
9186 +               vchi_service_use(instance->vchi_handle[i]);
9187 +
9188 +               success = vchi_service_close(instance->vchi_handle[i]);
9189 +               if (success != 0) {
9190 +                       LOG_ERR
9191 +                           ("%s: failed to close VCHI service connection (status=%d)",
9192 +                            __func__, success);
9193 +               }
9194 +       }
9195 +
9196 +       vcos_mutex_unlock(&instance->vchi_mutex);
9197 +
9198 +       vcos_mutex_delete(&instance->vchi_mutex);
9199 +
9200 +       vcos_event_delete(&instance->msg_avail_event);
9201 +
9202 +       vcos_free(instance);
9203 +
9204 +       /* Unregister the log category so we can add it back next time */
9205 +       vcos_log_unregister(&audio_log_category);
9206 +
9207 +       LOG_DBG(" .. OUT\n");
9208 +
9209 +       return 0;
9210 +}
9211 +
9212 +static int bcm2835_audio_open_connection(bcm2835_alsa_stream_t * alsa_stream)
9213 +{
9214 +       static VCHI_INSTANCE_T vchi_instance;
9215 +       static VCHI_CONNECTION_T *vchi_connection;
9216 +       AUDIO_INSTANCE_T *instance = alsa_stream->instance;
9217 +       int ret;
9218 +       LOG_DBG(" .. IN\n");
9219 +
9220 +       LOG_INFO("%s: start", __func__);
9221 +       //BUG_ON(instance);
9222 +       if (instance) {
9223 +               LOG_ERR("%s: VCHI instance already open (%p)",
9224 +                       __func__, instance);
9225 +               instance->alsa_stream = alsa_stream;
9226 +               alsa_stream->instance = instance;
9227 +               ret = 0;        // xxx todo -1;
9228 +               goto err_free_mem;
9229 +       }
9230 +
9231 +       /* Initialize and create a VCHI connection */
9232 +       ret = vchi_initialise(&vchi_instance);
9233 +       if (ret != 0) {
9234 +               LOG_ERR("%s: failed to initialise VCHI instance (ret=%d)",
9235 +                       __func__, ret);
9236 +
9237 +               ret = -EIO;
9238 +               goto err_free_mem;
9239 +       }
9240 +       ret = vchi_connect(NULL, 0, vchi_instance);
9241 +       if (ret != 0) {
9242 +               LOG_ERR("%s: failed to connect VCHI instance (ret=%d)",
9243 +                       __func__, ret);
9244 +
9245 +               ret = -EIO;
9246 +               goto err_free_mem;
9247 +       }
9248 +
9249 +       /* Set up the VCOS logging */
9250 +       vcos_log_set_level(VCOS_LOG_CATEGORY, LOG_LEVEL);
9251 +       vcos_log_register("audio", VCOS_LOG_CATEGORY);
9252 +
9253 +       /* Initialize an instance of the audio service */
9254 +       instance = vc_vchi_audio_init(vchi_instance, &vchi_connection, 1);
9255 +
9256 +       if (instance == NULL /*|| audio_handle != instance */ ) {
9257 +               LOG_ERR("%s: failed to initialize audio service", __func__);
9258 +
9259 +               ret = -EPERM;
9260 +               goto err_free_mem;
9261 +       }
9262 +
9263 +       instance->alsa_stream = alsa_stream;
9264 +       alsa_stream->instance = instance;
9265 +
9266 +       LOG_DBG(" success !\n");
9267 +err_free_mem:
9268 +       LOG_DBG(" .. OUT\n");
9269 +
9270 +       return ret;
9271 +}
9272 +
9273 +int bcm2835_audio_open(bcm2835_alsa_stream_t * alsa_stream)
9274 +{
9275 +       AUDIO_INSTANCE_T *instance;
9276 +       VC_AUDIO_MSG_T m;
9277 +       int32_t success;
9278 +       int ret;
9279 +       LOG_DBG(" .. IN\n");
9280 +
9281 +       my_workqueue_init(alsa_stream);
9282 +
9283 +       ret = bcm2835_audio_open_connection(alsa_stream);
9284 +       if (ret != 0) {
9285 +               ret = -1;
9286 +               goto exit;
9287 +       }
9288 +       instance = alsa_stream->instance;
9289 +
9290 +       vcos_mutex_lock(&instance->vchi_mutex);
9291 +       vchi_service_use(instance->vchi_handle[0]);
9292 +
9293 +       m.type = VC_AUDIO_MSG_TYPE_OPEN;
9294 +
9295 +       /* Send the message to the videocore */
9296 +       success = vchi_msg_queue(instance->vchi_handle[0],
9297 +                                &m, sizeof m,
9298 +                                VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL);
9299 +
9300 +       if (success != 0) {
9301 +               LOG_ERR("%s: failed on vchi_msg_queue (status=%d)",
9302 +                       __func__, success);
9303 +
9304 +               ret = -1;
9305 +               goto unlock;
9306 +       }
9307 +
9308 +       ret = 0;
9309 +
9310 +unlock:
9311 +       vchi_service_release(instance->vchi_handle[0]);
9312 +       vcos_mutex_unlock(&instance->vchi_mutex);
9313 +exit:
9314 +       LOG_DBG(" .. OUT\n");
9315 +       return ret;
9316 +}
9317 +
9318 +static int bcm2835_audio_set_ctls_chan(bcm2835_alsa_stream_t * alsa_stream,
9319 +                                      bcm2835_chip_t * chip)
9320 +{
9321 +       VC_AUDIO_MSG_T m;
9322 +       AUDIO_INSTANCE_T *instance = alsa_stream->instance;
9323 +       int32_t success;
9324 +       int ret;
9325 +       LOG_DBG(" .. IN\n");
9326 +
9327 +       LOG_INFO
9328 +           (" Setting ALSA dest(%d), volume(%d)\n", chip->dest, chip->volume);
9329 +
9330 +       vcos_mutex_lock(&instance->vchi_mutex);
9331 +       vchi_service_use(instance->vchi_handle[0]);
9332 +
9333 +       instance->got_result = 0;
9334 +       instance->result = -1;
9335 +
9336 +       m.type = VC_AUDIO_MSG_TYPE_CONTROL;
9337 +       m.u.control.dest = chip->dest;
9338 +       m.u.control.volume = chip->volume;
9339 +
9340 +       /* Send the message to the videocore */
9341 +       success = vchi_msg_queue(instance->vchi_handle[0],
9342 +                                &m, sizeof m,
9343 +                                VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL);
9344 +
9345 +       if (success != 0) {
9346 +               LOG_ERR("%s: failed on vchi_msg_queue (status=%d)",
9347 +                       __func__, success);
9348 +
9349 +               ret = -1;
9350 +               goto unlock;
9351 +       }
9352 +
9353 +       /* We are expecting a reply from the videocore */
9354 +       while (!instance->got_result) {
9355 +               success = vcos_event_wait(&instance->msg_avail_event);
9356 +               if (success != VCOS_SUCCESS) {
9357 +                       LOG_ERR("%s: failed on waiting for event (status=%d)",
9358 +                               __func__, success);
9359 +
9360 +                       ret = -1;
9361 +                       goto unlock;
9362 +               }
9363 +       }
9364 +
9365 +       if (instance->result != 0) {
9366 +               LOG_ERR("%s: result=%d", __func__, instance->result);
9367 +
9368 +               ret = -1;
9369 +               goto unlock;
9370 +       }
9371 +
9372 +       ret = 0;
9373 +
9374 +unlock:
9375 +       vchi_service_release(instance->vchi_handle[0]);
9376 +       vcos_mutex_unlock(&instance->vchi_mutex);
9377 +
9378 +       LOG_DBG(" .. OUT\n");
9379 +       return ret;
9380 +}
9381 +
9382 +int bcm2835_audio_set_ctls(bcm2835_chip_t * chip)
9383 +{
9384 +       int i;
9385 +       int ret = 0;
9386 +       LOG_DBG(" .. IN\n");
9387 +       /* change ctls for all substreams */
9388 +       for (i = 0; i < MAX_SUBSTREAMS; i++) {
9389 +               if (chip->avail_substreams & (1 << i)) {
9390 +                       if (!chip->alsa_stream[i])
9391 +                               ret = 0;
9392 +                       else if (bcm2835_audio_set_ctls_chan
9393 +                                (chip->alsa_stream[i], chip) != 0)
9394 +                               ret = -1;
9395 +               }
9396 +       }
9397 +       LOG_DBG(" .. OUT ret=%d\n", ret);
9398 +       return ret;
9399 +}
9400 +
9401 +int bcm2835_audio_set_params(bcm2835_alsa_stream_t * alsa_stream,
9402 +                            uint32_t channels, uint32_t samplerate,
9403 +                            uint32_t bps)
9404 +{
9405 +       VC_AUDIO_MSG_T m;
9406 +       AUDIO_INSTANCE_T *instance = alsa_stream->instance;
9407 +       int32_t success;
9408 +       int ret;
9409 +       LOG_DBG(" .. IN\n");
9410 +
9411 +       LOG_INFO
9412 +           (" Setting ALSA channels(%d), samplerate(%d), bits-per-sample(%d)\n",
9413 +            channels, samplerate, bps);
9414 +
9415 +       /* resend ctls - alsa_stream may not have been open when first send */
9416 +       ret = bcm2835_audio_set_ctls_chan(alsa_stream, alsa_stream->chip);
9417 +       if (ret != 0) {
9418 +               LOG_ERR(" Alsa controls not supported\n");
9419 +               return -EINVAL;
9420 +       }
9421 +
9422 +       vcos_mutex_lock(&instance->vchi_mutex);
9423 +       vchi_service_use(instance->vchi_handle[0]);
9424 +
9425 +       instance->got_result = 0;
9426 +       instance->result = -1;
9427 +
9428 +       m.type = VC_AUDIO_MSG_TYPE_CONFIG;
9429 +       m.u.config.channels = channels;
9430 +       m.u.config.samplerate = samplerate;
9431 +       m.u.config.bps = bps;
9432 +
9433 +       /* Send the message to the videocore */
9434 +       success = vchi_msg_queue(instance->vchi_handle[0],
9435 +                                &m, sizeof m,
9436 +                                VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL);
9437 +
9438 +       if (success != 0) {
9439 +               LOG_ERR("%s: failed on vchi_msg_queue (status=%d)",
9440 +                       __func__, success);
9441 +
9442 +               ret = -1;
9443 +               goto unlock;
9444 +       }
9445 +
9446 +       /* We are expecting a reply from the videocore */
9447 +       while (!instance->got_result) {
9448 +               success = vcos_event_wait(&instance->msg_avail_event);
9449 +               if (success != VCOS_SUCCESS) {
9450 +                       LOG_ERR("%s: failed on waiting for event (status=%d)",
9451 +                               __func__, success);
9452 +
9453 +                       ret = -1;
9454 +                       goto unlock;
9455 +               }
9456 +       }
9457 +
9458 +       if (instance->result != 0) {
9459 +               LOG_ERR("%s: result=%d", __func__, instance->result);
9460 +
9461 +               ret = -1;
9462 +               goto unlock;
9463 +       }
9464 +
9465 +       ret = 0;
9466 +
9467 +unlock:
9468 +       vchi_service_release(instance->vchi_handle[0]);
9469 +       vcos_mutex_unlock(&instance->vchi_mutex);
9470 +
9471 +       LOG_DBG(" .. OUT\n");
9472 +       return ret;
9473 +}
9474 +
9475 +int bcm2835_audio_setup(bcm2835_alsa_stream_t * alsa_stream)
9476 +{
9477 +       LOG_DBG(" .. IN\n");
9478 +
9479 +       LOG_DBG(" .. OUT\n");
9480 +
9481 +       return 0;
9482 +}
9483 +
9484 +static int bcm2835_audio_start_worker(bcm2835_alsa_stream_t * alsa_stream)
9485 +{
9486 +       VC_AUDIO_MSG_T m;
9487 +       AUDIO_INSTANCE_T *instance = alsa_stream->instance;
9488 +       int32_t success;
9489 +       int ret;
9490 +       LOG_DBG(" .. IN\n");
9491 +
9492 +       vcos_mutex_lock(&instance->vchi_mutex);
9493 +       vchi_service_use(instance->vchi_handle[0]);
9494 +
9495 +       m.type = VC_AUDIO_MSG_TYPE_START;
9496 +
9497 +       /* Send the message to the videocore */
9498 +       success = vchi_msg_queue(instance->vchi_handle[0],
9499 +                                &m, sizeof m,
9500 +                                VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL);
9501 +
9502 +       if (success != 0) {
9503 +               LOG_ERR("%s: failed on vchi_msg_queue (status=%d)",
9504 +                       __func__, success);
9505 +
9506 +               ret = -1;
9507 +               goto unlock;
9508 +       }
9509 +
9510 +       ret = 0;
9511 +
9512 +unlock:
9513 +       vchi_service_release(instance->vchi_handle[0]);
9514 +       vcos_mutex_unlock(&instance->vchi_mutex);
9515 +       LOG_DBG(" .. OUT\n");
9516 +       return ret;
9517 +}
9518 +
9519 +static int bcm2835_audio_stop_worker(bcm2835_alsa_stream_t * alsa_stream)
9520 +{
9521 +       VC_AUDIO_MSG_T m;
9522 +       AUDIO_INSTANCE_T *instance = alsa_stream->instance;
9523 +       int32_t success;
9524 +       int ret;
9525 +       LOG_DBG(" .. IN\n");
9526 +
9527 +       vcos_mutex_lock(&instance->vchi_mutex);
9528 +       vchi_service_use(instance->vchi_handle[0]);
9529 +
9530 +       m.type = VC_AUDIO_MSG_TYPE_STOP;
9531 +       m.u.stop.draining = alsa_stream->draining;
9532 +
9533 +       /* Send the message to the videocore */
9534 +       success = vchi_msg_queue(instance->vchi_handle[0],
9535 +                                &m, sizeof m,
9536 +                                VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL);
9537 +
9538 +       if (success != 0) {
9539 +               LOG_ERR("%s: failed on vchi_msg_queue (status=%d)",
9540 +                       __func__, success);
9541 +
9542 +               ret = -1;
9543 +               goto unlock;
9544 +       }
9545 +
9546 +       ret = 0;
9547 +
9548 +unlock:
9549 +       vchi_service_release(instance->vchi_handle[0]);
9550 +       vcos_mutex_unlock(&instance->vchi_mutex);
9551 +       LOG_DBG(" .. OUT\n");
9552 +       return ret;
9553 +}
9554 +
9555 +int bcm2835_audio_close(bcm2835_alsa_stream_t * alsa_stream)
9556 +{
9557 +       VC_AUDIO_MSG_T m;
9558 +       AUDIO_INSTANCE_T *instance = alsa_stream->instance;
9559 +       int32_t success;
9560 +       int ret;
9561 +       LOG_DBG(" .. IN\n");
9562 +
9563 +       my_workqueue_quit(alsa_stream);
9564 +
9565 +       vcos_mutex_lock(&instance->vchi_mutex);
9566 +       vchi_service_use(instance->vchi_handle[0]);
9567 +
9568 +       m.type = VC_AUDIO_MSG_TYPE_CLOSE;
9569 +       instance->got_result = 0;
9570 +       /* Send the message to the videocore */
9571 +       success = vchi_msg_queue(instance->vchi_handle[0],
9572 +                                &m, sizeof m,
9573 +                                VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL);
9574 +
9575 +       if (success != 0) {
9576 +               LOG_ERR("%s: failed on vchi_msg_queue (status=%d)",
9577 +                       __func__, success);
9578 +               ret = -1;
9579 +               goto unlock;
9580 +       }
9581 +       while (!instance->got_result) {
9582 +               success = vcos_event_wait(&instance->msg_avail_event);
9583 +               if (success != VCOS_SUCCESS) {
9584 +                       LOG_ERR("%s: failed on waiting for event (status=%d)",
9585 +                               __func__, success);
9586 +
9587 +                       ret = -1;
9588 +                       goto unlock;
9589 +               }
9590 +       }
9591 +       if (instance->result != 0) {
9592 +               LOG_ERR("%s: failed result (status=%d)",
9593 +                       __func__, instance->result);
9594 +
9595 +               ret = -1;
9596 +               goto unlock;
9597 +       }
9598 +
9599 +       ret = 0;
9600 +
9601 +unlock:
9602 +       vchi_service_release(instance->vchi_handle[0]);
9603 +       vcos_mutex_unlock(&instance->vchi_mutex);
9604 +
9605 +       /* Stop the audio service */
9606 +       if (instance) {
9607 +               vc_vchi_audio_deinit(instance);
9608 +               alsa_stream->instance = NULL;
9609 +       }
9610 +       LOG_DBG(" .. OUT\n");
9611 +       return ret;
9612 +}
9613 +
9614 +int bcm2835_audio_write(bcm2835_alsa_stream_t * alsa_stream, uint32_t count,
9615 +                       void *src)
9616 +{
9617 +       VC_AUDIO_MSG_T m;
9618 +       AUDIO_INSTANCE_T *instance = alsa_stream->instance;
9619 +       int32_t success;
9620 +       int ret;
9621 +
9622 +       LOG_DBG(" .. IN\n");
9623 +
9624 +       LOG_INFO(" Writing %d bytes from %p\n", count, src);
9625 +
9626 +       vcos_mutex_lock(&instance->vchi_mutex);
9627 +       vchi_service_use(instance->vchi_handle[0]);
9628 +
9629 +       m.type = VC_AUDIO_MSG_TYPE_WRITE;
9630 +       m.u.write.count = count;
9631 +       m.u.write.callback = alsa_stream->fifo_irq_handler;
9632 +       m.u.write.cookie = alsa_stream;
9633 +       m.u.write.silence = src == NULL;
9634 +
9635 +       /* Send the message to the videocore */
9636 +       success = vchi_msg_queue(instance->vchi_handle[0],
9637 +                                &m, sizeof m,
9638 +                                VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL);
9639 +
9640 +       if (success != 0) {
9641 +               LOG_ERR("%s: failed on vchi_msg_queue (status=%d)",
9642 +                       __func__, success);
9643 +
9644 +               ret = -1;
9645 +               goto unlock;
9646 +       }
9647 +       LOG_DBG(" ... sent header\n");
9648 +       if (!m.u.write.silence) {
9649 +               /* Send the message to the videocore */
9650 +               success = vchi_bulk_queue_transmit(instance->vchi_handle[0],
9651 +                                                  src, count,
9652 +                                                  0 *
9653 +                                                  VCHI_FLAGS_BLOCK_UNTIL_QUEUED
9654 +                                                  +
9655 +                                                  1 *
9656 +                                                  VCHI_FLAGS_BLOCK_UNTIL_DATA_READ,
9657 +                                                  NULL);
9658 +               if (success != 0) {
9659 +                       LOG_ERR
9660 +                           ("%s: failed on vchi_bulk_queue_transmit (status=%d)",
9661 +                            __func__, success);
9662 +
9663 +                       ret = -1;
9664 +                       goto unlock;
9665 +               }
9666 +       }
9667 +       ret = 0;
9668 +
9669 +unlock:
9670 +       vchi_service_release(instance->vchi_handle[0]);
9671 +       vcos_mutex_unlock(&instance->vchi_mutex);
9672 +       LOG_DBG(" .. OUT\n");
9673 +       return ret;
9674 +}
9675 +
9676 +/**
9677 +  * Returns all buffers from arm->vc
9678 +  */
9679 +void bcm2835_audio_flush_buffers(bcm2835_alsa_stream_t * alsa_stream)
9680 +{
9681 +       LOG_DBG(" .. IN\n");
9682 +       LOG_DBG(" .. OUT\n");
9683 +       return;
9684 +}
9685 +
9686 +/**
9687 +  * Forces VC to flush(drop) its filled playback buffers and 
9688 +  * return them the us. (VC->ARM)
9689 +  */
9690 +void bcm2835_audio_flush_playback_buffers(bcm2835_alsa_stream_t * alsa_stream)
9691 +{
9692 +       LOG_DBG(" .. IN\n");
9693 +       LOG_DBG(" .. OUT\n");
9694 +}
9695 +
9696 +uint32_t bcm2835_audio_retrieve_buffers(bcm2835_alsa_stream_t * alsa_stream)
9697 +{
9698 +       uint32_t count = atomic_read(&alsa_stream->retrieved);
9699 +       atomic_sub(count, &alsa_stream->retrieved);
9700 +       return count;
9701 +}
9702 --- /dev/null
9703 +++ b/sound/arm/bcm2835.c
9704 @@ -0,0 +1,424 @@
9705 +/*****************************************************************************
9706 +* Copyright 2011 Broadcom Corporation.  All rights reserved.
9707 +*
9708 +* Unless you and Broadcom execute a separate written software license
9709 +* agreement governing use of this software, this software is licensed to you
9710 +* under the terms of the GNU General Public License version 2, available at
9711 +* http://www.broadcom.com/licenses/GPLv2.php (the "GPL").
9712 +*      
9713 +* Notwithstanding the above, under no circumstances may you combine this
9714 +* software in any way with any other Broadcom software provided under a
9715 +* license other than the GPL, without Broadcom's express prior written
9716 +* consent.
9717 +*****************************************************************************/
9718 +
9719 +#include <linux/platform_device.h>
9720 +
9721 +#include <linux/init.h>
9722 +#include <linux/slab.h>
9723 +#include <linux/module.h>
9724 +
9725 +#include "bcm2835.h"
9726 +
9727 +/* module parameters (see "Module Parameters") */
9728 +/* SNDRV_CARDS: maximum number of cards supported by this module */
9729 +static int index[MAX_SUBSTREAMS] = {[0 ... (MAX_SUBSTREAMS - 1)] = -1 };
9730 +static char *id[MAX_SUBSTREAMS] = {[0 ... (MAX_SUBSTREAMS - 1)] = NULL };
9731 +static int enable[MAX_SUBSTREAMS] = {[0 ... (MAX_SUBSTREAMS - 1)] = 1 };
9732 +
9733 +/* HACKY global pointers needed for successive probes to work : ssp
9734 + * But compared against the changes we will have to do in VC audio_ipc code
9735 + * to export 8 audio_ipc devices as a single IPC device and then monitor all
9736 + * four devices in a thread, this gets things done quickly and should be easier
9737 + * to debug if we run into issues
9738 + */
9739 +
9740 +static struct snd_card *g_card = NULL;
9741 +static bcm2835_chip_t *g_chip = NULL;
9742 +
9743 +static int snd_bcm2835_free(bcm2835_chip_t * chip)
9744 +{
9745 +       kfree(chip);
9746 +       return 0;
9747 +}
9748 +
9749 +/* component-destructor
9750 + * (see "Management of Cards and Components")
9751 + */
9752 +static int snd_bcm2835_dev_free(struct snd_device *device)
9753 +{
9754 +       return snd_bcm2835_free(device->device_data);
9755 +}
9756 +
9757 +/* chip-specific constructor
9758 + * (see "Management of Cards and Components")
9759 + */
9760 +static int __devinit snd_bcm2835_create(struct snd_card *card,
9761 +                                       struct platform_device *pdev,
9762 +                                       bcm2835_chip_t ** rchip)
9763 +{
9764 +       bcm2835_chip_t *chip;
9765 +       int err;
9766 +       static struct snd_device_ops ops = {
9767 +               .dev_free = snd_bcm2835_dev_free,
9768 +       };
9769 +
9770 +       *rchip = NULL;
9771 +
9772 +       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
9773 +       if (chip == NULL)
9774 +               return -ENOMEM;
9775 +
9776 +       chip->card = card;
9777 +
9778 +       err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
9779 +       if (err < 0) {
9780 +               snd_bcm2835_free(chip);
9781 +               return err;
9782 +       }
9783 +
9784 +       *rchip = chip;
9785 +       return 0;
9786 +}
9787 +
9788 +static int __devinit snd_bcm2835_alsa_probe(struct platform_device *pdev)
9789 +{
9790 +       static int dev;
9791 +       bcm2835_chip_t *chip;
9792 +       struct snd_card *card;
9793 +       int err;
9794 +       printk(KERN_INFO "### snd_bcm2835_alsa_probe %p ###", pdev);
9795 +
9796 +       printk
9797 +           ("############ PROBING FOR bcm2835 ALSA device (%d):(%d) ###############\n",
9798 +            dev, enable[dev]);
9799 +
9800 +       if (dev >= MAX_SUBSTREAMS)
9801 +               return -ENODEV;
9802 +
9803 +       if (!enable[dev]) {
9804 +               dev++;
9805 +               return -ENOENT;
9806 +       }
9807 +
9808 +       if (dev > 0)
9809 +               goto add_register_map;
9810 +
9811 +       printk("Creating card...\n");
9812 +       err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &g_card);
9813 +       if (err < 0)
9814 +               goto out;
9815 +
9816 +       snd_card_set_dev(g_card, &pdev->dev);
9817 +       strcpy(g_card->driver, "BRCM bcm2835 ALSA Driver");
9818 +       strcpy(g_card->shortname, "bcm2835 ALSA");
9819 +       sprintf(g_card->longname, "%s", g_card->shortname);
9820 +
9821 +       printk("Creating device/chip ..\n");
9822 +       err = snd_bcm2835_create(g_card, pdev, &chip);
9823 +       if (err < 0) {
9824 +               printk(KERN_ERR "Failed to create bcm2835 chip\n");
9825 +               goto out_bcm2835_create;
9826 +       }
9827 +
9828 +       g_chip = chip;
9829 +       err = snd_bcm2835_new_pcm(chip);
9830 +       if (err < 0) {
9831 +               printk(KERN_ERR "Failed to create new BCM2835 pcm device\n");
9832 +               goto out_bcm2835_new_pcm;
9833 +       }
9834 +
9835 +       printk("Adding controls ..\n");
9836 +       err = snd_bcm2835_new_ctl(chip);
9837 +       if (err < 0) {
9838 +               printk(KERN_ERR "Failed to create new BCM2835 ctl\n");
9839 +               goto out_bcm2835_new_ctl;
9840 +       }
9841 +
9842 +add_register_map:
9843 +       card = g_card;
9844 +       chip = g_chip;
9845 +
9846 +       BUG_ON(!(card && chip));
9847 +
9848 +       chip->avail_substreams |= (1 << dev);
9849 +       chip->pdev[dev] = pdev;
9850 +
9851 +       if (dev == 0) {
9852 +               printk("Registering card ....\n");
9853 +               err = snd_card_register(card);
9854 +               if (err < 0) {
9855 +                       printk(KERN_ERR
9856 +                              "Failed to register bcm2835 ALSA card \n");
9857 +                       goto out_card_register;
9858 +               }
9859 +               platform_set_drvdata(pdev, card);
9860 +               printk("bcm2835 ALSA CARD CREATED!\n");
9861 +       } else {
9862 +               printk("bcm2835 ALSA CHIP CREATED!\n");
9863 +               platform_set_drvdata(pdev, (void *)dev);
9864 +       }
9865 +
9866 +       dev++;
9867 +
9868 +       return 0;
9869 +
9870 +out_card_register:
9871 +out_bcm2835_new_ctl:
9872 +out_bcm2835_new_pcm:
9873 +out_bcm2835_create:
9874 +       BUG_ON(!g_card);
9875 +       if (snd_card_free(g_card))
9876 +               printk(KERN_ERR "Failed to free Registered alsa card\n");
9877 +       g_card = NULL;
9878 +out:
9879 +       dev = SNDRV_CARDS;      /* stop more avail_substreams from being probed */
9880 +       printk(KERN_ERR "BCM2835 ALSA Probe failed !!\n");
9881 +       return err;
9882 +}
9883 +
9884 +static int snd_bcm2835_alsa_remove(struct platform_device *pdev)
9885 +{
9886 +       uint32_t idx;
9887 +       void *drv_data;
9888 +
9889 +       drv_data = platform_get_drvdata(pdev);
9890 +
9891 +       if (drv_data == (void *)g_card) {
9892 +               /* This is the card device */
9893 +               snd_card_free((struct snd_card *)drv_data);
9894 +               g_card = NULL;
9895 +               g_chip = NULL;
9896 +       } else {
9897 +               idx = (uint32_t) drv_data;
9898 +               if (g_card != NULL) {
9899 +                       BUG_ON(!g_chip);
9900 +                       /* We pass chip device numbers in audio ipc devices
9901 +                        * other than the one we registered our card with
9902 +                        */
9903 +                       idx = (uint32_t) drv_data;
9904 +                       BUG_ON(!idx || idx > MAX_SUBSTREAMS);
9905 +                       g_chip->avail_substreams &= ~(1 << idx);
9906 +                       /* There should be atleast one substream registered
9907 +                        * after we are done here, as it wil be removed when
9908 +                        * the *remove* is called for the card device
9909 +                        */
9910 +                       BUG_ON(!g_chip->avail_substreams);
9911 +               }
9912 +       }
9913 +
9914 +       platform_set_drvdata(pdev, NULL);
9915 +
9916 +       return 0;
9917 +}
9918 +
9919 +#ifdef CONFIG_PM
9920 +static int snd_bcm2835_alsa_suspend(struct platform_device *pdev,
9921 +                                   pm_message_t state)
9922 +{
9923 +       return 0;
9924 +}
9925 +
9926 +static int snd_bcm2835_alsa_resume(struct platform_device *pdev)
9927 +{
9928 +       return 0;
9929 +}
9930 +
9931 +#endif
9932 +
9933 +static struct platform_driver bcm2835_alsa0_driver = {
9934 +       .probe = snd_bcm2835_alsa_probe,
9935 +       .remove = snd_bcm2835_alsa_remove,
9936 +#ifdef CONFIG_PM
9937 +       .suspend = snd_bcm2835_alsa_suspend,
9938 +       .resume = snd_bcm2835_alsa_resume,
9939 +#endif
9940 +       .driver = {
9941 +                  .name = "bcm2835_AUD0",
9942 +                  .owner = THIS_MODULE,
9943 +                  },
9944 +};
9945 +
9946 +static struct platform_driver bcm2835_alsa1_driver = {
9947 +       .probe = snd_bcm2835_alsa_probe,
9948 +       .remove = snd_bcm2835_alsa_remove,
9949 +#ifdef CONFIG_PM
9950 +       .suspend = snd_bcm2835_alsa_suspend,
9951 +       .resume = snd_bcm2835_alsa_resume,
9952 +#endif
9953 +       .driver = {
9954 +                  .name = "bcm2835_AUD1",
9955 +                  .owner = THIS_MODULE,
9956 +                  },
9957 +};
9958 +
9959 +static struct platform_driver bcm2835_alsa2_driver = {
9960 +       .probe = snd_bcm2835_alsa_probe,
9961 +       .remove = snd_bcm2835_alsa_remove,
9962 +#ifdef CONFIG_PM
9963 +       .suspend = snd_bcm2835_alsa_suspend,
9964 +       .resume = snd_bcm2835_alsa_resume,
9965 +#endif
9966 +       .driver = {
9967 +                  .name = "bcm2835_AUD2",
9968 +                  .owner = THIS_MODULE,
9969 +                  },
9970 +};
9971 +
9972 +static struct platform_driver bcm2835_alsa3_driver = {
9973 +       .probe = snd_bcm2835_alsa_probe,
9974 +       .remove = snd_bcm2835_alsa_remove,
9975 +#ifdef CONFIG_PM
9976 +       .suspend = snd_bcm2835_alsa_suspend,
9977 +       .resume = snd_bcm2835_alsa_resume,
9978 +#endif
9979 +       .driver = {
9980 +                  .name = "bcm2835_AUD3",
9981 +                  .owner = THIS_MODULE,
9982 +                  },
9983 +};
9984 +
9985 +static struct platform_driver bcm2835_alsa4_driver = {
9986 +       .probe = snd_bcm2835_alsa_probe,
9987 +       .remove = snd_bcm2835_alsa_remove,
9988 +#ifdef CONFIG_PM
9989 +       .suspend = snd_bcm2835_alsa_suspend,
9990 +       .resume = snd_bcm2835_alsa_resume,
9991 +#endif
9992 +       .driver = {
9993 +                  .name = "bcm2835_AUD4",
9994 +                  .owner = THIS_MODULE,
9995 +                  },
9996 +};
9997 +
9998 +static struct platform_driver bcm2835_alsa5_driver = {
9999 +       .probe = snd_bcm2835_alsa_probe,
10000 +       .remove = snd_bcm2835_alsa_remove,
10001 +#ifdef CONFIG_PM
10002 +       .suspend = snd_bcm2835_alsa_suspend,
10003 +       .resume = snd_bcm2835_alsa_resume,
10004 +#endif
10005 +       .driver = {
10006 +                  .name = "bcm2835_AUD5",
10007 +                  .owner = THIS_MODULE,
10008 +                  },
10009 +};
10010 +
10011 +static struct platform_driver bcm2835_alsa6_driver = {
10012 +       .probe = snd_bcm2835_alsa_probe,
10013 +       .remove = snd_bcm2835_alsa_remove,
10014 +#ifdef CONFIG_PM
10015 +       .suspend = snd_bcm2835_alsa_suspend,
10016 +       .resume = snd_bcm2835_alsa_resume,
10017 +#endif
10018 +       .driver = {
10019 +                  .name = "bcm2835_AUD6",
10020 +                  .owner = THIS_MODULE,
10021 +                  },
10022 +};
10023 +
10024 +static struct platform_driver bcm2835_alsa7_driver = {
10025 +       .probe = snd_bcm2835_alsa_probe,
10026 +       .remove = snd_bcm2835_alsa_remove,
10027 +#ifdef CONFIG_PM
10028 +       .suspend = snd_bcm2835_alsa_suspend,
10029 +       .resume = snd_bcm2835_alsa_resume,
10030 +#endif
10031 +       .driver = {
10032 +                  .name = "bcm2835_AUD7",
10033 +                  .owner = THIS_MODULE,
10034 +                  },
10035 +};
10036 +
10037 +static int __devinit bcm2835_alsa_device_init(void)
10038 +{
10039 +       int err;
10040 +       err = platform_driver_register(&bcm2835_alsa0_driver);
10041 +       if (err) {
10042 +               printk("Error registering bcm2835_alsa0_driver %d .\n", err);
10043 +               goto out;
10044 +       }
10045 +
10046 +       err = platform_driver_register(&bcm2835_alsa1_driver);
10047 +       if (err) {
10048 +               printk("Error registering bcm2835_alsa1_driver %d .\n", err);
10049 +               goto unregister_0;
10050 +       }
10051 +
10052 +       err = platform_driver_register(&bcm2835_alsa2_driver);
10053 +       if (err) {
10054 +               printk("Error registering bcm2835_alsa2_driver %d .\n", err);
10055 +               goto unregister_1;
10056 +       }
10057 +
10058 +       err = platform_driver_register(&bcm2835_alsa3_driver);
10059 +       if (err) {
10060 +               printk("Error registering bcm2835_alsa3_driver %d .\n", err);
10061 +               goto unregister_2;
10062 +       }
10063 +
10064 +       err = platform_driver_register(&bcm2835_alsa4_driver);
10065 +       if (err) {
10066 +               printk("Error registering bcm2835_alsa4_driver %d .\n", err);
10067 +               goto unregister_3;
10068 +       }
10069 +
10070 +       err = platform_driver_register(&bcm2835_alsa5_driver);
10071 +       if (err) {
10072 +               printk("Error registering bcm2835_alsa5_driver %d .\n", err);
10073 +               goto unregister_4;
10074 +       }
10075 +
10076 +       err = platform_driver_register(&bcm2835_alsa6_driver);
10077 +       if (err) {
10078 +               printk("Error registering bcm2835_alsa6_driver %d .\n", err);
10079 +               goto unregister_5;
10080 +       }
10081 +
10082 +       err = platform_driver_register(&bcm2835_alsa7_driver);
10083 +       if (err) {
10084 +               printk("Error registering bcm2835_alsa7_driver %d .\n", err);
10085 +               goto unregister_6;
10086 +       }
10087 +       printk(KERN_INFO "### BCM2835 ALSA driver init %s ### \n",
10088 +              err ? "FAILED" : "OK");
10089 +
10090 +       return 0;
10091 +
10092 +unregister_6:
10093 +       platform_driver_unregister(&bcm2835_alsa6_driver);
10094 +unregister_5:
10095 +       platform_driver_unregister(&bcm2835_alsa5_driver);
10096 +unregister_4:
10097 +       platform_driver_unregister(&bcm2835_alsa4_driver);
10098 +unregister_3:
10099 +       platform_driver_unregister(&bcm2835_alsa3_driver);
10100 +unregister_2:
10101 +       platform_driver_unregister(&bcm2835_alsa2_driver);
10102 +unregister_1:
10103 +       platform_driver_unregister(&bcm2835_alsa1_driver);
10104 +unregister_0:
10105 +       platform_driver_unregister(&bcm2835_alsa0_driver);
10106 +out:
10107 +       return err;
10108 +}
10109 +
10110 +static void __devexit bcm2835_alsa_device_exit(void)
10111 +{
10112 +       platform_driver_unregister(&bcm2835_alsa0_driver);
10113 +       platform_driver_unregister(&bcm2835_alsa1_driver);
10114 +       platform_driver_unregister(&bcm2835_alsa2_driver);
10115 +       platform_driver_unregister(&bcm2835_alsa3_driver);
10116 +       platform_driver_unregister(&bcm2835_alsa4_driver);
10117 +       platform_driver_unregister(&bcm2835_alsa5_driver);
10118 +       platform_driver_unregister(&bcm2835_alsa6_driver);
10119 +       platform_driver_unregister(&bcm2835_alsa7_driver);
10120 +}
10121 +
10122 +late_initcall(bcm2835_alsa_device_init);
10123 +module_exit(bcm2835_alsa_device_exit);
10124 +
10125 +MODULE_AUTHOR("Dom Cobley");
10126 +MODULE_DESCRIPTION("Alsa driver for BCM2835 chip");
10127 +MODULE_LICENSE("GPL");
10128 +MODULE_ALIAS("platform:bcm2835_alsa");
10129 --- /dev/null
10130 +++ b/sound/arm/bcm2835.h
10131 @@ -0,0 +1,242 @@
10132 +/*****************************************************************************
10133 +* Copyright 2011 Broadcom Corporation.  All rights reserved.
10134 +*
10135 +* Unless you and Broadcom execute a separate written software license
10136 +* agreement governing use of this software, this software is licensed to you
10137 +* under the terms of the GNU General Public License version 2, available at
10138 +* http://www.broadcom.com/licenses/GPLv2.php (the "GPL").
10139 +*      
10140 +* Notwithstanding the above, under no circumstances may you combine this
10141 +* software in any way with any other Broadcom software provided under a
10142 +* license other than the GPL, without Broadcom's express prior written
10143 +* consent.
10144 +*****************************************************************************/
10145 +
10146 +#ifndef __SOUND_ARM_BCM2835_H
10147 +#define __SOUND_ARM_BCM2835_H
10148 +
10149 +#define SUBSTREAM_NUM 1
10150 +
10151 +#include <linux/device.h>
10152 +#include <linux/list.h>
10153 +#include <linux/interrupt.h>
10154 +#include <linux/wait.h>
10155 +#include <sound/core.h>
10156 +#include <sound/initval.h>
10157 +#include <sound/pcm.h>
10158 +#include <sound/pcm_params.h>
10159 +#include <linux/workqueue.h>
10160 +
10161 +/* #define DUMP_RAW_DATA */
10162 +//#define AUDIO_DEBUG_ENABLE
10163 +//#define AUDIO_VERBOSE_DEBUG_ENABLE
10164 +
10165 +/* Debug macros */
10166 +#ifdef AUDIO_DEBUG_ENABLE
10167 +
10168 +#ifdef AUDIO_VERBOSE_DEBUG_ENABLE
10169 +
10170 +#define audio_debug(fmt, arg...)       \
10171 +       printk(KERN_INFO"%s:%d " fmt, __func__, __LINE__, ##arg)
10172 +
10173 +#define audio_info(fmt, arg...)        \
10174 +       printk(KERN_INFO"%s:%d " fmt, __func__, __LINE__, ##arg)
10175 +
10176 +#else
10177 +
10178 +#define audio_debug(fmt, arg...)       do {} while (0)
10179 +
10180 +#define audio_info(fmt, arg...)                do {} while (0)
10181 +
10182 +#endif /* AUDIO_VERBOSE_DEBUG_ENABLE */
10183 +
10184 +#else
10185 +
10186 +#define audio_debug(fmt, arg...)       do {} while (0)
10187 +
10188 +#define audio_info(fmt, arg...)                do {} while (0)
10189 +
10190 +#endif /* AUDIO_DEBUG_ENABLE */
10191 +
10192 +#define audio_error(fmt, arg...)       \
10193 +       printk(KERN_ERR"%s:%d " fmt, __func__, __LINE__, ##arg)
10194 +
10195 +#define audio_warning(fmt, arg...)     \
10196 +       printk(KERN_WARNING"%s:%d " fmt, __func__, __LINE__, ##arg)
10197 +
10198 +#define audio_alert(fmt, arg...)       \
10199 +       printk(KERN_ALERT"%s:%d " fmt, __func__, __LINE__, ##arg)
10200 +
10201 +#define MAX_SUBSTREAMS                 (8)
10202 +#define AVAIL_SUBSTREAMS_MASK          (0xff)
10203 +
10204 +#define AUDIO_IPC_BLOCK_NUM_BUFFERS    (8)
10205 +#define AUDIO_IPC_BLOCK_BUFFER_SIZE    (1024*8)
10206 +
10207 +#define AUDIO_CONTROL_OFFSET                   (0x00)
10208 +#define CTRL_EN_SHIFT                  (0)
10209 +#define CTRL_EN_MASK                   (0x00000001)
10210 +#define CTRL_PLAY_SHIFT                        (1)
10211 +#define CTRL_PLAY_MASK                 (0x00000002)
10212 +#define CTRL_MUTE_SHIFT                        (2)
10213 +#define CTRL_MUTE_MASK                 (0x00000004)
10214 +#define CTRL_SETUP_SHIFT               (3)
10215 +#define CTRL_SETUP_MASK                        (0x00000008)
10216 +#define CTRL_FLUSH_SHIFT           (4)
10217 +#define CTRL_FLUSH_MASK                        (0x00000010)
10218 +#define CTRL_STOPMODE_SHIFT        (5)
10219 +#define CTRL_STOPMODE_MASK             (0x00000020)
10220 +
10221 +#define AUDIO_STATUS_OFFSET                    (0x04)
10222 +#define STAT_EN_SHIFT                  (0)
10223 +#define STAT_EN_MASK                   (0x00000001)
10224 +#define STAT_PLAY_SHIFT                        (1)
10225 +#define STAT_PLAY_MASK                 (0x00000002)
10226 +#define STAT_MUTE_SHIFT                        (2)
10227 +#define STAT_MUTE_MASK                 (0x00000004)
10228 +#define STAT_SETUP_SHIFT               (3)
10229 +#define STAT_SETUP_MASK                        (0x00000008)
10230 +#define STAT_FLUSH_SHIFT           (4)
10231 +#define STAT_FLUSH_MASK                        (0x00000010)
10232 +#define STAT_STOPMODE_SHIFT        (5)
10233 +#define STAT_STOPMODE_MASK             (0x00000020)
10234 +
10235 +/* Interrupt status */
10236 +#define AUDIO_INTSTAT_OFFSET                   (0x08)
10237 +#define INTSTAT_CONTROL_SHIFT          (0)
10238 +#define INTSTAT_CONTROL_MASK           (0x0000000f)
10239 +#define INTSTAT_FIFO_SHIFT             (4)
10240 +#define INTSTAT_FIFO_MASK              (0x000000f0)
10241 +
10242 +/* Configuration */
10243 +#define AUDIO_DESTINATION_OFFSET               (0x0C)
10244 +#define AUDIO_SAMPLE_RATE_OFFSET               (0x10)
10245 +#define AUDIO_BIT_RATE_OFFSET                  (0x14)
10246 +#define AUDIO_VOLUME_OFFSET                    (0x18)
10247 +#define AUDIO_CHANNELS_OFFSET                  (0x1C)
10248 +
10249 +/* Implemention of peterson's algorithm for shared memory semaphores */
10250 +#define AUDIO_FLAG0_OFFSET                     (0x20)
10251 +#define AUDIO_FLAG1_OFFSET                     (0x24)
10252 +#define AUDIO_TURN_OFFSET                      (0x28)
10253 +
10254 +/* Fifo registers */
10255 +#define AUDIO_IN_WRITE_PTR_OFFSET              (0x30)
10256 +#define AUDIO_IN_READ_PTR_OFFSET               (0x34)
10257 +#define AUDIO_IN_FIFO_SIZE_OFFSET              (0x38)
10258 +#define AUDIO_IN_FIFO_ENTRY_OFFSET             (0x3C)
10259 +#define AUDIO_IN_FIFO_START_OFFSET             (0x40)
10260 +
10261 +/* 8 entries here of 4 words each = 0x80 gap from 0x50 */
10262 +#define AUDIO_IN_FIFO_OFFSET                   (0x50)
10263 +
10264 +#define AUDIO_OUT_WRITE_PTR_OFFSET             (0xD0)
10265 +#define AUDIO_OUT_READ_PTR_OFFSET              (0xD4)
10266 +#define AUDIO_OUT_FIFO_SIZE_OFFSET             (0xD8)
10267 +#define AUDIO_OUT_FIFO_ENTRY_OFFSET            (0xDC)
10268 +#define AUDIO_OUT_FIFO_START_OFFSET            (0xE0)
10269 +
10270 +/* 8 entries here of 4 words each = 0x80 gap from 0xF0 */
10271 +#define AUDIO_OUT_FIFO_OFFSET                  (0xF0)
10272 +
10273 +/* Some constants for values .. */
10274 +typedef enum {
10275 +       AUDIO_DEST_AUTO = 0,
10276 +       AUDIO_DEST_HEADPHONES = 1,
10277 +       AUDIO_DEST_HDMI = 2,
10278 +       AUDIO_DEST_MAX,
10279 +} SND_BCM2835_ROUTE_T;
10280 +
10281 +typedef enum {
10282 +       PCM_PLAYBACK_VOLUME,
10283 +       PCM_PLAYBACK_MUTE,
10284 +       PCM_PLAYBACK_DEVICE,
10285 +} SND_BCM2835_CTRL_T;
10286 +
10287 +/* this struct is tightly packed - its size is 16bytes */
10288 +typedef struct {
10289 +       uint32_t buffer_id;
10290 +       uint32_t buffer_size;
10291 +       uint32_t buffer_ptr;
10292 +       uint32_t spare;
10293 +
10294 +} AUDIO_FIFO_ENTRY_T;
10295 +
10296 +/* definition of the chip-specific record */
10297 +typedef struct bcm2835_chip {
10298 +       struct snd_card *card;
10299 +       struct snd_pcm *pcm;
10300 +       /* Bitmat for valid reg_base and irq numbers */
10301 +       uint32_t avail_substreams;
10302 +       struct platform_device *pdev[MAX_SUBSTREAMS];
10303 +       struct bcm2835_alsa_stream *alsa_stream[MAX_SUBSTREAMS];
10304 +
10305 +       int volume;
10306 +       int dest;
10307 +       int mute;
10308 +} bcm2835_chip_t;
10309 +
10310 +typedef struct bcm2835_audio_buffer {
10311 +       uint32_t buffer_id;
10312 +       phys_addr_t bus_addr;
10313 +       uint8_t __iomem *start;
10314 +       uint32_t size;
10315 +       uint32_t data_left;
10316 +       struct list_head link;
10317 +
10318 +} bcm2835_audio_buffer_t;
10319 +
10320 +typedef struct bcm2835_alsa_stream {
10321 +       bcm2835_chip_t *chip;
10322 +       struct snd_pcm_substream *substream;
10323 +
10324 +       struct semaphore buffers_update_sem;
10325 +       struct semaphore control_sem;
10326 +       spinlock_t lock;
10327 +       volatile uint32_t control;
10328 +       volatile uint32_t status;
10329 +
10330 +       int open;
10331 +       int running;
10332 +       int draining;
10333 +
10334 +#ifdef DUMP_RAW_DATA
10335 +       /* for debug */
10336 +       int file;
10337 +#endif
10338 +       unsigned int pos;
10339 +       unsigned int buffer_size;
10340 +       unsigned int period_size;
10341 +
10342 +       uint32_t enable_fifo_irq;
10343 +       irq_handler_t fifo_irq_handler;
10344 +
10345 +       atomic_t retrieved;
10346 +       struct opaque_AUDIO_INSTANCE_T *instance;
10347 +       struct workqueue_struct *my_wq;
10348 +       int idx;
10349 +} bcm2835_alsa_stream_t;
10350 +
10351 +int snd_bcm2835_new_ctl(bcm2835_chip_t * chip);
10352 +int snd_bcm2835_new_pcm(bcm2835_chip_t * chip);
10353 +
10354 +void bcm2835_audio_fifo_get_lock(bcm2835_alsa_stream_t * alsa_stream);
10355 +void bcm2835_audio_fifo_put_lock(bcm2835_alsa_stream_t * alsa_stream);
10356 +
10357 +int bcm2835_audio_open(bcm2835_alsa_stream_t * alsa_stream);
10358 +int bcm2835_audio_close(bcm2835_alsa_stream_t * alsa_stream);
10359 +int bcm2835_audio_set_params(bcm2835_alsa_stream_t * alsa_stream,
10360 +                            uint32_t channels, uint32_t samplerate,
10361 +                            uint32_t bps);
10362 +int bcm2835_audio_setup(bcm2835_alsa_stream_t * alsa_stream);
10363 +int bcm2835_audio_start(bcm2835_alsa_stream_t * alsa_stream);
10364 +int bcm2835_audio_stop(bcm2835_alsa_stream_t * alsa_stream);
10365 +int bcm2835_audio_set_ctls(bcm2835_chip_t * chip);
10366 +int bcm2835_audio_write(bcm2835_alsa_stream_t * alsa_stream, uint32_t count,
10367 +                       void *src);
10368 +//uint32_t bcm2835_audio_buffers_consumed_bytes(bcm2835_alsa_stream_t *alsa_stream);
10369 +uint32_t bcm2835_audio_retrieve_buffers(bcm2835_alsa_stream_t * alsa_stream);
10370 +void bcm2835_audio_flush_buffers(bcm2835_alsa_stream_t * alsa_stream);
10371 +void bcm2835_audio_flush_playback_buffers(bcm2835_alsa_stream_t * alsa_stream);
10372 +
10373 +#endif /* __SOUND_ARM_BCM2835_H */
10374 --- /dev/null
10375 +++ b/sound/arm/vc_vchi_audioserv_defs.h
10376 @@ -0,0 +1,112 @@
10377 +/*****************************************************************************
10378 +* Copyright 2011 Broadcom Corporation.  All rights reserved.
10379 +*
10380 +* Unless you and Broadcom execute a separate written software license
10381 +* agreement governing use of this software, this software is licensed to you
10382 +* under the terms of the GNU General Public License version 2, available at
10383 +* http://www.broadcom.com/licenses/GPLv2.php (the "GPL").
10384 +*
10385 +* Notwithstanding the above, under no circumstances may you combine this
10386 +* software in any way with any other Broadcom software provided under a
10387 +* license other than the GPL, without Broadcom's express prior written
10388 +* consent.
10389 +*****************************************************************************/
10390 +
10391 +#ifndef _VC_AUDIO_DEFS_H_
10392 +#define _VC_AUDIO_DEFS_H_
10393 +
10394 +// FourCC code used for VCHI connection
10395 +#define VC_AUDIO_SERVER_NAME  MAKE_FOURCC("AUDS")
10396 +
10397 +// Maximum message length
10398 +#define VC_AUDIO_MAX_MSG_LEN  (sizeof( VC_AUDIO_MSG_T ))
10399 +
10400 +// List of screens that are currently supported
10401 +// All message types supported for HOST->VC direction
10402 +typedef enum {
10403 +       VC_AUDIO_MSG_TYPE_RESULT,       // Generic result
10404 +       VC_AUDIO_MSG_TYPE_COMPLETE,     // Generic result
10405 +       VC_AUDIO_MSG_TYPE_CONFIG,       // Configure audio
10406 +       VC_AUDIO_MSG_TYPE_CONTROL,      // Configure audio
10407 +       VC_AUDIO_MSG_TYPE_OPEN, // Configure audio
10408 +       VC_AUDIO_MSG_TYPE_CLOSE,        // Configure audio
10409 +       VC_AUDIO_MSG_TYPE_START,        // Configure audio
10410 +       VC_AUDIO_MSG_TYPE_STOP, // Configure audio
10411 +       VC_AUDIO_MSG_TYPE_WRITE,        // Configure audio
10412 +       VC_AUDIO_MSG_TYPE_MAX
10413 +} VC_AUDIO_MSG_TYPE;
10414 +
10415 +// configure the audio
10416 +typedef struct {
10417 +       uint32_t channels;
10418 +       uint32_t samplerate;
10419 +       uint32_t bps;
10420 +
10421 +} VC_AUDIO_CONFIG_T;
10422 +
10423 +typedef struct {
10424 +       uint32_t volume;
10425 +       uint32_t dest;
10426 +
10427 +} VC_AUDIO_CONTROL_T;
10428 +
10429 +// audio
10430 +typedef struct {
10431 +       uint32_t dummy;
10432 +
10433 +} VC_AUDIO_OPEN_T;
10434 +
10435 +// audio
10436 +typedef struct {
10437 +       uint32_t dummy;
10438 +
10439 +} VC_AUDIO_CLOSE_T;
10440 +// audio
10441 +typedef struct {
10442 +       uint32_t dummy;
10443 +
10444 +} VC_AUDIO_START_T;
10445 +// audio
10446 +typedef struct {
10447 +       uint32_t draining;
10448 +
10449 +} VC_AUDIO_STOP_T;
10450 +
10451 +// configure the write audio samples
10452 +typedef struct {
10453 +       uint32_t count;         // in bytes
10454 +       void *callback;
10455 +       void *cookie;
10456 +       uint32_t silence;
10457 +} VC_AUDIO_WRITE_T;
10458 +
10459 +// Generic result for a request (VC->HOST)
10460 +typedef struct {
10461 +       int32_t success;        // Success value
10462 +
10463 +} VC_AUDIO_RESULT_T;
10464 +
10465 +// Generic result for a request (VC->HOST)
10466 +typedef struct {
10467 +       int32_t count;          // Success value
10468 +       void *callback;
10469 +       void *cookie;
10470 +} VC_AUDIO_COMPLETE_T;
10471 +
10472 +// Message header for all messages in HOST->VC direction
10473 +typedef struct {
10474 +       int32_t type;           // Message type (VC_AUDIO_MSG_TYPE)
10475 +       union {
10476 +               VC_AUDIO_CONFIG_T config;
10477 +               VC_AUDIO_CONTROL_T control;
10478 +               VC_AUDIO_OPEN_T open;
10479 +               VC_AUDIO_CLOSE_T close;
10480 +               VC_AUDIO_START_T start;
10481 +               VC_AUDIO_STOP_T stop;
10482 +               VC_AUDIO_WRITE_T write;
10483 +               VC_AUDIO_RESULT_T result;
10484 +               VC_AUDIO_COMPLETE_T complete;
10485 +       } u;
10486 +} VC_AUDIO_MSG_T;
10487 +
10488 +#endif // _VC_AUDIO_DEFS_H_