NULL pointer dereference in at91_udc on start of connection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I'm using a at91sam9260 processor on custom made board based on the
sam9260ek.
With the latest kernels (3.4-rc4 seem to be the last one working well)
whenever I try to connect the usb device port of the at91 processor to a
host I get the following error:

loop: module loaded
udc: at91_udc version 3 May 2006
 gadget: using random host ethernet address
usb0: MAC a2:46:1a:43:ea:9f
usb0: HOST MAC b6:aa:e6:b7:41:88
 gadget: Ethernet Gadget, version: Memorial Day 2008
 gadget: g_ether ready
rtc-at91sam9 rtc-at91sam9.0: rtc core: registered rtc-at91sam9 as rtc0
leds-gpio: probe of leds-gpio failed with error -22
TCP: cubic registered
NET: Registered protocol family 17
input: gpio-keys as /devices/platform/gpio-keys/input/input0
rtc-at91sam9 rtc-at91sam9.0: setting system clock to 2012-07-04 18:04:39
UTC (1341425079)
Unable to handle kernel NULL pointer dereference at virtual address
0000001a
pgd = c0004000
[0000001a] *pgd=00000000
Internal error: Oops: 5 [#1] ARM
Modules linked in:
CPU: 0    Not tainted  (3.5.0-rc5-00003-gca24a14-dirty #16)
PC is at composite_setup+0x54/0xa28
LR is at composite_setup+0x54/0xa28
pc : [<c018158c>]    lr : [<c018158c>]    psr: 60000093
sp : c02efe40  ip : 00000200  fp : 40000093
r10: 00000100  r9 : 00000004  r8 : 00000040
r7 : 00000000  r6 : c02efe98  r5 : 00000000  r4 : c030c834
r3 : c02fc4e0  r2 : c02fc4e0  r1 : 00000001  r0 : 0000000d
Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
Control: 0005317f  Table: 20004000  DAC: 00000017
Process swapper (pid: 0, stack limit = 0xc02ee270)
Stack: (0xc02efe40 to 0xc02f0000)
fe40: c380b7e0 c030c4c0 000888cf c4838030 00000040 c030c4c0 00000004
c030c650
fe60: 40000093 c0218d18 c0294bd7 c030c4c0 000888cf c4838030 c030c618
00000001
fe80: 00000004 c030c650 40000093 c017ec60 00000000 c02efe9f 01000680
00400000
fea0: c030d580 c38d59a0 c02febb8 0000000a 00000000 00000000 c0311f03
553fe0d2
fec0: 00000001 c0048aa0 c02febb8 c38d59a0 00000072 c02febb8 00000000
fefff000
fee0: c02eff54 c02fbe70 41069265 553fe0d2 00000000 c0048c38 c02febb8
c004af54
ff00: 0000000a c00484c4 000000c0 c000a234 c003a1c8 c018c724 00000013
c0008fb8
ff20: c02eff68 00000013 55a13bf2 00000000 c02fc0e8 c02eff68 00000000
00000000
ff40: c02fbe70 41069265 553fe0d2 00000000 00000007 c02eff68 c003a1c8
c018c724
ff60: 00000013 ffffffff 55a13bf2 00000000 00000000 c018c124 00000000
00000000
ff80: c02fc0e8 c02fbe70 20004000 202e61c4 00000000 c018c4f8 00000000
c02ee000
ffa0: c02f8b88 c02f88a4 c0312028 c000a500 c02f7f08 c02f60d0 ffffffff
c02e7420
ffc0: c03af300 c02d26c8 ffffffff ffffffff c02d21cc 00000000 00000000
c02e7420
ffe0: 00000000 00053175 c02f603c c02e741c c02f889c 20008040 00000000
00000000
[<c018158c>] (composite_setup+0x54/0xa28) from [<c017ec60>]
(at91_udc_irq+0x5e8/0x7ac)
[<c017ec60>] (at91_udc_irq+0x5e8/0x7ac) from [<c0048aa0>]
(handle_irq_event_percpu+0x30/0x1a0)
[<c0048aa0>] (handle_irq_event_percpu+0x30/0x1a0) from [<c0048c38>]
(handle_irq_event+0x28/0x38)
[<c0048c38>] (handle_irq_event+0x28/0x38) from [<c004af54>]
(handle_level_irq+0xbc/0xcc)
[<c004af54>] (handle_level_irq+0xbc/0xcc) from [<c00484c4>]
(generic_handle_irq+0x30/0x44)
[<c00484c4>] (generic_handle_irq+0x30/0x44) from [<c000a234>]
(handle_IRQ+0x60/0x98)
[<c000a234>] (handle_IRQ+0x60/0x98) from [<c0008fb8>]
(__irq_svc+0x38/0x60)
[<c0008fb8>] (__irq_svc+0x38/0x60) from [<c018c724>]
(cpuidle_wrap_enter+0x50/0xa0)
[<c018c724>] (cpuidle_wrap_enter+0x50/0xa0) from [<c018c4f8>]
(cpuidle_idle_call+0xa0/0x134)
[<c018c4f8>] (cpuidle_idle_call+0xa0/0x134) from [<c000a500>]
(cpu_idle+0x78/0xe8)
[<c000a500>] (cpu_idle+0x78/0xe8) from [<c02d26c8>]
(start_kernel+0x23c/0x27c)
[<c02d26c8>] (start_kernel+0x23c/0x27c) from [<20008040>] (0x20008040)
Code: e59f09b0 e1a01005 e58d8010 eb025dd7 (e5d5301a)
---[ end trace eb78f79a3e3c851b ]---
Kernel panic - not syncing: Fatal exception in interrupt

I've tracked the error to line 1099 of the file
drivers/usb/gadget/composite.c
This line is in the function "static int composite_setup(struct
usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)"
line 1099: req->zero = 0; // req is NULL, this is where it blows up

The function is called from the function "static void
handle_setup(struct at91_udc *udc, struct at91_ep *ep, u32 csr)" in
drivers/usb/gadget/at91_udc.c on line 1246
line 1246: status = udc->driver->setup(&udc->gadget, &pkt.r);

So, from at91_udc_irq to composite_setup the path seems to be:
at91_udc_irq (line 1490) -> handle_ep0 (line 1289) -> handle_setup (line
1264) -> composite_setup

I've tried bisecting and it points to this commit:
f3d8bf34c2c925867322197096ed501ceab8085a

I don't really see what this patch has to do with the problem but I've
attempted bisecting several times and I always end up here.
Not sure if it helps but here is the bisect log
git bisect start
# bad: [9e85a6f9dc231f3ed3c1dc1b12217505d970142a] Merge tag
'clk-fixes-for-linus' of git://git.linaro.org/people/mturquette/linux
git bisect bad 9e85a6f9dc231f3ed3c1dc1b12217505d970142a
# good: [61906313bd41cde2f9aaa14e461e6108d3e71aaa] Merge 3.4-rc6 into
usb-next
git bisect good 61906313bd41cde2f9aaa14e461e6108d3e71aaa
# bad: [fb827ec68446c83e9e8754fa9b55aed27ecc4661] Merge tag
'module-for-linus' of
git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus
git bisect bad fb827ec68446c83e9e8754fa9b55aed27ecc4661
# bad: [fb827ec68446c83e9e8754fa9b55aed27ecc4661] Merge tag
'module-for-linus' of
git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus
git bisect bad fb827ec68446c83e9e8754fa9b55aed27ecc4661
# good: [cb60e3e65c1b96a4d6444a7a13dc7dd48bc15a2b] Merge branch 'next'
of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
git bisect good cb60e3e65c1b96a4d6444a7a13dc7dd48bc15a2b
# good: [cb60e3e65c1b96a4d6444a7a13dc7dd48bc15a2b] Merge branch 'next'
of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
git bisect good cb60e3e65c1b96a4d6444a7a13dc7dd48bc15a2b
# bad: [fb09bafda67041b74a668dc9d77735e36bd33d3b] Merge tag
'staging-3.5-rc1' of
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
git bisect bad fb09bafda67041b74a668dc9d77735e36bd33d3b
# bad: [fb09bafda67041b74a668dc9d77735e36bd33d3b] Merge tag
'staging-3.5-rc1' of
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
git bisect bad fb09bafda67041b74a668dc9d77735e36bd33d3b
# bad: [a481991467d38afb43c3921d5b5b59ccb61b04ba] Merge tag
'usb-3.5-rc1' of
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
git bisect bad a481991467d38afb43c3921d5b5b59ccb61b04ba
# good: [813a95e5b4fa936bbde10ef89188932745dcd7f4] Merge tag 'pinctrl'
of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
git bisect good 813a95e5b4fa936bbde10ef89188932745dcd7f4
# good: [813a95e5b4fa936bbde10ef89188932745dcd7f4] Merge tag 'pinctrl'
of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
git bisect good 813a95e5b4fa936bbde10ef89188932745dcd7f4
# bad: [c8240c1b810ac4adc13e04244781db6d2ff272be] USB: gpio_vbus: handle
IRQ flags properly
git bisect bad c8240c1b810ac4adc13e04244781db6d2ff272be
# bad: [07e4e556eff4938eb2edf2591de3aa7d7fb82b52] USB: ohci-at91: add a
reset function to fix race condition
git bisect bad 07e4e556eff4938eb2edf2591de3aa7d7fb82b52
# bad: [f99b2bfebe8984db2b6e4c07e2bedc91977d27d8] usb:hsotg:samsung:
Remove our_hsotg global pointer
git bisect bad f99b2bfebe8984db2b6e4c07e2bedc91977d27d8
# bad: [d3bfd25821bcfb99a56c2094af249ee2d6c9e4dc] usb: gadget: remove
DUALSPEED from printer
git bisect bad d3bfd25821bcfb99a56c2094af249ee2d6c9e4dc
# bad: [d3bfd25821bcfb99a56c2094af249ee2d6c9e4dc] usb: gadget: remove
DUALSPEED from printer
git bisect bad d3bfd25821bcfb99a56c2094af249ee2d6c9e4dc
# good: [66f75a5d028beaf67c931435fdc3e7823125730c] Linux 3.4-rc4
git bisect good 66f75a5d028beaf67c931435fdc3e7823125730c
# good: [2eb2cff56aeb02e9451341b4d0fe7801e7fade14] usb: gadget: Update
m66592-udc to use usb_endpoint_descriptor inside the struct usb_ep
git bisect good 2eb2cff56aeb02e9451341b4d0fe7801e7fade14
# good: [0ff21e0e9cdeb156d0872446fa5e49fb0aae76fd] usb: gadget: Update
pch_udc to use usb_endpoint_descriptor inside the struct usb_ep
git bisect good 0ff21e0e9cdeb156d0872446fa5e49fb0aae76fd
# good: [0ff21e0e9cdeb156d0872446fa5e49fb0aae76fd] usb: gadget: Update
pch_udc to use usb_endpoint_descriptor inside the struct usb_ep
git bisect good 0ff21e0e9cdeb156d0872446fa5e49fb0aae76fd
# bad: [d809f78f81fc1c7e9d8afaaa51ec4813612aff94] usb: gadget:
atmel_usba_udc: convert to newstyle start/stop interface
git bisect bad d809f78f81fc1c7e9d8afaaa51ec4813612aff94
# bad: [f3d8bf34c2c925867322197096ed501ceab8085a] usb: gadget: at91_udc:
convert to new style start/stop interface
git bisect bad f3d8bf34c2c925867322197096ed501ceab8085a
# bad: [f3d8bf34c2c925867322197096ed501ceab8085a] usb: gadget: at91_udc:
convert to new style start/stop interface
git bisect bad f3d8bf34c2c925867322197096ed501ceab8085a
# good: [955846a60a9db884d6a5b644876a96b806a48a8d] usb: gadget: Update
s3c-hsudc to use usb_endpoint_descriptor inside the struct usb_ep
git bisect good 955846a60a9db884d6a5b644876a96b806a48a8d

My .config and the patch I use for the board are included below.
Thank you for any help you can provide.

Mario Isidoro

#
# Automatically generated file; DO NOT EDIT.
# Linux/arm 3.5.0-rc5 Kernel Configuration
#
CONFIG_ARM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_GENERIC_GPIO=y
CONFIG_HAVE_PROC_CPU=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_RWSEM_GENERIC_SPINLOCK=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_VECTORS_BASE=0xffff0000
CONFIG_ARM_PATCH_PHYS_VIRT=y
CONFIG_GENERIC_BUG=y
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
CONFIG_HAVE_IRQ_WORK=y

#
# General setup
#
CONFIG_EXPERIMENTAL=y
CONFIG_BROKEN_ON_SMP=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_CROSS_COMPILE=""
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_HAVE_KERNEL_XZ=y
CONFIG_HAVE_KERNEL_LZO=y
CONFIG_KERNEL_LZO=y
CONFIG_DEFAULT_HOSTNAME=""
CONFIG_HAVE_GENERIC_HARDIRQS=y

#
# IRQ subsystem
#
CONFIG_GENERIC_HARDIRQS=y
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_HARDIRQS_SW_RESEND=y
CONFIG_IRQ_DOMAIN=y
CONFIG_KTIME_SCALAR=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y

#
# Timers subsystem
#
CONFIG_TICK_ONESHOT=y
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y

#
# RCU Subsystem
#
CONFIG_TINY_RCU=y
CONFIG_LOG_BUF_SHIFT=16
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_SYSCTL=y
CONFIG_ANON_INODES=y
CONFIG_EXPERT=y
CONFIG_UID16=y
CONFIG_KALLSYMS=y
CONFIG_HOTPLUG=y
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_ELF_CORE=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
CONFIG_EPOLL=y
CONFIG_SIGNALFD=y
CONFIG_TIMERFD=y
CONFIG_EVENTFD=y
CONFIG_SHMEM=y
CONFIG_AIO=y
CONFIG_EMBEDDED=y
CONFIG_HAVE_PERF_EVENTS=y
CONFIG_PERF_USE_VMALLOC=y

#
# Kernel Performance Events And Counters
#
CONFIG_SLOB=y
CONFIG_HAVE_OPROFILE=y
CONFIG_HAVE_KPROBES=y
CONFIG_HAVE_KRETPROBES=y
CONFIG_HAVE_ARCH_TRACEHOOK=y
CONFIG_HAVE_DMA_ATTRS=y
CONFIG_GENERIC_SMP_IDLE_THREAD=y
CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
CONFIG_HAVE_CLK=y
CONFIG_HAVE_DMA_API_DEBUG=y
CONFIG_HAVE_ARCH_JUMP_LABEL=y

#
# GCOV-based kernel profiling
#
CONFIG_HAVE_GENERIC_DMA_COHERENT=y
CONFIG_RT_MUTEXES=y
CONFIG_BASE_SMALL=0
CONFIG_BLOCK=y

#
# Partition Types
#
CONFIG_MSDOS_PARTITION=y

#
# IO Schedulers
#
CONFIG_IOSCHED_NOOP=y
CONFIG_DEFAULT_NOOP=y
CONFIG_DEFAULT_IOSCHED="noop"
CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
CONFIG_INLINE_READ_UNLOCK=y
CONFIG_INLINE_READ_UNLOCK_IRQ=y
CONFIG_INLINE_WRITE_UNLOCK=y
CONFIG_INLINE_WRITE_UNLOCK_IRQ=y

#
# System Type
#
CONFIG_MMU=y
CONFIG_ARCH_AT91=y
CONFIG_HAVE_AT91_DATAFLASH_CARD=y
CONFIG_HAVE_AT91_DBGU0=y
CONFIG_AT91_SAM9_ALT_RESET=y
CONFIG_AT91_SAM9G45_RESET=y
CONFIG_SOC_AT91SAM9=y

#
# Atmel AT91 System-on-Chip
#

#
# Atmel AT91 Processor
#
CONFIG_SOC_AT91SAM9260=y
CONFIG_ARCH_AT91SAM9260=y
CONFIG_AT91_PMC_UNIT=y

#
# AT91SAM9260 Variants
#

#
# AT91SAM9260 / AT91SAM9XE Board Type
#
CONFIG_MACH_AT91SAM9260EK=y

#
# AT91SAM9260/AT91SAM9G20 boards
#

#
# Generic Board Type
#

#
# AT91 Board Options
#

#
# AT91 Feature Selections
#
CONFIG_AT91_TIMER_HZ=100

#
# Processor Type
#
CONFIG_CPU_ARM926T=y
CONFIG_CPU_32v5=y
CONFIG_CPU_ABRT_EV5TJ=y
CONFIG_CPU_PABRT_LEGACY=y
CONFIG_CPU_CACHE_VIVT=y
CONFIG_CPU_COPY_V4WB=y
CONFIG_CPU_TLB_V4WBI=y
CONFIG_CPU_CP15=y
CONFIG_CPU_CP15_MMU=y
CONFIG_CPU_USE_DOMAINS=y

#
# Processor Features
#
CONFIG_ARM_THUMB=y
CONFIG_ARM_L1_CACHE_SHIFT=5
CONFIG_ARM_NR_BANKS=8

#
# Bus support
#

#
# Kernel Features
#
CONFIG_VMSPLIT_3G=y
CONFIG_PAGE_OFFSET=0xC0000000
CONFIG_ARCH_NR_GPIO=0
CONFIG_PREEMPT_VOLUNTARY=y
CONFIG_HZ=100
CONFIG_AEABI=y
CONFIG_OABI_COMPAT=y
CONFIG_HAVE_ARCH_PFN_VALID=y
CONFIG_SELECT_MEMORY_MODEL=y
CONFIG_FLATMEM_MANUAL=y
CONFIG_FLATMEM=y
CONFIG_FLAT_NODE_MEM_MAP=y
CONFIG_HAVE_MEMBLOCK=y
CONFIG_PAGEFLAGS_EXTENDED=y
CONFIG_SPLIT_PTLOCK_CPUS=999999
CONFIG_ZONE_DMA_FLAG=0
CONFIG_VIRT_TO_BUS=y
CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
CONFIG_NEED_PER_CPU_KM=y
CONFIG_FORCE_MAX_ZONEORDER=11
CONFIG_LEDS=y
CONFIG_LEDS_CPU=y
CONFIG_ALIGNMENT_TRAP=y

#
# Boot options
#
CONFIG_ZBOOT_ROM_TEXT=0
CONFIG_ZBOOT_ROM_BSS=0
CONFIG_CMDLINE="console=ttyS0,115200 mem=64M
g_ether.dev_addr=A2:46:1A:43:EA:9F ip=192.168.2.2 rootfstype=nfs
root=/dev/nfs nfsroot=192.168.2.1:/home/mjfi/XTraN-2012-V1.0A/rfs/nfs"
CONFIG_CMDLINE_FROM_BOOTLOADER=y

#
# CPU Power Management
#

#
# Floating point emulation
#

#
# At least one emulation must be selected
#
CONFIG_FPE_FASTFPE=y

#
# Userspace binary formats
#
CONFIG_BINFMT_ELF=y
CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
CONFIG_HAVE_AOUT=y

#
# Power management options
#
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_NET=y

#
# Networking options
#
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_IP_PNP=y
CONFIG_TCP_CONG_CUBIC=y
CONFIG_DEFAULT_TCP_CONG="cubic"
CONFIG_BQL=y

#
# Network testing
#
CONFIG_HAVE_BPF_JIT=y

#
# Device Drivers
#

#
# Generic Driver Options
#
CONFIG_UEVENT_HELPER_PATH=""
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
CONFIG_STANDALONE=y
CONFIG_PREVENT_FIRMWARE_BUILD=y
CONFIG_BLK_DEV=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_LOOP_MIN_COUNT=1

#
# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
#

#
# Misc devices
#

#
# EEPROM support
#

#
# Texas Instruments shared transport line discipline
#

#
# Altera FPGA firmware download module
#

#
# SCSI device support
#
CONFIG_SCSI_MOD=y
CONFIG_NETDEVICES=y

#
# CAIF transport drivers
#
CONFIG_HAVE_NET_MACB=y

#
# Enable WiMAX (Networking options) to see the WiMAX drivers
#

#
# Input device support
#
CONFIG_INPUT=y

#
# Userland interfaces
#

#
# Input Device Drivers
#
CONFIG_INPUT_KEYBOARD=y
CONFIG_KEYBOARD_GPIO=y

#
# Hardware I/O ports
#
CONFIG_SERIO=y
CONFIG_SERIO_SERPORT=y

#
# Character devices
#
CONFIG_VT=y
CONFIG_CONSOLE_TRANSLATIONS=y
CONFIG_VT_CONSOLE=y
CONFIG_HW_CONSOLE=y

#
# Serial drivers
#

#
# Non-8250 serial port support
#
CONFIG_SERIAL_ATMEL=y
CONFIG_SERIAL_ATMEL_CONSOLE=y
CONFIG_SERIAL_ATMEL_PDC=y
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y

#
# PPS support
#

#
# PPS generators support
#

#
# PTP clock support
#

#
# Enable Device Drivers -> PPS to see the PTP clock options.
#
CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y
CONFIG_ARCH_REQUIRE_GPIOLIB=y
CONFIG_GPIOLIB=y

#
# Memory mapped GPIO drivers:
#

#
# I2C GPIO expanders:
#

#
# PCI GPIO expanders:
#

#
# SPI GPIO expanders:
#

#
# AC97 GPIO expanders:
#

#
# MODULbus GPIO expanders:
#
CONFIG_SSB_POSSIBLE=y

#
# Sonics Silicon Backplane
#
CONFIG_BCMA_POSSIBLE=y

#
# Broadcom specific AMBA
#

#
# Multifunction device drivers
#

#
# Graphics support
#

#
# Console display driver support
#
CONFIG_DUMMY_CONSOLE=y

#
# HID support
#
CONFIG_USB_ARCH_HAS_OHCI=y
CONFIG_USB_ARCH_HAS_EHCI=y
CONFIG_USB_SUPPORT=y
CONFIG_USB_COMMON=y
CONFIG_USB_ARCH_HAS_HCD=y

#
# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
#

#
# USB Physical Layer drivers
#
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_VBUS_DRAW=2
CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2

#
# USB Peripheral Controller
#
CONFIG_USB_AT91=y
CONFIG_USB_ETH=y
CONFIG_USB_ETH_RNDIS=y
CONFIG_USB_ETH_EEM=y

#
# OTG and related infrastructure
#
CONFIG_RTC_LIB=y

#
# Virtio drivers
#

#
# Microsoft Hyper-V guest support
#
CONFIG_CLKDEV_LOOKUP=y

#
# Hardware Spinlock drivers
#

#
# Remoteproc drivers (EXPERIMENTAL)
#

#
# Rpmsg drivers (EXPERIMENTAL)
#

#
# File systems
#
CONFIG_FILE_LOCKING=y

#
# Caches
#

#
# CD-ROM/DVD Filesystems
#

#
# DOS/FAT/NT Filesystems
#

#
# Pseudo filesystems
#
CONFIG_PROC_FS=y
CONFIG_PROC_SYSCTL=y
CONFIG_PROC_PAGE_MONITOR=y
CONFIG_SYSFS=y
CONFIG_NETWORK_FILESYSTEMS=y
CONFIG_NFS_FS=y
CONFIG_NFS_V2=y
CONFIG_NFS_V3=y
CONFIG_ROOT_NFS=y
CONFIG_LOCKD=y
CONFIG_LOCKD_V4=y
CONFIG_NFS_COMMON=y
CONFIG_SUNRPC=y
CONFIG_NLS=y
CONFIG_NLS_DEFAULT="iso8859-15"

#
# Kernel hacking
#
CONFIG_DEFAULT_MESSAGE_LOGLEVEL=4
CONFIG_ENABLE_WARN_DEPRECATED=y
CONFIG_ENABLE_MUST_CHECK=y
CONFIG_FRAME_WARN=1024
CONFIG_STRIP_ASM_SYMS=y
CONFIG_DEBUG_FS=y
CONFIG_DEBUG_KERNEL=y
CONFIG_PANIC_ON_OOPS_VALUE=0
CONFIG_DEBUG_BUGVERBOSE=y
CONFIG_DEBUG_INFO=y
CONFIG_HAVE_FUNCTION_TRACER=y
CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
CONFIG_HAVE_DYNAMIC_FTRACE=y
CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
CONFIG_HAVE_C_RECORDMCOUNT=y
CONFIG_TRACING_SUPPORT=y
CONFIG_HAVE_ARCH_KGDB=y
CONFIG_ARM_UNWIND=y

#
# Security options
#
CONFIG_DEFAULT_SECURITY_DAC=y
CONFIG_DEFAULT_SECURITY=""
CONFIG_CRYPTO=y

#
# Crypto core or helper
#
CONFIG_CRYPTO_ALGAPI=y
CONFIG_CRYPTO_ALGAPI2=y
CONFIG_CRYPTO_AEAD2=y
CONFIG_CRYPTO_BLKCIPHER2=y
CONFIG_CRYPTO_HASH=y
CONFIG_CRYPTO_HASH2=y
CONFIG_CRYPTO_RNG=y
CONFIG_CRYPTO_RNG2=y
CONFIG_CRYPTO_PCOMP=y
CONFIG_CRYPTO_PCOMP2=y
CONFIG_CRYPTO_MANAGER=y
CONFIG_CRYPTO_MANAGER2=y
CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y
CONFIG_CRYPTO_WORKQUEUE=y

#
# Authenticated Encryption with Associated Data
#

#
# Block modes
#

#
# Hash modes
#

#
# Digest
#
CONFIG_CRYPTO_CRC32C=y
CONFIG_CRYPTO_SHA1=y
CONFIG_CRYPTO_SHA256=y
CONFIG_CRYPTO_SHA512=y

#
# Ciphers
#
CONFIG_CRYPTO_AES=y
CONFIG_CRYPTO_DES=y

#
# Compression
#
CONFIG_CRYPTO_DEFLATE=y
CONFIG_CRYPTO_ZLIB=y
CONFIG_CRYPTO_LZO=y

#
# Random Number Generation
#
CONFIG_CRYPTO_ANSI_CPRNG=y

#
# Library routines
#
CONFIG_BITREVERSE=y
CONFIG_GENERIC_PCI_IOMAP=y
CONFIG_GENERIC_IO=y
CONFIG_CRC16=y
CONFIG_CRC32=y
CONFIG_CRC32_SLICEBY8=y
CONFIG_LIBCRC32C=y
CONFIG_ZLIB_INFLATE=y
CONFIG_ZLIB_DEFLATE=y
CONFIG_LZO_COMPRESS=y
CONFIG_LZO_DECOMPRESS=y
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT=y
CONFIG_HAS_DMA=y
CONFIG_DQL=y
CONFIG_NLATTR=y
CONFIG_GENERIC_ATOMIC64=y
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c
b/arch/arm/mach-at91/at91sam9260_devices.c
index 0ded951..b262cad 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -583,7 +583,7 @@ static struct platform_device
at91sam9260_spi1_device = {
      .num_resources    = ARRAY_SIZE(spi1_resources),
 };
 
-static const unsigned spi1_standard_cs[4] = { AT91_PIN_PB3,
AT91_PIN_PC5, AT91_PIN_PC4, AT91_PIN_PC3 };
+static const unsigned spi1_standard_cs[4] = { AT91_PIN_PB3,
AT91_PIN_PC18, AT91_PIN_PC19, AT91_PIN_PC20 };
 
 void __init at91_add_device_spi(struct spi_board_info *devices, int
nr_devices)
 {
diff --git a/arch/arm/mach-at91/board-sam9260ek.c
b/arch/arm/mach-at91/board-sam9260ek.c
index 7b3c391..27409aa 100644
--- a/arch/arm/mach-at91/board-sam9260ek.c
+++ b/arch/arm/mach-at91/board-sam9260ek.c
@@ -25,12 +25,17 @@
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
+#include <linux/interrupt.h>
 #include <linux/spi/spi.h>
-#include <linux/spi/at73c213.h>
+#include <linux/spi/mcp23s08.h>
+#include <linux/spi/flash.h>
+#include <linux/spi/eeprom.h>
 #include <linux/clk.h>
 #include <linux/i2c/at24.h>
 #include <linux/gpio_keys.h>
 #include <linux/input.h>
+#include <linux/can/platform/mcp251x.h>
+#include <mtd/mtd-abi.h>
 
 #include <asm/setup.h>
 #include <asm/mach-types.h>
@@ -52,8 +57,8 @@
 
 static void __init ek_init_early(void)
 {
-     /* Initialize processor: 18.432 MHz crystal */
-     at91_initialize(18432000);
+     /* Initialize processor: 16 MHz crystal */
+     at91_initialize(16000000);
 }
 
 /*
@@ -69,106 +74,113 @@ static struct at91_usbh_data __initdata
ek_usbh_data = {
  * USB Device port
  */
 static struct at91_udc_data __initdata ek_udc_data = {
-     .vbus_pin   = AT91_PIN_PC5,
+     .vbus_pin   = AT91_PIN_PC25,
+     .vbus_active_low= 1,
      .pullup_pin = -EINVAL,        /* pull-up driven by UDC */
 };
 
-
 /*
- * Audio
+ * SPI devices.
  */
-static struct at73c213_board_info at73c213_data = {
-     .ssc_id           = 0,
-     .shortname  = "AT91SAM9260-EK external DAC",
+static struct spi_eeprom at25_eeprom = {
+     .byte_len   = 32768,
+     .name       = "extEEdata",
+     .page_size  = 64,
+     .flags            = EE_ADDR2,
 };
 
-#if defined(CONFIG_SND_AT73C213) || defined(CONFIG_SND_AT73C213_MODULE)
-static void __init at73c213_set_clk(struct at73c213_board_info *info)
-{
-     struct clk *pck0;
-     struct clk *plla;
-
-     pck0 = clk_get(NULL, "pck0");
-     plla = clk_get(NULL, "plla");
+static struct flash_platform_data at45_flash_fieldboot_info = {
+     .name= "Field Boot Flash"
+};
 
-     /* AT73C213 MCK Clock */
-     at91_set_B_periph(AT91_PIN_PC1, 0); /* PCK0 */
+static struct flash_platform_data at45_flash_secboot_info = {
+     .name= "Secondary Boot Flash"
+};
 
-     clk_set_parent(pck0, plla);
-     clk_put(plla);
+static struct mcp251x_platform_data mcp251x_info = {
+     .oscillator_frequency = 8000000,
+     .irq_flags = IRQF_TRIGGER_FALLING,
+};
 
-     info->dac_clk = pck0;
-}
-#else
-static void __init at73c213_set_clk(struct at73c213_board_info *info)
{}
-#endif
+static const struct mcp23s08_platform_data mcp23s09_info = {
+     .chip[0].is_present = true,
+     .chip[0].pullups = 0,
+     .base = NR_BUILTIN_GPIO,
+};
 
-/*
- * SPI devices.
- */
 static struct spi_board_info ek_spi_devices[] = {
-#if !defined(CONFIG_MMC_AT91)
-     {     /* DataFlash chip */
+     {       /* Field Bootflash */
            .modalias   = "mtd_dataflash",
-           .chip_select      = 1,
+           .chip_select      = 0,
            .max_speed_hz     = 15 * 1000 * 1000,
            .bus_num    = 0,
+           .platform_data    = &at45_flash_fieldboot_info,
      },
-#if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)
-     {     /* DataFlash card */
+     {       /* Secondary Bootflash */
            .modalias   = "mtd_dataflash",
-           .chip_select      = 0,
+           .chip_select      = 1,
            .max_speed_hz     = 15 * 1000 * 1000,
            .bus_num    = 0,
+           .platform_data    = &at45_flash_secboot_info,
      },
-#endif
-#endif
-#if defined(CONFIG_SND_AT73C213) || defined(CONFIG_SND_AT73C213_MODULE)
-     {     /* AT73C213 DAC */
-           .modalias   = "at73c213",
+     {       /* CAN-Bus Interface */
+           .modalias   = "mcp2515",
+           .chip_select      = 3,
+           .max_speed_hz     = 1 * 1000*1000,
+           .bus_num    = 0,
+           .irq        = AT91_PIN_PC4,
+           .platform_data    = &mcp251x_info,
+     },
+     {       /* EEPROM chip */
+           .modalias   = "at25",
            .chip_select      = 0,
-           .max_speed_hz     = 10 * 1000 * 1000,
+           .max_speed_hz     = 5 * 1000 * 1000,
            .bus_num    = 1,
-           .mode       = SPI_MODE_1,
-           .platform_data    = &at73c213_data,
+           .platform_data    = &at25_eeprom,
+     },
+     {       /* GPIOs */
+           .modalias   = "mcp23s08",
+           .chip_select      = 2,
+           .max_speed_hz     = 1 * 1000 * 1000,
+           .bus_num    = 1,
+           .platform_data    = &mcp23s09_info,
+           .mode             = SPI_CPHA | SPI_CPOL,
      },
-#endif
-};
-
-
-/*
- * MACB Ethernet device
- */
-static struct macb_platform_data __initdata ek_macb_data = {
-     .phy_irq_pin      = AT91_PIN_PA7,
-     .is_rmii    = 1,
 };
 
-
 /*
  * NAND flash
  */
 static struct mtd_partition __initdata ek_nand_partition[] = {
      {
-           .name = "Partition 1",
-           .offset     = 0,
-           .size = SZ_256K,
+           .name = "ARMboot",
+           .offset     = 0x0,
+           .size = 0x60000,
      },
      {
-           .name = "Partition 2",
-           .offset     = MTDPART_OFS_NXTBLK,
-           .size = MTDPART_SIZ_FULL,
+           .name = "Boot Env",
+           .offset     = 0x60000,
+           .size = 0x40000,
      },
+     {
+           .name = "Kernel",
+           .offset     =  0xA0000,
+           .size = 0x400000,
+     },
+     {
+           .name = "User",
+           .offset     = 0x4A0000,
+           .size = 0x7B60000,
+     }
 };
 
 static struct atmel_nand_data __initdata ek_nand_data = {
      .ale        = 21,
      .cle        = 22,
      .det_pin    = -EINVAL,
-     .rdy_pin    = AT91_PIN_PC13,
+     .rdy_pin    = AT91_PIN_PC12,
      .enable_pin = AT91_PIN_PC14,
-     .ecc_mode   = NAND_ECC_SOFT,
-     .on_flash_bbt     = 1,
+     .ecc_mode   = NAND_ECC_HW,
      .parts            = ek_nand_partition,
      .num_parts  = ARRAY_SIZE(ek_nand_partition),
 };
@@ -187,122 +199,70 @@ static struct sam9_smc_config __initdata
ek_nand_smc_config = {
      .read_cycle       = 5,
      .write_cycle            = 5,
 
-     .mode             = AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
AT91_SMC_EXNWMODE_DISABLE,
+     .mode             = AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
      .tdf_cycles       = 2,
 };
 
 static void __init ek_add_device_nand(void)
 {
-     ek_nand_data.bus_width_16 = board_have_nand_16bit();
-     /* setup bus-width (8 or 16) */
-     if (ek_nand_data.bus_width_16)
-           ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
-     else
-           ek_nand_smc_config.mode |= AT91_SMC_DBW_8;
-
      /* configure chip-select 3 (NAND) */
      sam9_smc_configure(0, 3, &ek_nand_smc_config);
 
      at91_add_device_nand(&ek_nand_data);
 }
 
-
 /*
  * MCI (SD/MMC)
  */
+#ifdef CONFIG_MMC
+#if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE)
+static struct mci_platform_data __initdata ek_mmc_data = {
+     .slot[0] = {
+           .bus_width  = 4,
+           .detect_pin = AT91_PIN_PC4,
+           .wp_pin           = -1,
+     },
+};
+#else
 static struct at91_mmc_data __initdata ek_mmc_data = {
-     .slot_b           = 1,
+     .slot_b           = 0,
      .wire4            = 1,
-     .det_pin    = -EINVAL,
+     .det_pin    = AT91_PIN_PC4,
      .wp_pin           = -EINVAL,
      .vcc_pin    = -EINVAL,
 };
-
+#endif
+#endif
 
 /*
  * LEDs
  */
 static struct gpio_led ek_leds[] = {
-     {     /* "bottom" led, green, userled1 to be defined */
-           .name             = "ds5",
-           .gpio             = AT91_PIN_PA6,
+     {     /* "heartbeat" led */
+           .name             = "led:cpu_status",
+           .gpio             = AT91_PIN_PA28,
            .active_low       = 1,
-           .default_trigger  = "none",
-     },
-     {     /* "power" led, yellow */
-           .name             = "ds1",
-           .gpio             = AT91_PIN_PA9,
            .default_trigger  = "heartbeat",
+     },
+     {     /* "mmc0" led */
+           .name             = "led:sdcard_status",
+           .gpio             = AT91_PIN_PA29,
+           .active_low       = 1,
+           .default_trigger  = "mmc0",
      }
 };
 
 /*
  * I2C devices
  */
-static struct at24_platform_data at24c512 = {
-     .byte_len   = SZ_512K / 8,
-     .page_size  = 128,
-     .flags            = AT24_FLAG_ADDR16,
-};
 
 static struct i2c_board_info __initdata ek_i2c_devices[] = {
      {
-           I2C_BOARD_INFO("24c512", 0x50),
-           .platform_data = &at24c512,
-     },
-     /* more devices can be added using expansion connectors */
-};
-
-
-/*
- * GPIO Buttons
- */
-#if defined(CONFIG_KEYBOARD_GPIO) ||
defined(CONFIG_KEYBOARD_GPIO_MODULE)
-static struct gpio_keys_button ek_buttons[] = {
-     {
-           .gpio       = AT91_PIN_PA30,
-           .code       = BTN_3,
-           .desc       = "Button 3",
-           .active_low = 1,
-           .wakeup           = 1,
-     },
-     {
-           .gpio       = AT91_PIN_PA31,
-           .code       = BTN_4,
-           .desc       = "Button 4",
-           .active_low = 1,
-           .wakeup           = 1,
+           I2C_BOARD_INFO("ds1374", 0x68),
+           .irq = AT91_PIN_PC4,
      }
 };
 
-static struct gpio_keys_platform_data ek_button_data = {
-     .buttons    = ek_buttons,
-     .nbuttons   = ARRAY_SIZE(ek_buttons),
-};
-
-static struct platform_device ek_button_device = {
-     .name       = "gpio-keys",
-     .id         = -1,
-     .num_resources    = 0,
-     .dev        = {
-           .platform_data    = &ek_button_data,
-     }
-};
-
-static void __init ek_add_device_buttons(void)
-{
-     at91_set_gpio_input(AT91_PIN_PA30, 1);    /* btn3 */
-     at91_set_deglitch(AT91_PIN_PA30, 1);
-     at91_set_gpio_input(AT91_PIN_PA31, 1);    /* btn4 */
-     at91_set_deglitch(AT91_PIN_PA31, 1);
-
-     platform_device_register(&ek_button_device);
-}
-#else
-static void __init ek_add_device_buttons(void) {}
-#endif
-
-
 static void __init ek_board_init(void)
 {
      /* Serial */
@@ -316,7 +276,20 @@ static void __init ek_board_init(void)
 
      /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
      at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS |
ATMEL_UART_RTS);
+
+     /* USART2 on ttyS3. (Rx, Tx, RTS, CTS) */
+     at91_register_uart(AT91SAM9260_ID_US2, 3, ATMEL_UART_CTS |
ATMEL_UART_RTS);
+
+     /* USART3 on ttyS4. (Rx, Tx, RTS, CTS) */
+     at91_register_uart(AT91SAM9260_ID_US3, 4, 0);
+
+     /* USART4 on ttyS5. (Rx & Tx Only) */
+     at91_register_uart(AT91SAM9260_ID_US4, 5, 0);
+
+     /* USART5 on ttyS6. (Rx & Tx Only) */
+     at91_register_uart(AT91SAM9260_ID_US5, 6, 0);
      at91_add_device_serial();
+
      /* USB Host */
      at91_add_device_usbh(&ek_usbh_data);
      /* USB Device */
@@ -325,19 +298,14 @@ static void __init ek_board_init(void)
      at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
      /* NAND */
      ek_add_device_nand();
-     /* Ethernet */
-     at91_add_device_eth(&ek_macb_data);
+#ifdef CONFIG_MMC
      /* MMC */
      at91_add_device_mmc(0, &ek_mmc_data);
+#endif
      /* I2C */
      at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices));
-     /* SSC (to AT73C213) */
-     at73c213_set_clk(&at73c213_data);
-     at91_add_device_ssc(AT91SAM9260_ID_SSC, ATMEL_SSC_TX);
      /* LEDs */
      at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
-     /* Push Buttons */
-     ek_add_device_buttons();
 }
 
 MACHINE_START(AT91SAM9260EK, "Atmel AT91SAM9260-EK")

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux