2009-07-21 23:20:45 +02:00
|
|
|
/*
|
|
|
|
* This file is part of the coreboot project.
|
|
|
|
*
|
2010-09-23 20:48:27 +02:00
|
|
|
* Copyright (C) 2007 AMD
|
|
|
|
* Written by Yinghai Lu <yinghai.lu@amd.com> for AMD.
|
|
|
|
*
|
2009-07-21 23:20:45 +02:00
|
|
|
* 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; version 2 of the License.
|
|
|
|
*
|
|
|
|
* 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., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2010-05-25 18:17:45 +02:00
|
|
|
#include "../lib/usbdebug.c"
|
2010-10-05 15:40:31 +02:00
|
|
|
#include <arch/io.h>
|
|
|
|
#include <ehci.h>
|
2009-07-21 23:20:45 +02:00
|
|
|
|
2010-10-05 15:40:31 +02:00
|
|
|
void early_usbdebug_init(void)
|
2007-02-28 12:17:02 +01:00
|
|
|
{
|
2009-07-21 23:20:45 +02:00
|
|
|
struct ehci_debug_info *dbg_info = (struct ehci_debug_info *)
|
|
|
|
(CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE - sizeof(struct ehci_debug_info));
|
|
|
|
|
2010-10-05 15:40:31 +02:00
|
|
|
usbdebug_init(CONFIG_EHCI_BAR, CONFIG_EHCI_DEBUG_OFFSET, dbg_info);
|
2007-02-28 12:17:02 +01:00
|
|
|
}
|
2009-07-21 23:20:45 +02:00
|
|
|
|
2010-05-25 18:35:51 +02:00
|
|
|
void usbdebug_tx_byte(unsigned char data)
|
2007-02-28 12:17:02 +01:00
|
|
|
{
|
|
|
|
struct ehci_debug_info *dbg_info;
|
2009-07-21 23:20:45 +02:00
|
|
|
|
|
|
|
/* "Find" dbg_info structure in Cache */
|
|
|
|
dbg_info = (struct ehci_debug_info *)
|
|
|
|
(CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE - sizeof(struct ehci_debug_info));
|
|
|
|
|
|
|
|
if (dbg_info->ehci_debug) {
|
2010-08-04 21:29:11 +02:00
|
|
|
dbgp_bulk_write_x(dbg_info, (char*)&data, 1);
|
2007-02-28 12:17:02 +01:00
|
|
|
}
|
|
|
|
}
|
2009-07-21 23:20:45 +02:00
|
|
|
|
2010-05-25 18:35:51 +02:00
|
|
|
void usbdebug_ram_tx_byte(unsigned char data)
|
2007-02-28 12:17:02 +01:00
|
|
|
{
|
|
|
|
struct ehci_debug_info *dbg_info;
|
2009-07-21 23:20:45 +02:00
|
|
|
|
|
|
|
/* "Find" dbg_info structure in RAM */
|
|
|
|
dbg_info = (struct ehci_debug_info *)
|
2009-10-16 18:32:57 +02:00
|
|
|
((CONFIG_RAMTOP) - sizeof(struct ehci_debug_info));
|
2009-07-21 23:20:45 +02:00
|
|
|
|
2007-02-28 12:17:02 +01:00
|
|
|
if (dbg_info->ehci_debug) {
|
2010-08-04 21:29:11 +02:00
|
|
|
dbgp_bulk_write_x(dbg_info, (char*)&data, 1);
|
2007-02-28 12:17:02 +01:00
|
|
|
}
|
|
|
|
}
|