mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-21 22:23:05 +00:00
Workaround lack of SPMI support in usb.c
M3+ have a new USB power controller and it works over SPMI. However, the USB ports work (at least within m1n1) if we ignore this and just init the phys directly. This detects the case where we are not on an I2C based USB machine, and initializes the phys directly. Eventually we should support SPMI properly. Signed-off-By: Daniel Berlin <dberlin@dberlin.org>
This commit is contained in:
parent
b50b17ceb5
commit
9065c700df
1 changed files with 18 additions and 0 deletions
18
src/usb.c
18
src/usb.c
|
@ -7,6 +7,7 @@
|
|||
#include "iodev.h"
|
||||
#include "malloc.h"
|
||||
#include "pmgr.h"
|
||||
#include "string.h"
|
||||
#include "tps6598x.h"
|
||||
#include "types.h"
|
||||
#include "usb_dwc3.h"
|
||||
|
@ -228,6 +229,14 @@ static tps6598x_dev_t *hpm_init(i2c_dev_t *i2c, const char *hpm_path)
|
|||
return tps;
|
||||
}
|
||||
|
||||
void usb_spmi_init(void)
|
||||
{
|
||||
for (int idx = 0; idx < USB_IODEV_COUNT; ++idx)
|
||||
usb_phy_bringup(idx); /* Fails on missing devices, just continue */
|
||||
|
||||
usb_is_initialized = true;
|
||||
}
|
||||
|
||||
void usb_init(void)
|
||||
{
|
||||
char hpm_path[sizeof(FMT_HPM_PATH)];
|
||||
|
@ -235,6 +244,15 @@ void usb_init(void)
|
|||
if (usb_is_initialized)
|
||||
return;
|
||||
|
||||
/*
|
||||
* M3 models do not use i2c, but instead SPMI with a new controller.
|
||||
* We can get USB going for now by just bringing up the phys.
|
||||
*/
|
||||
if (adt_path_offset(adt, "/arm-io/nub-spmi-a0/hpm0") != 0) {
|
||||
usb_spmi_init();
|
||||
return;
|
||||
}
|
||||
|
||||
i2c_dev_t *i2c = i2c_init("/arm-io/i2c0");
|
||||
if (!i2c) {
|
||||
printf("usb: i2c init failed.\n");
|
||||
|
|
Loading…
Reference in a new issue