From 74a98425efd53098ed430e6817261cf6386cce3a Mon Sep 17 00:00:00 2001 From: Anton Staaf Date: Mon, 10 Nov 2014 11:23:21 -0800 Subject: USB: Fix issue with USB RAM sizes Previously the USB RAM size was off by a factor of two for chips that required 32-bit alignment of accesses, even though the underlying memory was 16-bits in size. This change adds an additional configuration for the access size (it still assumes that the underlying memory is 16-bits in size) and uses that to adjust the USB_RAM memory section in the linker scripts. This change also removes the default values for the USB RAM from stm32/config_chip.h because they mask issues when new chips are added. It is better for a new chip to fail to compile until these values are provided. Finally, this change introduces a common USB API header so that common code doesn't need to include the STM32 specific header. Signed-off-by: Anton Staaf BRANCH=None BUG=None TEST=make buildall -j Enable console on ryu_p2 and discovery-stm32f072 board Verify that it works on both Change-Id: Id118627f53e9e8ff1bd09fb51f1f9634ff495d19 Reviewed-on: https://chromium-review.googlesource.com/228833 Tested-by: Anton Staaf Reviewed-by: Vincent Palatin Commit-Queue: Anton Staaf --- include/usb_api.h | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 include/usb_api.h (limited to 'include/usb_api.h') diff --git a/include/usb_api.h b/include/usb_api.h new file mode 100644 index 0000000000..feeb6abb27 --- /dev/null +++ b/include/usb_api.h @@ -0,0 +1,41 @@ +/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + * + * USB API definitions. + * + * This file includes definitions needed by common code that wants to control + * the state of the USB peripheral, but doesn't need to know about the specific + * implementation. + */ + +#ifndef USB_API_H +#define USB_API_H + +/* + * Initialize the USB peripheral, enabling its clock and configuring the DP/DN + * GPIOs correctly. This function is called via an init hook, but may need to + * be called again if usb_release is called. This function will call + * usb_connect by default unless CONFIG_USB_INHIBIT is defined. + */ +void usb_init(void); + +/* + * Enable the pullup on the DP line to signal that this device exists to the + * host and to start the enumeration process. + */ +void usb_connect(void); + +/* + * Disable the pullup on the DP line. This causes the device to be disconnected + * from the host. + */ +void usb_disconnect(void); + +/* + * Disconnect from the host by calling usb_disconnect and then turn off the USB + * peripheral, releasing its GPIOs and disabling its clock. + */ +void usb_release(void); + +#endif /* USB_API_H */ -- cgit v1.2.1