2011-10-11 03:52:36 cm-bf527 and mmc with spi
Mingeuk Kim (KOREA, REPUBLIC OF)
Message: 103784
Hello,
I'm using CM-BF527 with EVAL-BF5xx board of Bluetechnix.
I wanted to use my sd card so that I followed this wep page
docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:spi_mmc
After finishing kernel config, I modified linux-2.6.x/arch/blackfin/mach-bf527/boards/cm_bf527.c file like wep page.
#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
#define MMC_SPI_CARD_DETECT_INT IRQ_PF5
static int bfin_mmc_spi_init(struct device *dev,
irqreturn_t (*detect_int)(int, void *), void *data)
{
return request_irq(MMC_SPI_CARD_DETECT_INT, detect_int,
IRQF_TRIGGER_FALLING, "mmc-spi-detect", data);
}
static void bfin_mmc_spi_exit(struct device *dev, void *data)
{
free_irq(MMC_SPI_CARD_DETECT_INT, data);
}
static struct mmc_spi_platform_data bfin_mmc_spi_pdata = {
.init = bfin_mmc_spi_init,
.exit = bfin_mmc_spi_exit,
.detect_delay = 100, // msecs
};
static struct bfin5xx_spi_chip mmc_spi_chip_info = {
.enable_dma = 0,
.bits_per_word = 8,
};
#endif
#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
{
.modalias = "mmc_spi",
.max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
.bus_num = 0,
.chip_select = 4,
.platform_data = &bfin_mmc_spi_pdata, //
.controller_data = &mmc_spi_chip_info,
.mode = SPI_MODE_3,
},
#endif
And I add #include <linux/spi/mmc_spi.h> because error was occurred without this file.
then my booting log is like this
--------------------------------------------------------------------------------------------------------
## Booting kernel from Legacy Image at 01000000 ...
Image Name: bf527-2.6.34.7-ADI-2010R1
Created: 2011-10-11 7:41:07 UTC
Image Type: Blackfin Linux Kernel Image (gzip compressed)
Data Size: 2731973 Bytes = 2.6 MiB
Load Address: 00001000
Entry Point: 0020e378
Verifying Checksum ... OK
Uncompressing Kernel Image ... OK
Starting Kernel at = 0020e378
Linux version 2.6.34.7-ADI-2010R1 (rainbow@Rainbow) (gcc version 4.3.5 (ADI-2011
register early platform devices
bootconsole [early_shadow0] enabled
bootconsole [early_BFuart0] enabled
early printk enabled on early_BFuart0
Board Memory: 32MB
Kernel Managed Memory: 32MB
Memory map:
fixedcode = 0x00000400-0x00000490
text = 0x00001000-0x0016c5c0
rodata = 0x0016c5c0-0x001d2d88
bss = 0x001d3000-0x001f6c04
data = 0x001f6c04-0x0020a000
stack = 0x00208000-0x0020a000
init = 0x0020a000-0x004d1000
available = 0x004d1000-0x01f00000
DMA Zone = 0x01f00000-0x02000000
Hardware Trace Active and Enabled
Boot Mode: 1
Blackfin support (C) 2004-2010 Analog Devices, Inc.
Compiled for ADSP-BF527 Rev 0.1
Warning: Compiled for Rev 1, but running on Rev 2
Blackfin Linux support by blackfin.uclinux.org/
Processor Speed: 600 MHz core clock and 120 MHz System Clock
NOMPU: setting up cplb tables
Instruction Cache Enabled for CPU0
External memory: cacheable in instruction cache
Data Cache Enabled for CPU0
External memory: cacheable (write-back) in data cache
Built 1 zonelists in Zone order, mobility grouping off. Total pages: 7874
Kernel command line: root=/dev/mtdblock0 rw clkin_hz=50000000 earlyprintk=seria0
PID hash table entries: 128 (order: -3, 512 bytes)
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
Memory available: 26524k/32768k RAM, (2844k init code, 1453k kernel code, 631k )
Hierarchical RCU implementation.
NR_IRQS:159
Configuring Blackfin Priority Driven Interrupts
I-pipe 1.14-02: pipeline enabled.
console [ttyBF0] enabled, bootconsole disabled
console [ttyBF0] enabled, bootconsole disabled
Calibrating delay loop... 1191.93 BogoMIPS (lpj=2383872)
Security Framework initialized
Mount-cache hash table entries: 512
Blackfin Scratchpad data SRAM: 4 KB
Blackfin L1 Data A SRAM: 16 KB (16 KB free)
Blackfin L1 Data B SRAM: 16 KB (16 KB free)
Blackfin L1 Instruction SRAM: 48 KB (41 KB free)
NET: Registered protocol family 16
Blackfin DMA Controller
cm_init(): registering device resources
bio: create slab <bio-0> at 0
SCSI subsystem initialized
bfin-spi bfin-spi.0: Blackfin on-chip SPI Controller Driver, Version 1.0, regs_7
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 1024 (order: 1, 8192 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
I-pipe: Domain Xenomai registered.
Xenomai: hal/blackfin started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5.3 (Hordes Of Locusts) loaded.
Xenomai: starting native API services.
Xenomai: starting POSIX services.
Xenomai: starting RTDM services.
msgmni has been set to 51
io scheduler noop registered
io scheduler cfq registered (default)
bfin-otp: initialized
Initializing RAINBOW gpio driver...
bfin-uart: Blackfin serial driver
bfin-uart.0: ttyBF0 at MMIO 0xffc00400 (irq = 29) is a BFIN-UART
bfin-uart.1: ttyBF1 at MMIO 0xffc02000 (irq = 31) is a BFIN-UART
brd: module loaded
Hardware Trace:
0 Target : <0x0016a93c> { _dump_stack + 0x0 }
Source : <0x00005ba6> { _peripheral_request + 0x252 } JUMP.L
1 Target : <0x00005b98> { _peripheral_request + 0x244 }
Source : <0x00005a86> { _peripheral_request + 0x132 } IF !CC JUMP pcrel
2 Target : <0x00005a84> { _peripheral_request + 0x130 }
Source : <0xffa01620> { _strcmp + 0x14 } RTS
3 Target : <0xffa0161e> { _strcmp + 0x12 }
Source : <0xffa01616> { _strcmp + 0xa } IF !CC JUMP pcrel
4 Target : <0xffa0160c> { _strcmp + 0x0 }
Source : <0x0000579a> { _cmp_label + 0x1e } CALL pcrel
5 Target : <0x0000577c> { _cmp_label + 0x0 }
Source : <0x00005a80> { _peripheral_request + 0x12c } JUMP.L
6 Target : <0x00005a78> { _peripheral_request + 0x124 }
Source : <0x000059c6> { _peripheral_request + 0x72 } IF !CC JUMP pcrel
7 Target : <0x0000597a> { _peripheral_request + 0x26 }
Source : <0x00005974> { _peripheral_request + 0x20 } IF CC JUMP pcrel
8 Target : <0x00005970> { _peripheral_request + 0x1c }
Source : <0x00005962> { _peripheral_request + 0xe } IF CC JUMP pcrel
9 Target : <0x00005954> { _peripheral_request + 0x0 }
Source : <0x00005c10> { _peripheral_request_list + 0x24 } JUMP.L
10 Target : <0x00005c00> { _peripheral_request_list + 0x14 }
Source : <0x00005c18> { _peripheral_request_list + 0x2c } IF !CC JUMP pcre)
11 Target : <0x00005c14> { _peripheral_request_list + 0x28 }
Source : <0x0000596e> { _peripheral_request + 0x1a } RTS
12 Target : <0x00005966> { _peripheral_request + 0x12 }
Source : <0x00005b38> { _peripheral_request + 0x1e4 } JUMP.S
13 Target : <0x00005b30> { _peripheral_request + 0x1dc }
Source : <0xffa0169c> { _strncpy + 0x40 } RTS
14 Target : <0xffa01696> { _strncpy + 0x3a }
Source : <0xffa0167e> { _strncpy + 0x22 } IF CC JUMP pcrel
15 Target : <0xffa01674> { _strncpy + 0x18 }
Source : <0xffa01670> { _strncpy + 0x14 } IF CC JUMP pcrel
Stack info:
SP: [0x0101be10] <0x0101be10> /* kernel dynamic memory */
FP: (0x0101bf84)
Memory from 0x0101be10 to 0101c000
0101be10:[012b642c] 00005baa 00000028 00008228 0137b260 000abce2 012b642c
0101be30: 00000519 0000ffff 013f8500 00005c14 0016cf2c 001f8844 001f84a0
0101be50: 00000000 001a2964 0016cf2c 000abc02 00000008 01012928 0016a360
0101be70: 001f84dc 0101befc 00202e80 001f84b0 00000517 013f8500 000ac5c6
0101be90:<000f2074> 001f84a8 001f4828 00202e80 001f84dc 0101befc 00202e80
0101beb0: 00000001 010121c4 00025ea8 000ac63a 000f21b4 001f84a8 00202e80
0101bed0: 001f84dc 00000000 0101bedc 013f8500 <000f19f4> 000f2150 00202408
0101bef0: 00000000 ff0a0210 000d565e 010055d8 01035150 000f1f4e 0021f130
0101bf10: 00000000 00000001 000f13f2 0101bf3c 000f142c 000f2150 000f144a
0101bf30: 00000001 00012b74 0019f0b4 001a2954 0021695c 000f23e8 0021f130
0101bf50: 00202e80 00000000 00000000 00000007 00000001 001b28c8 <0021696c>
0101bf70: 001d300c 001d0000 00000000 00000000 001d300c (00000000)<00001028>>
0101bf90: 00004000 00004000 000332c4 001fa764 00000001 00000000 0020a134
0101bfb0: 0021f184 00000000 00000000 00000000 00000000 0021ef58 0021ef58
0101bfd0: 0020a1c0 0021ef58 0021ef58 00000000 00000000 00000000 <000014be>
0101bff0: 00000000 00000000 ffffffff 00000006
Return addresses in stack:
address : <0x000f2074> { _really_probe + 0x60 }
address : <0x000f19f4> { _bus_for_each_dev + 0x44 }
address : <0x0021696c> { _bfin_mac_init + 0x10 }
frame 1 : <0x00001028> { _do_one_initcall + 0x28 }
address : <0x00001028> { _do_one_initcall + 0x28 }
address : <0x000014be> { _kernel_thread_helper + 0x6 }
peripheral_request: Peripheral 40 function 1 is already reserved by mmc_spi !
bfin_mii_bus bfin_mii_bus.0: Requesting peripherals failed!
bfin_mii_bus: probe of bfin_mii_bus.0 failed with error -16
bfin_mac bfin_mac.0: Cannot get mii_bus!
rtc-bfin rtc-bfin: rtc core: registered rtc-bfin as rtc0
bfin-wdt: initialized: timeout=20 sec (nowayout=0)
mmc_spi spi0.4: ASSUMING SPI bus stays unshared!
mmc_spi spi0.4: ASSUMING 3.2-3.4 V slot power
mmc_spi spi0.4: SD/MMC host mmc0, no DMA, no WP, no poweroff
TCP cubic registered
NET: Registered protocol family 17
rtc-bfin rtc-bfin: setting system clock to 1970-01-02 08:56:13 UTC (118573)
dma_alloc_init: dma_page @ 0x0139a000 - 256 pages at 0x01f00000
mmc_spi spi0.4: can't change chip-select polarity
Freeing unused kernel memory: 2844k freed
_____________________________________
a8888b. / Welcome to the uClinux distribution \
d888888b. / _ _ \
8P"YP"Y88 / | | |_| __ __ (TM) |
8|o||o|88 _____/ | | _ ____ _ _ \ \/ / |
8' .88 \ | | | | _ \| | | | \ / |
8`._.' Y8. \ | |__ | | | | | |_| | / \ |
d/ `8b. \ \____||_|_| |_|\____|/_/\_\ |
dP . Y8b. \ For embedded processors including |
d8:' " `::88b \ the Analog Devices Blackfin /
d8" 'Y88b \___________________________________/
:8P ' :888
8a. : _a88P For further information, check out:
._/"Yaa_: .| 88P| - blackfin.uclinux.org/
\ YP" `| 8P `. - docs.blackfin.uclinux.org/
/ \.___.d| .' - www.uclinux.org/
`--..__)8888P`._.' jgs/a:f - www.analog.com/blackfin
Have a lot of fun...
powered by
____ _ _ _ _
| __ )| |_ _ ___| |_ ___ ___| |__ _ __ (_)_ __
| _ \| | | | |/ _ \ __/ _ \/ __| '_ \| '_ \| \ \/ /
| |_) | | |_| | __/ || __/ (__| | | | | | | |> <
|____/|_|\__,_|\___|\__\___|\___|_| |_|_| |_|_/_/\_\
www.bluetechnix.com
BusyBox v1.16.2 (2011-10-10 15:12:21 KST) hush - the humble shell
Enter 'help' for a list of built-in commands.
--------------------------------------------------------------------------------------------------------
The error message can be removed by changing .chipselect = 4 to other numbers.
However I can't use sd card either and there was no mmcblk0 in /dev
1. What's the .chipselect = 4 and the error message means?
2. How could I use my sd card?
Any advise will be helpful to me.
Thanks in advance.
QuoteReplyEditDelete
2011-10-11 06:53:06 Re: cm-bf527 and mmc with spi
Sonic Zhang (CHINA)
Message: 103791
1. chipselect is the SPI channel you select on your SPI MMC daughter board. If you change it to other number, make sure you also change the hardware on your SPI MMC board.
2. Insert your sd card into the sd slock on your SPI MMC board. mount the partition on your sd card as described in the wiki document.
QuoteReplyEditDelete
2011-10-20 04:52:08 Re: cm-bf527 and mmc with spi
Mingeuk Kim (KOREA, REPUBLIC OF)
Message: 104041
Thank you for your advise.
In EVAL-BF5xx board, PH9/SPISEL5/ETxD2/HOST_D9/TACLK3 pin(55 of CM-BF527) can be used as chipselect of sd card.
So I changed chipselect to 5.
Then the booting log was like this.
------------------------------------------------------------------------------------------------------------------------------------------------
## Booting kernel from Legacy Image at 01000000 ...
Image Name: bf527-2.6.34.7-ADI-2010R1
Created: 2011-10-19 13:18:04 UTC
Image Type: Blackfin Linux Kernel Image (gzip compressed)
Data Size: 3148216 Bytes = 3 MiB
Load Address: 00001000
Entry Point: 0022034c
Verifying Checksum ... OK
Uncompressing Kernel Image ... OK
Starting Kernel at = 0022034c
Linux version 2.6.34.7-ADI-2010R1 (rainbow@Rainbow) (gcc version 4.3.5 (ADI-2011
register early platform devices
bootconsole [early_shadow0] enabled
bootconsole [early_BFuart0] enabled
early printk enabled on early_BFuart0
Board Memory: 32MB
Kernel Managed Memory: 32MB
Memory map:
fixedcode = 0x00000400-0x00000490
text = 0x00001000-0x00179848
rodata = 0x00179848-0x001e4014
bss = 0x001e5000-0x00208d30
data = 0x00208d30-0x0021c000
stack = 0x0021a000-0x0021c000
init = 0x0021c000-0x0057d000
available = 0x0057d000-0x01f00000
DMA Zone = 0x01f00000-0x02000000
Hardware Trace Active and Enabled
Boot Mode: 1
Blackfin support (C) 2004-2010 Analog Devices, Inc.
Compiled for ADSP-BF527 Rev 0.1
Warning: Compiled for Rev 1, but running on Rev 2
Blackfin Linux support by blackfin.uclinux.org/
Processor Speed: 600 MHz core clock and 120 MHz System Clock
NOMPU: setting up cplb tables
Instruction Cache Enabled for CPU0
External memory: cacheable in instruction cache
Data Cache Enabled for CPU0
External memory: cacheable (write-back) in data cache
Built 1 zonelists in Zone order, mobility grouping off. Total pages: 7874
Kernel command line: root=/dev/mtdblock0 rw clkin_hz=50000000 earlyprintk=seria0
PID hash table entries: 128 (order: -3, 512 bytes)
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
Memory available: 25836k/32768k RAM, (3460k init code, 1506k kernel code, 650k )
Hierarchical RCU implementation.
NR_IRQS:159
Configuring Blackfin Priority Driven Interrupts
I-pipe 1.14-02: pipeline enabled.
console [ttyBF0] enabled, bootconsole disabled
console [ttyBF0] enabled, bootconsole disabled
Calibrating delay loop... 1191.93 BogoMIPS (lpj=2383872)
Security Framework initialized
Mount-cache hash table entries: 512
Blackfin Scratchpad data SRAM: 4 KB
Blackfin L1 Data A SRAM: 16 KB (16 KB free)
Blackfin L1 Data B SRAM: 16 KB (16 KB free)
Blackfin L1 Instruction SRAM: 48 KB (41 KB free)
NET: Registered protocol family 16
Blackfin DMA Controller
cm_init(): registering device resources
bio: create slab <bio-0> at 0
SCSI subsystem initialized
bfin-spi bfin-spi.0: Blackfin on-chip SPI Controller Driver, Version 1.0, regs_7
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 1024 (order: 1, 8192 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
I-pipe: Domain Xenomai registered.
Xenomai: hal/blackfin started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5.3 (Hordes Of Locusts) loaded.
Xenomai: starting native API services.
Xenomai: starting POSIX services.
Xenomai: starting RTDM services.
msgmni has been set to 50
io scheduler noop registered
io scheduler cfq registered (default)
bfin-otp: initialized
Initializing RAINBOW gpio driver....
bfin-uart: Blackfin serial driver
bfin-uart.0: ttyBF0 at MMIO 0xffc00400 (irq = 29) is a BFIN-UART
bfin-uart.1: ttyBF1 at MMIO 0xffc02000 (irq = 31) is a BFIN-UART
brd: module loaded
bfin_mii_bus: probed
bfin_mac: attached PHY driver [Generic PHY] (mii_bus:phy_addr=0:00, irq=-1, mdc)
bfin_mac bfin_mac.0: Blackfin on-chip Ethernet MAC driver, Version 1.1
bfin-wdt: initialized: timeout=20 sec (nowayout=0)
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
mmc_spi spi0.5: ASSUMING 3.2-3.4 V slot power
mmc_spi spi0.5: SD/MMC host mmc0, no DMA, no WP, no poweroff
TCP cubic registered
NET: Registered protocol family 17
dma_alloc_init: dma_page @ 0x01530000 - 256 pages at 0x01f00000
mmc_spi spi0.5: can't change chip-select polarity
Freeing unused kernel memory: 3460k freed
_____________________________________
a8888b. / Welcome to the uClinux distribution \
d888888b. / _ _ \
8P"YP"Y88 / | | |_| __ __ (TM) |
8|o||o|88 _____/ | | _ ____ _ _ \ \/ / |
8' .88 \ | | | | _ \| | | | \ / |
8`._.' Y8. \ | |__ | | | | | |_| | / \ |
d/ `8b. \ \____||_|_| |_|\____|/_/\_\ |
dP . Y8b. \ For embedded processors including |
d8:' " `::88b \ the Analog Devices Blackfin /
d8" 'Y88b \___________________________________/
:8P ' :888
8a. : _a88P For further information, check out:
._/"Yaa_: .| 88P| - blackfin.uclinux.org/
\ YP" `| 8P `. - docs.blackfin.uclinux.org/
/ \.___.d| .' - www.uclinux.org/
`--..__)8888P`._.' jgs/a:f - www.analog.com/blackfin
Have a lot of fun...
powered by
____ _ _ _ _
| __ )| |_ _ ___| |_ ___ ___| |__ _ __ (_)_ __
| _ \| | | | |/ _ \ __/ _ \/ __| '_ \| '_ \| \ \/ /
| |_) | | |_| | __/ || __/ (__| | | | | | | |> <
|____/|_|\__,_|\___|\__\___|\___|_| |_|_| |_|_/_/\_\
www.bluetechnix.com
BusyBox v1.16.2 (2011-10-10 15:12:21 KST) hush - the humble shell
Enter 'help' for a list of built-in commands.
root:/> cat /proc/gpio
GPIO_5: gpio-irq76 GPIO INPUT
GPIO_18: bfin-spi Peripheral
GPIO_19: bfin-spi Peripheral
GPIO_20: bfin-spi Peripheral
GPIO_23: bfin-uart Peripheral
GPIO_24: bfin-uart Peripheral
GPIO_28: bfin-uart Peripheral
GPIO_29: bfin-uart Peripheral
GPIO_30: bfin_mac Peripheral
GPIO_31: bfin_mac Peripheral
GPIO_32: bfin_mac Peripheral
GPIO_33: bfin_mac Peripheral
GPIO_34: bfin_mac Peripheral
GPIO_35: bfin_mac Peripheral
GPIO_36: bfin_mac Peripheral
GPIO_37: bfin_mac Peripheral
GPIO_38: bfin_mac Peripheral
GPIO_39: bfin_mac Peripheral
GPIO_40: bfin_mac Peripheral
GPIO_41: mmc_spi Peripheral
------------------------------------------------------------------------------------------------------------------------------------------------
I had inserted my sd card before booting was started.
When I used tcm-bf537 board, this sd card was working well.