From a33cbfa3fe609a3f0b6f42b0f4e702e7bc0f7439 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 1 Jul 2011 03:40:27 +0000 Subject: [PATCH] blackfin buses: accept new hwait option from user to optionally drive a pin when selecting the flash to mimic the behavior of Blackfin bootroms when they boot out of flash git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1947 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/ChangeLog | 15 +++++++++++++++ urjtag/include/urjtag/bus_driver.h | 1 + urjtag/src/bus/bf518f_ezbrd.c | 4 ++-- urjtag/src/bus/bf533_stamp.c | 2 +- urjtag/src/bus/bf537_stamp.c | 4 ++-- urjtag/src/bus/bf548_ezkit.c | 4 ++-- urjtag/src/bus/bf561_ezkit.c | 4 ++-- urjtag/src/bus/blackfin.c | 30 ++++++++++++++++++++++++++++-- urjtag/src/bus/blackfin.h | 10 +++++++--- urjtag/src/bus/buses.c | 1 + 10 files changed, 61 insertions(+), 14 deletions(-) diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index 35862938..cbfb3a68 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -22,6 +22,21 @@ setup and use new helper func instead. * src/bus/buses.c (urj_bus_buses_set): Likewise. + * include/urjtag/bus_driver.h (urj_bus_param_key_t): Add new hwait key + for Blackfin bus drivers. + * src/bus/buses.c (bus_param): Likewise. + * src/bus/blackfin.h (bfin_bus_params_t): Add hwait/hwait_level to keep + track of new optional hwait signal. + (bfin_bus_new): Accept cmd_params from caller. + (_BFIN_BUS_DECLARE): Document new hwait= option in bus. + * src/bus/blackfin.c (bfin_bus_new): Accept cmd_params from caller and + parse them for hwait signal. + (bfin_select_flash, bfin_unselect_flash): Set new hwait pin if it is + enabled by user. + * src/bus/bf518f_ezbrd.c, src/bus/bf533_stamp.c, src/bus/bf537_stamp.c, + src/bus/bf548_ezkit.c, src/bus/bf561_ezkit.c: Pass cmd_params down to + bfin_bus_new() helper. + 2011-06-30 Jie Zhang * src/cmd/Makefile.am (generated_cmd_list.h): Depend on diff --git a/urjtag/include/urjtag/bus_driver.h b/urjtag/include/urjtag/bus_driver.h index f0cb6f95..f88e47a4 100644 --- a/urjtag/include/urjtag/bus_driver.h +++ b/urjtag/include/urjtag/bus_driver.h @@ -80,6 +80,7 @@ typedef enum URJ_BUS_PARAM_KEY URJ_BUS_PARAM_KEY_HELP, /* bool mpc824 */ URJ_BUS_PARAM_KEY_DBGaDDR, /* bool mpc824 */ URJ_BUS_PARAM_KEY_DBGdATA, /* bool mpc824 */ + URJ_BUS_PARAM_KEY_HWAIT, /* string (= signal name) blackfin */ } urj_bus_param_key_t; diff --git a/urjtag/src/bus/bf518f_ezbrd.c b/urjtag/src/bus/bf518f_ezbrd.c index 9cc87019..18c963cc 100644 --- a/urjtag/src/bus/bf518f_ezbrd.c +++ b/urjtag/src/bus/bf518f_ezbrd.c @@ -2,7 +2,7 @@ * bf518_ezbrd.c * * Analog Devices ADSP-BF518F EZ-BRD bus driver - * Copyright (C) 2009, 2010 Analog Devices, Inc. + * Copyright (C) 2009-2011 Analog Devices, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -48,7 +48,7 @@ bf518f_ezbrd_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, params->addr_cnt = 19; params->data_cnt = 16; params->sdram = 1; - failed |= bfin_bus_new (bus); + failed |= bfin_bus_new (bus, cmd_params); if (failed) { diff --git a/urjtag/src/bus/bf533_stamp.c b/urjtag/src/bus/bf533_stamp.c index b4b2c1d6..45b3d330 100644 --- a/urjtag/src/bus/bf533_stamp.c +++ b/urjtag/src/bus/bf533_stamp.c @@ -70,7 +70,7 @@ bf533_stamp_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, params->select_flash = bf533_stamp_select_flash; params->unselect_flash = bf533_stamp_unselect_flash; params->sdram = 1; - failed |= bfin_bus_new (bus); + failed |= bfin_bus_new (bus, cmd_params); failed |= urj_bus_generic_attach_sig (part, &PF[0], "PF0"); failed |= urj_bus_generic_attach_sig (part, &PF[1], "PF1"); diff --git a/urjtag/src/bus/bf537_stamp.c b/urjtag/src/bus/bf537_stamp.c index b11428d7..39256023 100644 --- a/urjtag/src/bus/bf537_stamp.c +++ b/urjtag/src/bus/bf537_stamp.c @@ -2,7 +2,7 @@ * $Id$ * * Analog Devices ADSP-BF537 STAMP/EZ-KIT Lite bus driver - * Copyright (C) 2008 Analog Devices, Inc. + * Copyright (C) 2008-2011 Analog Devices, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -48,7 +48,7 @@ bf537_stamp_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, params->addr_cnt = 19; params->data_cnt = 16; params->sdram = 1; - failed |= bfin_bus_new (bus); + failed |= bfin_bus_new (bus, cmd_params); if (failed) { diff --git a/urjtag/src/bus/bf548_ezkit.c b/urjtag/src/bus/bf548_ezkit.c index a7750d40..f40a6928 100644 --- a/urjtag/src/bus/bf548_ezkit.c +++ b/urjtag/src/bus/bf548_ezkit.c @@ -2,7 +2,7 @@ * $Id$ * * Analog Devices ADSP-BF548 EZ-KIT Lite bus driver - * Copyright (C) 2008 Analog Devices, Inc. + * Copyright (C) 2008-2011 Analog Devices, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -71,7 +71,7 @@ bf548_ezkit_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, params->data_cnt = 16; params->select_flash = bf548_ezkit_select_flash; params->unselect_flash = bf548_ezkit_unselect_flash; - failed |= bfin_bus_new (bus); + failed |= bfin_bus_new (bus, cmd_params); failed |= urj_bus_generic_attach_sig (part, &DCS0, "CS0_B"); failed |= urj_bus_generic_attach_sig (part, &NCE, "PJ1"); diff --git a/urjtag/src/bus/bf561_ezkit.c b/urjtag/src/bus/bf561_ezkit.c index b30ba87e..2d772954 100644 --- a/urjtag/src/bus/bf561_ezkit.c +++ b/urjtag/src/bus/bf561_ezkit.c @@ -2,7 +2,7 @@ * $Id$ * * Analog Devices ADSP-BF561 EZ-KIT Lite bus driver - * Copyright (C) 2008 Analog Devices, Inc. + * Copyright (C) 2008-2011 Analog Devices, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -49,7 +49,7 @@ bf561_ezkit_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, params->data_cnt = 32; params->sdram = 1; params->sms_cnt = 4; - failed |= bfin_bus_new (bus); + failed |= bfin_bus_new (bus, cmd_params); if (failed) { diff --git a/urjtag/src/bus/blackfin.c b/urjtag/src/bus/blackfin.c index 4dd5b529..fbc54b50 100644 --- a/urjtag/src/bus/blackfin.c +++ b/urjtag/src/bus/blackfin.c @@ -3,7 +3,7 @@ * * Analog Devices unified Blackfin bus functions * - * Copyright (C) 2008-2010 Analog Devices, Inc. + * Copyright (C) 2008-2011 Analog Devices, Inc. * Licensed under the GPL-2 or later. * * Written by Mike Frysinger heavily leveraging @@ -39,11 +39,31 @@ bfin_bus_attach_sigs (urj_part_t *part, urj_part_signal_t **pins, int pin_cnt, } int -bfin_bus_new (urj_bus_t *bus) +bfin_bus_new (urj_bus_t *bus, const urj_param_t *cmd_params[]) { bfin_bus_params_t *params = bus->params; urj_part_t *part = bus->part; int ret = 0; + size_t i; + + for (i = 0; cmd_params[i]; ++i) + switch (cmd_params[i]->key) + { + case URJ_BUS_PARAM_KEY_HWAIT: + { + const char *hwait = cmd_params[i]->value.string; + + params->hwait_level = (hwait[0] == '/'); + if (params->hwait_level) + ++hwait; + + ret |= urj_bus_generic_attach_sig (part, ¶ms->hwait, hwait); + break; + } + default: + urj_error_set (URJ_ERROR_SYNTAX, _("unknown bus parameter")); + return 1; + } if (!params->async_base) params->async_base = 0x20000000; @@ -136,6 +156,9 @@ bfin_select_flash (urj_bus_t *bus, uint32_t adr) for (i = 0; i < params->abe_cnt; ++i) urj_part_set_signal (part, params->abe[i], 1, 0); + if (params->hwait) + urj_part_set_signal (part, params->hwait, 1, params->hwait_level); + bfin_select_flash_sdram (bus); if (params->select_flash) @@ -155,6 +178,9 @@ bfin_unselect_flash (urj_bus_t *bus) for (i = 0; i < params->abe_cnt; ++i) urj_part_set_signal (part, params->abe[i], 1, 1); + if (params->hwait) + urj_part_set_signal (part, params->hwait, 1, params->hwait_level); + bfin_select_flash_sdram (bus); if (params->unselect_flash) diff --git a/urjtag/src/bus/blackfin.h b/urjtag/src/bus/blackfin.h index 97fdb5c4..d50c77df 100644 --- a/urjtag/src/bus/blackfin.h +++ b/urjtag/src/bus/blackfin.h @@ -3,7 +3,7 @@ * * Analog Devices unified Blackfin bus functions * - * Copyright (C) 2008-2010 Analog Devices, Inc. + * Copyright (C) 2008-2011 Analog Devices, Inc. * Licensed under the GPL-2 or later. */ @@ -34,11 +34,14 @@ typedef struct { int sdram, sms_cnt; urj_part_signal_t *scas, *sras, *swe, *sms[4]; + urj_part_signal_t *hwait; + int hwait_level; + void (*select_flash) (urj_bus_t *bus, uint32_t adr); void (*unselect_flash) (urj_bus_t *bus); } bfin_bus_params_t; -int bfin_bus_new (urj_bus_t *bus); +int bfin_bus_new (urj_bus_t *bus, const urj_param_t *cmd_params[]); int bfin_bus_area (urj_bus_t *bus, uint32_t adr, urj_bus_area_t *area); @@ -66,7 +69,8 @@ void bfin_bus_printinfo (urj_log_level_t ll, urj_bus_t *bus); const urj_bus_driver_t urj_bus_##board##_bus = \ { \ #board, \ - N_("Blackfin " desc " bus driver via BSR"), \ + N_("Blackfin " desc " bus driver via BSR\n" \ + " hwait=[/]SIGNAL Use specified SIGNAL as HWAIT"), \ funcs##_bus_new, \ urj_bus_generic_free, \ bfin_bus_printinfo, \ diff --git a/urjtag/src/bus/buses.c b/urjtag/src/bus/buses.c index 8ca1cc11..c756e362 100644 --- a/urjtag/src/bus/buses.c +++ b/urjtag/src/bus/buses.c @@ -246,6 +246,7 @@ static const urj_param_descr_t bus_param[] = { URJ_BUS_PARAM_KEY_HELP, URJ_PARAM_TYPE_BOOL, "HELP", }, { URJ_BUS_PARAM_KEY_DBGaDDR, URJ_PARAM_TYPE_BOOL, "DBGaDDR", }, { URJ_BUS_PARAM_KEY_DBGdATA, URJ_PARAM_TYPE_BOOL, "DBGdATA", }, + { URJ_BUS_PARAM_KEY_HWAIT, URJ_PARAM_TYPE_STRING, "HWAIT", }, }; const urj_param_list_t urj_bus_param_list =