The i.MX50 SOC includes one ESDHCv3, three ESDHCv2, one cspi and
two ecspi instances which are supported by existing drivers.
Signed-off-by: Alexander Kurz <akurz@blala.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
We only allow to setup the host/peripheral role once, when it's already
set then we return -EBUSY.
Return 0 instead when we set the same role again and only return -EBUSY
when we actually try to change the role.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The majority of the stuff currently in include/boot.h is about bootm
code implemented common/bootm.c. To be more consistent move it to a
new file include/bootm.h.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
usb_control_msg() and usb_bulk_msg() have a timeout parameter. Honour
this in the ehci driver instead of using a default timeout.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Fixes: b1374a6 usb: fastboot: drop CONFIG_COMMAND_SUPPORT dependency
The correct config option to depend on is CONFIG_COMMAND_SUPPORT,
not CONFIG_COMMAND.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This makes it possible to compile the fastboot gadget without
command support. While at it bail out when ubiformat is not
compiled in.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
fixes: 81737c1 mtd: Fix erasing of devices >4GiB
Several places erased a complete flash partition passing ~0 as count to
erase(). With the above commit count to erase was changed from an unsigned
type to a signed type, so the (count > f->size - offset) check in
erase() no longer triggers and the ~0 count is no longer adjusted to the whole
device size. Among other things this results in saveenv failures on NOR
flashes.
This patch fixes this by introducing an explicit macro for erasing the
whole device which is tested for in erase(). All other negative values
are rejected.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reported-by: Giorgio <giorgio.nicole@arcor.de>
Our asprintf and vasprintf have different prototypes than the glibc
functions. This causes trouble when we want to share barebox code
with userspace code. Change the prototypes for (v)asprintf to match
the glibc prototypes. Since the current (v)asprintf are convenient
to use change the existing functions to b(v)asprintf.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This will automatically call barebox_update for the transfered file if
it is an ARM Barebox image and the destination file is defined by some
update handler.
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
In Linux ehci-q Data Toggle Control bit for interrupt transactions
is preserved in Queue Head (EHCI 3.6.2). So don't set 14's bit in
qh_endpt1 and don't manage toggle bit anywhere in int transactions.
This fixes an idle issue for USB keyboards, where keys
were physically changed but barebox haven't seen them in polling
until the next USB keyboard polling occurs.
Signed-off-by: Aleksey Kuleshov <rndfax@yandex.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This is just a regular iteration loop so no timeout needed
Signed-off-by: Aleksey Kuleshov <rndfax@yandex.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Currently all fastboot flash commands with UBI images are handled by a
final call to 'ubiformat'. This only makes sense for flash commands
where the target file is a mtd device. If we just want to transfer a UBI
image we would expect a simple copy to the correct location.
This patch checks if the destination file is a MTD device by opening it
and calling an ioctl MEMGETINFO. Only for MTD devices, ubiformat is
called.
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Move spinlock related definitions to its original place.
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The VBUS regulator is optional for the chipidea-imx glue, so it must
be checked if regulator_get provided a valid regulator handle before
trying to enable the regulator.
Signed-off-by: David Jander <david@protonic.nl>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The bit MX25_H1_PM_BIT value is handled for port 1 as MX25_OTG_PM_BIT is
for port 0. The latter is called "OPM: OTG power mask" in the i.MX25
reference manual. Its description matches the description of "HPM: Host
power mask" for the host port which is bit 16, not 8.
The Linux kernel (as of 4.3) also has
#define MX25_H1_PM_BIT BIT(16)
.
Fixes: a4076ddf65 ("USB i.MX: Add chipidea driver support")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The USB core will make sure we do not re-enter the ehci driver, so
we can use regular mdelay instead of mdelay_non_interruptible().
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Now that the USB core makes sure that we do not re-enter USB
drivers we no longer have to detect re-entrancy in the ehci driver.
This reverts commit 8426cc641d.
Now that the USB core makes sure that we do not re-enter USB
drivers we no longer need mdelay_non_interruptible() but can use
regular mdelay() again.
This reverts commit 4cfd909412.
In drivers/usb/core/usb.c we already have le16_to_cpus() conversion
just after usb_get_descriptor():
390 /* correct le values */
391 le16_to_cpus(&dev->descriptor->bcdUSB);
392 le16_to_cpus(&dev->descriptor->idVendor);
393 le16_to_cpus(&dev->descriptor->idProduct);
394 le16_to_cpus(&dev->descriptor->bcdDevice);
so no additional idVendor/idProduct descriptor fields
le16_to_cpu() conversion is needed after that.
On the big-endian machines extra le16_to_cpu() conversion
leads to wrong idVendor/idProduct USB device parameters values
(e.g. see devinfo <usb-device> output), and to a much more
serious problem: idVendor/idProduct-based USB device detection
does not work.
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
it's currently only handled through DT and for i.MX25 OTG port (at least),
we need to configure portsc to get host mode working but it actually fails
as ci->phymode is 0 which is USBPHY_INTERFACE_MODE_UNKNOWN
Signed-off-by: Eric Bénard <eric@eukrea.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
putting an error pointer into strerror can be a bit confusing since
strerror takes a positive error code but PTR_ERR returns a negative
number, so we have to do strerror(-PTR_ERR(errp)). Some places got
this wrong already, so introduce a strerrorp function which directly
takes an error pointer.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The host may assume that the usb device is still up and running after
booting if we do not deregister the udc here. I observed issues when the
linux kernel was using a usb gadget directly where the complete USB Hub
got disconnected through this.
This patch adds a proper USB disconnect for gadget devices.
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Use is_timeout_non_interruptible() intead of is_timeout()
to avoid re-entering ehci-hcd functions from pollers,
registered by usb drivers.
Signed-off-by: Peter Mamonov <pmamonov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
See the commit
commit 245069bcef
Author: Sascha Hauer <s.hauer@pengutronix.de>
Date: Thu Jul 10 11:36:12 2014 +0200
USB: introduce usb_interface/usb_configuration structs
On little endian systems like ARM the le16_to_cpus() macro
is a no op, defined as:
#define le16_to_cpus __le16_to_cpus
#define __le16_to_cpus(x) do {} while (0)
So struct usb_configuration field misuse was discovered
on big-endian MIPS machine.
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This replaces the reset_cpu() function which every SoC or board must
provide with registered handlers. This makes it possible to have multiple
reset functions for boards which have multiple ways to reset the machine.
Also boards which have no way at all to reset the machine no longer
have to provide a dummy reset_cpu() function.
The problem this solves is that some machines have external PMICs or
similar to reset the system which have to be preferred over the
internal SoC reset, because the PMIC can reset not only the SoC but also
the external devices.
To pick the right way to reset a machine each handler has a priority. The
default priority is 100 and all currently existing restart handlers are
registered with this priority. of_get_restart_priority() allows to retrieve
the priority from the device tree which makes it possible for boards to
give certain restart handlers a higher priority in order to use this one
instead of the default one.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
1. The 'index' of ehci_submit_root() is not always > 0.
e.g.
While it gets invoked from usb_get_descriptor(),
the 'index' is always a '0'. (See ch.9 of USB2.0)
2. The PORTSC register is not always required, and thus it
should only report a port error when necessary.
It would cause a port scan failure if the ehci_submit_root()
always gets terminated by a port error.
Signed-off-by: Kuo-Jung Su <dantesu@faraday-tech.com>
Signed-off-by: Peter Mamonov <pmamonov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Without this initialization ehci->qh_list[0].qh_endpt2 is left uninitialized,
which causes problems with some EHCI host controllers.
Das u-boot uses the same strategy:
static int ehci_common_init(struct ehci_ctrl *ctrl, uint tweaks)
{
...
qh_list = &ctrl->qh_list;
/* Set head of reclaim list */
memset(qh_list, 0, sizeof(*qh_list));
qh_list->qh_link = cpu_to_hc32((unsigned long)qh_list | QH_LINK_TYPE_QH);
qh_list->qh_endpt1 = cpu_to_hc32(QH_ENDPT1_H(1) |
QH_ENDPT1_EPS(USB_SPEED_HIGH));
qh_list->qh_overlay.qt_next = cpu_to_hc32(QT_NEXT_TERMINATE);
qh_list->qh_overlay.qt_altnext = cpu_to_hc32(QT_NEXT_TERMINATE);
qh_list->qh_overlay.qt_token =
cpu_to_hc32(QT_TOKEN_STATUS(QT_TOKEN_STATUS_HALTED));
...
}
Signed-off-by: Peter Mamonov <pmamonov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Fixes:
drivers/built-in.o: In function `gserial_connect':
drivers/usb/gadget/u_serial.c:539: undefined reference to `console_set_active'
Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>