From patchwork Mon Nov 6 08:33:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baruch Siach X-Patchwork-Id: 834509 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yVm6z24H0z9s82 for ; Mon, 6 Nov 2017 19:33:47 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id DD9CEC21D95; Mon, 6 Nov 2017 08:33:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 0F7AAC21C73; Mon, 6 Nov 2017 08:33:34 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A08EAC21C73; Mon, 6 Nov 2017 08:33:32 +0000 (UTC) Received: from mx.tkos.co.il (guitar.tcltek.co.il [192.115.133.116]) by lists.denx.de (Postfix) with ESMTPS id 37EE8C21C4C for ; Mon, 6 Nov 2017 08:33:32 +0000 (UTC) Received: from sapphire.lan (unknown [10.0.4.3]) by mx.tkos.co.il (Postfix) with ESMTPA id 0977C440479; Mon, 6 Nov 2017 10:33:31 +0200 (IST) From: Baruch Siach To: Prafulla Wadaskar , Luka Perkov , Stefan Roese Date: Mon, 6 Nov 2017 10:33:19 +0200 Message-Id: <3c22509ba71ba451819076736d3281ba9a995a4f.1509957201.git.baruch@tkos.co.il> X-Mailer: git-send-email 2.14.2 Cc: u-boot@lists.denx.de, Baruch Siach Subject: [U-Boot] [PATCH 1/3] mvebu: usb: xhci: a38x support X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Jon Nettleton This makes the initial changes need to support the a38x series of SOCs. It adds the device-tree identifier as well as changing the board_support function to take the IO address designated by device-tree. Signed-off-by: Jon Nettleton [baruch: use fdt_addr_t; update 37xx and 8K implementations] Signed-off-by: Baruch Siach --- board/Marvell/mvebu_armada-37xx/board.c | 2 +- board/Marvell/mvebu_armada-8k/board.c | 2 +- drivers/usb/host/xhci-mvebu.c | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c index 8dc1f46d9739..ac3e3a392fc2 100644 --- a/board/Marvell/mvebu_armada-37xx/board.c +++ b/board/Marvell/mvebu_armada-37xx/board.c @@ -123,7 +123,7 @@ int board_ahci_enable(void) } /* Board specific xHCI enable code */ -int board_xhci_enable(void) +int board_xhci_enable(fdt_addr_t base) { struct udevice *dev; int ret; diff --git a/board/Marvell/mvebu_armada-8k/board.c b/board/Marvell/mvebu_armada-8k/board.c index 7d1b5d9f6239..f4eabfb14f1d 100644 --- a/board/Marvell/mvebu_armada-8k/board.c +++ b/board/Marvell/mvebu_armada-8k/board.c @@ -95,7 +95,7 @@ int board_xhci_config(void) return 0; } -int board_xhci_enable(void) +int board_xhci_enable(fdt_addr_t base) { struct udevice *dev; int ret; diff --git a/drivers/usb/host/xhci-mvebu.c b/drivers/usb/host/xhci-mvebu.c index b9201a5a6a3f..dbdfce38da20 100644 --- a/drivers/usb/host/xhci-mvebu.c +++ b/drivers/usb/host/xhci-mvebu.c @@ -35,7 +35,7 @@ struct mvebu_xhci { * Dummy implementation that can be overwritten by a board * specific function */ -__weak int board_xhci_enable(void) +__weak int board_xhci_enable(fdt_addr_t base) { return 0; } @@ -62,7 +62,7 @@ static int xhci_usb_probe(struct udevice *dev) } /* Enable USB xHCI (VBUS, reset etc) in board specific code */ - board_xhci_enable(); + board_xhci_enable(devfdt_get_addr_index(dev, 1)); return xhci_register(dev, ctx->hcd, hcor); } @@ -85,6 +85,7 @@ static int xhci_usb_ofdata_to_platdata(struct udevice *dev) static const struct udevice_id xhci_usb_ids[] = { { .compatible = "marvell,armada3700-xhci" }, + { .compatible = "marvell,armada-380-xhci" }, { .compatible = "marvell,armada-8k-xhci" }, { } }; From patchwork Mon Nov 6 08:33:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baruch Siach X-Patchwork-Id: 834510 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yVm7J6rZBz9s82 for ; Mon, 6 Nov 2017 19:34:04 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 8958CC21D95; Mon, 6 Nov 2017 08:33:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id F0B27C21D99; Mon, 6 Nov 2017 08:33:34 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id AEF56C21C4C; Mon, 6 Nov 2017 08:33:32 +0000 (UTC) Received: from mx.tkos.co.il (guitar.tcltek.co.il [192.115.133.116]) by lists.denx.de (Postfix) with ESMTPS id 54CCFC21D78 for ; Mon, 6 Nov 2017 08:33:32 +0000 (UTC) Received: from sapphire.lan (unknown [10.0.4.3]) by mx.tkos.co.il (Postfix) with ESMTPA id 659B344059D; Mon, 6 Nov 2017 10:33:31 +0200 (IST) From: Baruch Siach To: Prafulla Wadaskar , Luka Perkov , Stefan Roese Date: Mon, 6 Nov 2017 10:33:20 +0200 Message-Id: X-Mailer: git-send-email 2.14.2 In-Reply-To: <3c22509ba71ba451819076736d3281ba9a995a4f.1509957201.git.baruch@tkos.co.il> References: <3c22509ba71ba451819076736d3281ba9a995a4f.1509957201.git.baruch@tkos.co.il> Cc: u-boot@lists.denx.de, Baruch Siach Subject: [U-Boot] [PATCH 2/3] arm: mvebu: Add board_setup for xhci hardware X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Jon Nettleton This fixes the USB 3.0 support for the a38x SOC. Signed-off-by: Jon Nettleton [baruch: use fdt_addr_t] Signed-off-by: Baruch Siach --- arch/arm/mach-mvebu/cpu.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/arch/arm/mach-mvebu/cpu.c b/arch/arm/mach-mvebu/cpu.c index 74a63dd6560b..7c64a68388b5 100644 --- a/arch/arm/mach-mvebu/cpu.c +++ b/arch/arm/mach-mvebu/cpu.c @@ -554,6 +554,47 @@ void scsi_init(void) } #endif +#ifdef CONFIG_USB_XHCI_MVEBU +#define USB3_MAX_WINDOWS 4 +#define USB3_WIN_CTRL(w) (0x0 + ((w) * 8)) +#define USB3_WIN_BASE(w) (0x4 + ((w) * 8)) + +static void xhci_mvebu_mbus_config(void __iomem *base, + const struct mbus_dram_target_info *dram) +{ + int i; + + for (i = 0; i < USB3_MAX_WINDOWS; i++) { + writel(0, base + USB3_WIN_CTRL(i)); + writel(0, base + USB3_WIN_BASE(i)); + } + + for (i = 0; i < dram->num_cs; i++) { + const struct mbus_dram_window *cs = dram->cs + i; + + /* Write size, attributes and target id to control register */ + writel(((cs->size - 1) & 0xffff0000) | (cs->mbus_attr << 8) | + (dram->mbus_dram_target_id << 4) | 1, + base + USB3_WIN_CTRL(i)); + + /* Write base address to base register */ + writel((cs->base & 0xffff0000), base + USB3_WIN_BASE(i)); + } +} + +int board_xhci_enable(fdt_addr_t base) +{ + const struct mbus_dram_target_info *dram; + + printf("MVEBU XHCI INIT controller @ 0x%lx\n", base); + + dram = mvebu_mbus_dram_info(); + xhci_mvebu_mbus_config((void __iomem *)base, dram); + + return 0; +} +#endif + void enable_caches(void) { /* Avoid problem with e.g. neta ethernet driver */ From patchwork Mon Nov 6 08:33:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baruch Siach X-Patchwork-Id: 834511 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3yVm8N6kDBz9s7h for ; Mon, 6 Nov 2017 19:35:00 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 92ABEC21DB9; Mon, 6 Nov 2017 08:34:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id D26AAC21DCE; Mon, 6 Nov 2017 08:33:35 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 13941C21C4C; Mon, 6 Nov 2017 08:33:33 +0000 (UTC) Received: from mx.tkos.co.il (guitar.tcltek.co.il [192.115.133.116]) by lists.denx.de (Postfix) with ESMTPS id B05F4C21D72 for ; Mon, 6 Nov 2017 08:33:32 +0000 (UTC) Received: from sapphire.lan (unknown [10.0.4.3]) by mx.tkos.co.il (Postfix) with ESMTPA id B043C4408BE; Mon, 6 Nov 2017 10:33:31 +0200 (IST) From: Baruch Siach To: Prafulla Wadaskar , Luka Perkov , Stefan Roese Date: Mon, 6 Nov 2017 10:33:21 +0200 Message-Id: <84ba2549060508b638faf68fd43d6e2ebad86b55.1509957201.git.baruch@tkos.co.il> X-Mailer: git-send-email 2.14.2 In-Reply-To: <3c22509ba71ba451819076736d3281ba9a995a4f.1509957201.git.baruch@tkos.co.il> References: <3c22509ba71ba451819076736d3281ba9a995a4f.1509957201.git.baruch@tkos.co.il> Cc: u-boot@lists.denx.de, Baruch Siach Subject: [U-Boot] [PATCH 3/3] arm: mvebu: clearfog: enable XHCI USB X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Jon Nettleton Enable the driver by default for the clearfog boards since the external port is configured for XHCI. Signed-off-by: Jon Nettleton [baruch: split from the SoC setup patch] Signed-off-by: Baruch Siach --- configs/clearfog_defconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configs/clearfog_defconfig b/configs/clearfog_defconfig index fa9f04a9d8a2..3de204346d88 100644 --- a/configs/clearfog_defconfig +++ b/configs/clearfog_defconfig @@ -43,5 +43,6 @@ CONFIG_DEBUG_UART_SHIFT=2 CONFIG_SYS_NS16550=y CONFIG_USB=y CONFIG_DM_USB=y -CONFIG_USB_EHCI_HCD=y +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_MVEBU=y CONFIG_USB_STORAGE=y