sunxi: usb: Drop AXP-sepcific VBUS detection and drive logic

VBUS detection and enable is now be used with virtual AXP GPIOs, so all the USB
code has to use GPIO in every case and let sunxi_gpio do the heavy lifting.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
master
Paul Kocialkowski 10 years ago committed by Hans de Goede
parent f7c7ab636a
commit 5eaacb4340
  1. 17
      arch/arm/cpu/armv7/sunxi/usbc.c
  2. 4
      configs/Ippo_q8h_v1_2_defconfig
  3. 4
      configs/Ippo_q8h_v5_defconfig
  4. 48
      drivers/usb/musb-new/sunxi.c

@ -80,12 +80,6 @@ static struct sunxi_usbc_hcd {
static int enabled_hcd_count;
static bool use_axp_drivebus(int index)
{
return index == 0 &&
strcmp(CONFIG_USB0_VBUS_PIN, "axp_drivebus") == 0;
}
void *sunxi_usbc_get_io_base(int index)
{
switch (index) {
@ -102,9 +96,6 @@ void *sunxi_usbc_get_io_base(int index)
static int get_vbus_gpio(int index)
{
if (use_axp_drivebus(index))
return -1;
switch (index) {
case 0: return sunxi_name_to_gpio(CONFIG_USB0_VBUS_PIN);
case 1: return sunxi_name_to_gpio(CONFIG_USB1_VBUS_PIN);
@ -258,10 +249,6 @@ void sunxi_usbc_vbus_enable(int index)
{
struct sunxi_usbc_hcd *sunxi_usbc = &sunxi_usbc_hcd[index];
#ifdef AXP_DRIVEBUS
if (use_axp_drivebus(index))
axp_drivebus_enable();
#endif
if (sunxi_usbc->gpio_vbus != -1)
gpio_direction_output(sunxi_usbc->gpio_vbus, 1);
}
@ -270,10 +257,6 @@ void sunxi_usbc_vbus_disable(int index)
{
struct sunxi_usbc_hcd *sunxi_usbc = &sunxi_usbc_hcd[index];
#ifdef AXP_DRIVEBUS
if (use_axp_drivebus(index))
axp_drivebus_disable();
#endif
if (sunxi_usbc->gpio_vbus != -1)
gpio_direction_output(sunxi_usbc->gpio_vbus, 0);
}

@ -2,8 +2,8 @@ CONFIG_SPL=y
CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
CONFIG_FDTFILE="sun8i-a23-ippo-q8h-v1.2.dtb"
CONFIG_USB_MUSB_SUNXI=y
CONFIG_USB0_VBUS_PIN="axp_drivebus"
CONFIG_USB0_VBUS_DET="axp_vbus_detect"
CONFIG_USB0_VBUS_PIN="AXP0-VBUS-ENABLE"
CONFIG_USB0_VBUS_DET="AXP0-VBUS-DETECT"
CONFIG_VIDEO_LCD_MODE="x:800,y:480,depth:18,pclk_khz:33000,le:87,ri:167,up:31,lo:13,hs:1,vs:1,sync:3,vmode:0"
CONFIG_VIDEO_LCD_DCLK_PHASE=0
CONFIG_VIDEO_LCD_POWER="PH7"

@ -2,8 +2,8 @@ CONFIG_SPL=y
CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
CONFIG_FDTFILE="sun8i-a23-ippo-q8h-v5.dtb"
CONFIG_USB_MUSB_SUNXI=y
CONFIG_USB0_VBUS_PIN="axp_drivebus"
CONFIG_USB0_VBUS_DET="axp_vbus_detect"
CONFIG_USB0_VBUS_PIN="AXP0-VBUS-ENABLE"
CONFIG_USB0_VBUS_DET="AXP0-VBUS-DETECT"
CONFIG_VIDEO_LCD_MODE="x:800,y:480,depth:18,pclk_khz:33000,le:87,ri:168,up:31,lo:13,hs:1,vs:1,sync:3,vmode:0"
CONFIG_VIDEO_LCD_DCLK_PHASE=0
CONFIG_VIDEO_LCD_POWER="PH7"

@ -238,38 +238,28 @@ static int sunxi_musb_init(struct musb *musb)
if (is_host_enabled(musb)) {
int vbus_det = sunxi_name_to_gpio(CONFIG_USB0_VBUS_DET);
#ifdef AXP_VBUS_DETECT
if (!strcmp(CONFIG_USB0_VBUS_DET, "axp_vbus_detect")) {
err = axp_get_vbus();
if (err < 0)
return err;
} else {
#endif
if (vbus_det == -1) {
eprintf("Error invalid Vusb-det pin\n");
return -EINVAL;
}
err = gpio_request(vbus_det, "vbus0_det");
if (err)
return err;
err = gpio_direction_input(vbus_det);
if (err) {
gpio_free(vbus_det);
return err;
}
err = gpio_get_value(vbus_det);
if (err < 0) {
gpio_free(vbus_det);
return -EIO;
}
if (vbus_det == -1) {
eprintf("Error invalid Vusb-det pin\n");
return -EINVAL;
}
err = gpio_request(vbus_det, "vbus0_det");
if (err)
return err;
err = gpio_direction_input(vbus_det);
if (err) {
gpio_free(vbus_det);
#ifdef AXP_VBUS_DETECT
return err;
}
#endif
err = gpio_get_value(vbus_det);
if (err < 0) {
gpio_free(vbus_det);
return -EIO;
}
gpio_free(vbus_det);
if (err) {
eprintf("Error: A charger is plugged into the OTG\n");

Loading…
Cancel
Save