From 3874b16997d3c0219a9baab3578ba27ec084282b Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Fri, 13 Jan 2012 16:55:24 +0100 Subject: atmel/mci: fix slot_b support in commit commit f60f6c58e atmel_mci: check for device id we use to address the right slot the driver use the dev_id to detect the slot which is wrong on 9263 as we have 2 devices with 2 slots use slot_b paramter to specify the slot as done in linux Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Cc: Michael Grzeschik Signed-off-by: Sascha Hauer --- arch/arm/boards/at91sam9260ek/init.c | 3 +- arch/arm/boards/dss11/init.c | 3 +- arch/arm/mach-at91/at91sam9260_devices.c | 24 ++++++------ arch/arm/mach-at91/at91sam9263_devices.c | 65 ++++++++++++++++++++++---------- arch/arm/mach-at91/at91sam9g45_devices.c | 1 + arch/arm/mach-at91/include/mach/board.h | 1 + 6 files changed, 63 insertions(+), 34 deletions(-) (limited to 'arch/arm') diff --git a/arch/arm/boards/at91sam9260ek/init.c b/arch/arm/boards/at91sam9260ek/init.c index b10d0dc14e..df44e3e306 100644 --- a/arch/arm/boards/at91sam9260ek/init.c +++ b/arch/arm/boards/at91sam9260ek/init.c @@ -172,6 +172,7 @@ static void at91sam9260ek_phy_reset(void) #if defined(CONFIG_MCI_ATMEL) static struct atmel_mci_platform_data __initdata ek_mci_data = { .bus_width = 4, + .slot_b = 1, }; static void ek_usb_add_device_mci(void) @@ -179,7 +180,7 @@ static void ek_usb_add_device_mci(void) if (machine_is_at91sam9g20ek()) ek_mci_data.detect_pin = AT91_PIN_PC9; - at91_add_device_mci(1, &ek_mci_data); + at91_add_device_mci(0, &ek_mci_data); } #else static void ek_usb_add_device_mci(void) {} diff --git a/arch/arm/boards/dss11/init.c b/arch/arm/boards/dss11/init.c index 96c4eefa77..722c0f6b07 100644 --- a/arch/arm/boards/dss11/init.c +++ b/arch/arm/boards/dss11/init.c @@ -110,6 +110,7 @@ static void dss11_phy_reset(void) } static struct atmel_mci_platform_data dss11_mci_data = { + .slot_b = 1, .bus_width = 4, .host_caps = MMC_MODE_HS, }; @@ -131,7 +132,7 @@ static int dss11_devices_init(void) dss11_add_device_nand(); dss11_phy_reset(); at91_add_device_eth(&macb_pdata); - at91_add_device_mci(1, &dss11_mci_data); + at91_add_device_mci(0, &dss11_mci_data); at91_add_device_usbh_ohci(&dss11_usbh_data); armlinux_set_bootparams((void *)(AT91_CHIPSELECT_1 + 0x100)); diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c index 25a68caedd..59dcd7c5cc 100644 --- a/arch/arm/mach-at91/at91sam9260_devices.c +++ b/arch/arm/mach-at91/at91sam9260_devices.c @@ -298,18 +298,7 @@ void at91_add_device_mci(short mmc_id, struct atmel_mci_platform_data *data) at91_set_A_periph(AT91_PIN_PA8, 0); - if (mmc_id == 0) { - /* CMD */ - at91_set_A_periph(AT91_PIN_PA7, 1); - - /* DAT0, maybe DAT1..DAT3 */ - at91_set_A_periph(AT91_PIN_PA6, 1); - if (data->bus_width == 4) { - at91_set_A_periph(AT91_PIN_PA9, 1); - at91_set_A_periph(AT91_PIN_PA10, 1); - at91_set_A_periph(AT91_PIN_PA11, 1); - } - } else if (mmc_id == 1) { + if (data->slot_b) { /* CMD */ at91_set_B_periph(AT91_PIN_PA1, 1); @@ -320,6 +309,17 @@ void at91_add_device_mci(short mmc_id, struct atmel_mci_platform_data *data) at91_set_B_periph(AT91_PIN_PA4, 1); at91_set_B_periph(AT91_PIN_PA5, 1); } + } else { + /* CMD */ + at91_set_A_periph(AT91_PIN_PA7, 1); + + /* DAT0, maybe DAT1..DAT3 */ + at91_set_A_periph(AT91_PIN_PA6, 1); + if (data->bus_width == 4) { + at91_set_A_periph(AT91_PIN_PA9, 1); + at91_set_A_periph(AT91_PIN_PA10, 1); + at91_set_A_periph(AT91_PIN_PA11, 1); + } } dev = add_generic_device("atmel_mci", mmc_id, NULL, AT91SAM9260_BASE_MCI, SZ_16K, diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index d447e242bb..e2c1a25437 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c @@ -248,33 +248,58 @@ void at91_add_device_mci(short mmc_id, struct atmel_mci_platform_data *data) if (mmc_id == 0) { /* MCI0 */ start = AT91SAM9263_BASE_MCI0; + /* CLK */ at91_set_A_periph(AT91_PIN_PA12, 0); - /* CMD */ - at91_set_A_periph(AT91_PIN_PA1, 1); - - /* DAT0, maybe DAT1..DAT3 and maybe DAT4..DAT7 */ - at91_set_A_periph(AT91_PIN_PA0, 1); - if (data->bus_width == 4) { - at91_set_A_periph(AT91_PIN_PA3, 1); - at91_set_A_periph(AT91_PIN_PA4, 1); - at91_set_A_periph(AT91_PIN_PA5, 1); + if (data->slot_b) { + /* CMD */ + at91_set_A_periph(AT91_PIN_PA16, 1); + + /* DAT0, maybe DAT1..DAT3 */ + at91_set_A_periph(AT91_PIN_PA17, 1); + if (data->bus_width == 4) { + at91_set_A_periph(AT91_PIN_PA18, 1); + at91_set_A_periph(AT91_PIN_PA19, 1); + at91_set_A_periph(AT91_PIN_PA20, 1); + } + } else { + /* CMD */ + at91_set_A_periph(AT91_PIN_PA1, 1); + + /* DAT0, maybe DAT1..DAT3 */ + at91_set_A_periph(AT91_PIN_PA0, 1); + if (data->bus_width == 4) { + at91_set_A_periph(AT91_PIN_PA3, 1); + at91_set_A_periph(AT91_PIN_PA4, 1); + at91_set_A_periph(AT91_PIN_PA5, 1); + } } } else { /* MCI1 */ start = AT91SAM9263_BASE_MCI1; - /* CLK */ - at91_set_A_periph(AT91_PIN_PA6, 0); - - /* CMD */ - at91_set_A_periph(AT91_PIN_PA7, 1); - /* DAT0, maybe DAT1..DAT3 */ - at91_set_A_periph(AT91_PIN_PA8, 1); - if (data->bus_width == 4) { - at91_set_A_periph(AT91_PIN_PA9, 1); - at91_set_A_periph(AT91_PIN_PA10, 1); - at91_set_A_periph(AT91_PIN_PA11, 1); + if (data->slot_b) { + /* CMD */ + at91_set_A_periph(AT91_PIN_PA21, 1); + + /* DAT0, maybe DAT1..DAT3 */ + at91_set_A_periph(AT91_PIN_PA22, 1); + if (data->bus_width == 4) { + at91_set_A_periph(AT91_PIN_PA23, 1); + at91_set_A_periph(AT91_PIN_PA24, 1); + at91_set_A_periph(AT91_PIN_PA25, 1); + } + } else { + /* CMD */ + at91_set_A_periph(AT91_PIN_PA7, 1); + + /* DAT0, maybe DAT1..DAT3 */ + at91_set_A_periph(AT91_PIN_PA8, 1); + if (data->bus_width == 4) { + at91_set_A_periph(AT91_PIN_PA9, 1); + at91_set_A_periph(AT91_PIN_PA10, 1); + at91_set_A_periph(AT91_PIN_PA11, 1); + } } } diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c index 5f1a45a16d..656175fcad 100644 --- a/arch/arm/mach-at91/at91sam9g45_devices.c +++ b/arch/arm/mach-at91/at91sam9g45_devices.c @@ -264,6 +264,7 @@ void at91_add_device_mci(short mmc_id, struct atmel_mci_platform_data *data) } } } else { /* MCI1 */ + data->slot_b = 1; start = AT91SAM9G45_BASE_MCI1; /* CLK */ at91_set_A_periph(AT91_PIN_PA31, 0); diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h index 738af87370..755ddc8861 100644 --- a/arch/arm/mach-at91/include/mach/board.h +++ b/arch/arm/mach-at91/include/mach/board.h @@ -87,6 +87,7 @@ void at91_register_uart(unsigned id, unsigned pins); /* Multimedia Card Interface */ struct atmel_mci_platform_data { + unsigned slot_b; unsigned bus_width; unsigned host_caps; /* MCI_MODE_* from mci.h */ unsigned detect_pin; -- cgit v1.2.3 From be3aaa27b9b184086ca3a83d7f132cd0a9521c2a Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 26 Jan 2012 12:20:36 +0100 Subject: ARM: panic on div 0 hang() only outputs 'reset the board' whereas panic can be passed a string which we can use to output some more information what is happening. Signed-off-by: Sascha Hauer --- arch/arm/lib/div0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/arm') diff --git a/arch/arm/lib/div0.c b/arch/arm/lib/div0.c index 99d6b85ea2..6313c6725d 100644 --- a/arch/arm/lib/div0.c +++ b/arch/arm/lib/div0.c @@ -27,5 +27,5 @@ extern void __div0(void); /* Replacement (=dummy) for GNU/Linux division-by zero handler */ void __div0 (void) { - hang(); + panic("division by zero\n"); } -- cgit v1.2.3 From 79c2f03aeed7b232592495f6af5fd94fbd102d25 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 26 Jan 2012 12:26:22 +0100 Subject: Add dump_stack function At least ARM allows us to dump the stack, but we currently have no prototype for this. Add a dump_stack prototype and provide a static inline function for architectures without stack dump support. Also, call dump_stack() in panic() to provide more information in the case of a panic. Signed-off-by: Sascha Hauer --- arch/arm/cpu/interrupts.c | 5 +++++ arch/arm/include/asm/barebox.h | 39 +++------------------------------------ include/common.h | 9 +++++++++ lib/vsprintf.c | 2 ++ 4 files changed, 19 insertions(+), 36 deletions(-) (limited to 'arch/arm') diff --git a/arch/arm/cpu/interrupts.c b/arch/arm/cpu/interrupts.c index 3d2077f491..c4f911392a 100644 --- a/arch/arm/cpu/interrupts.c +++ b/arch/arm/cpu/interrupts.c @@ -73,6 +73,11 @@ void show_regs (struct pt_regs *regs) #endif } +void dump_stack(void) +{ + unwind_backtrace(NULL); +} + static void __noreturn do_exception(struct pt_regs *pt_regs) { show_regs(pt_regs); diff --git a/arch/arm/include/asm/barebox.h b/arch/arm/include/asm/barebox.h index c9372dab93..2b08d68909 100644 --- a/arch/arm/include/asm/barebox.h +++ b/arch/arm/include/asm/barebox.h @@ -1,41 +1,8 @@ -/* - * (C) Copyright 2002 - * Sysgo Real-Time Solutions, GmbH - * Marius Groeger - * - * (C) Copyright 2002 - * Sysgo Real-Time Solutions, GmbH - * Alex Zuepke - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ******************************************************************** - * NOTE: This header file defines an interface to barebox. Including - * this (unmodified) header file in another file is considered normal - * use of barebox, and does *not* fall under the heading of "derived - * work". - ******************************************************************** - */ - #ifndef _BAREBOX_H_ #define _BAREBOX_H_ 1 -//typedef struct bd_info {} bd_t; +#ifdef CONFIG_ARM_UNWIND +#define ARCH_HAS_STACK_DUMP +#endif #endif /* _BAREBOX_H_ */ diff --git a/include/common.h b/include/common.h index 2f37dd845f..74a697d141 100644 --- a/include/common.h +++ b/include/common.h @@ -119,6 +119,15 @@ uint32_t crc32_no_comp(uint32_t, const void*, unsigned int); /* common/console.c */ int ctrlc (void); +#ifdef ARCH_HAS_STACK_DUMP +void dump_stack(void); +#else +static inline void dump_stack(void) +{ + printf("no stack data available\n"); +} +#endif + #define MEMAREA_SIZE_SPECIFIED 1 struct memarea_info { diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 4165f97485..9763515130 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -625,6 +625,8 @@ void __noreturn panic(const char *fmt, ...) putchar('\n'); va_end(args); + dump_stack(); + led_trigger(LED_TRIGGER_PANIC, TRIGGER_ENABLE); #if defined (CONFIG_PANIC_HANG) -- cgit v1.2.3