From 04dd17822334871b23ea2862f7798fb0e0007777 Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Sat, 11 May 2024 08:53:19 +0000 Subject: [PATCH] change otg to host mode --- kernel/drivers/usb/early/xhci-dbc.c | 28 +++++++++++----------------- 1 files changed, 11 insertions(+), 17 deletions(-) diff --git a/kernel/drivers/usb/early/xhci-dbc.c b/kernel/drivers/usb/early/xhci-dbc.c index 97885eb..6c04341 100644 --- a/kernel/drivers/usb/early/xhci-dbc.c +++ b/kernel/drivers/usb/early/xhci-dbc.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 -/** +/* * xhci-dbc.c - xHCI debug capability early driver * * Copyright (C) 2016 Intel Corporation @@ -12,16 +12,16 @@ #include <linux/console.h> #include <linux/pci_regs.h> #include <linux/pci_ids.h> -#include <linux/bootmem.h> +#include <linux/memblock.h> #include <linux/io.h> #include <asm/pci-direct.h> #include <asm/fixmap.h> #include <linux/bcd.h> #include <linux/export.h> -#include <linux/version.h> #include <linux/module.h> #include <linux/delay.h> #include <linux/kthread.h> +#include <linux/usb/xhci-dbgp.h> #include "../host/xhci.h" #include "xhci-dbc.h" @@ -94,7 +94,7 @@ { void *virt; - virt = alloc_bootmem_pages_nopanic(PAGE_SIZE); + virt = memblock_alloc(PAGE_SIZE, PAGE_SIZE); if (!virt) return NULL; @@ -135,6 +135,7 @@ { u32 result; + /* Can not use readl_poll_timeout_atomic() for early boot things */ do { result = readl(ptr); result &= mask; @@ -191,7 +192,7 @@ if (!seg) return; - free_bootmem(seg->dma, PAGE_SIZE); + memblock_free(seg->dma, PAGE_SIZE); ring->segment = NULL; } @@ -533,8 +534,6 @@ xdbc_mem_init(); - mmiowb(); - ret = xdbc_start(); if (ret < 0) goto reset_out; @@ -586,8 +585,6 @@ return ret; xdbc_mem_init(); - - mmiowb(); ret = xdbc_start(); if (ret < 0) { @@ -675,10 +672,10 @@ xdbc_free_ring(&xdbc.in_ring); if (xdbc.table_dma) - free_bootmem(xdbc.table_dma, PAGE_SIZE); + memblock_free(xdbc.table_dma, PAGE_SIZE); if (xdbc.out_dma) - free_bootmem(xdbc.out_dma, PAGE_SIZE); + memblock_free(xdbc.out_dma, PAGE_SIZE); xdbc.table_base = NULL; xdbc.out_buf = NULL; @@ -717,17 +714,14 @@ static void xdbc_handle_tx_event(struct xdbc_trb *evt_trb) { - size_t remain_length; u32 comp_code; int ep_id; comp_code = GET_COMP_CODE(le32_to_cpu(evt_trb->field[2])); - remain_length = EVENT_TRB_LEN(le32_to_cpu(evt_trb->field[2])); ep_id = TRB_TO_EP_ID(le32_to_cpu(evt_trb->field[3])); switch (comp_code) { case COMP_SUCCESS: - remain_length = 0; case COMP_SHORT_PACKET: break; case COMP_TRB_ERROR: @@ -978,7 +972,7 @@ goto free_and_quit; } - base = ioremap_nocache(xdbc.xhci_start, xdbc.xhci_length); + base = ioremap(xdbc.xhci_start, xdbc.xhci_length); if (!base) { xdbc_trace("failed to remap the io address\n"); ret = -ENOMEM; @@ -1000,8 +994,8 @@ xdbc_free_ring(&xdbc.evt_ring); xdbc_free_ring(&xdbc.out_ring); xdbc_free_ring(&xdbc.in_ring); - free_bootmem(xdbc.table_dma, PAGE_SIZE); - free_bootmem(xdbc.out_dma, PAGE_SIZE); + memblock_free(xdbc.table_dma, PAGE_SIZE); + memblock_free(xdbc.out_dma, PAGE_SIZE); writel(0, &xdbc.xdbc_reg->control); early_iounmap(xdbc.xhci_base, xdbc.xhci_length); -- Gitblit v1.6.2