From patchwork Sun Jul 14 00:16:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1131667 X-Patchwork-Delegate: joe.hershberger@gmail.com 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="sWStBwvT"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45mS471TBwz9sDQ for ; Sun, 14 Jul 2019 10:20:39 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id CA03BC21DF9; Sun, 14 Jul 2019 00:20:08 +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=FREEMAIL_FROM, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID 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 B3460C21E0B; Sun, 14 Jul 2019 00:19:55 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2F992C21BE5; Sun, 14 Jul 2019 00:19:52 +0000 (UTC) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by lists.denx.de (Postfix) with ESMTPS id CE9A2C21BE5 for ; Sun, 14 Jul 2019 00:19:51 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id f17so11877326wme.2 for ; Sat, 13 Jul 2019 17:19:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=INY52VARqoDjtLDVWY0cQuU7b4jQA8JxlQwdLEZ+cUE=; b=sWStBwvT52I7SKycMEk2CWMvzG8bb2KHNrqaLGiRt8g5HCWDQVhaFl97FQ4kJ094i8 oHcLqIlNNxCsu7IZfoJkSz50xogysrk6y6IKrUBZHlo/DFN6nWN5UWmwskcMD5aiyXGU 1MlKAsF2ZZTu1AJwAAkp1/TTOfK3MauUMus5tPZdCy+J3z1hfqyd72+b4rThRJ8AOOIX /RGXHUTekgVSDaQKPxmi7GqDdJ/Y1eMod4vnQJmQpgyvyNO+wDSZJaXKNrbi02fMg7Ms m7rIDhKKEP9iqss+20MUZYMewC+SbBhBtoBpMGgFvEKmWJE2EOLnFUMXvvEklbyvGw8b B5YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=INY52VARqoDjtLDVWY0cQuU7b4jQA8JxlQwdLEZ+cUE=; b=QNv3IxnU+G012Ad5r5hwjDqpKoGn6NEHA3CUJplj8u4fbFAtky4mzWSbHrf8/MUZcE ExYsHTh4YVahRbIiLCMoz1v5iwnqPD0mDuEP+0u8UMseh7Vu0t7AwKQL6aY+ggWIYaNC 8DiWuweM+V66ofHNTKGoM8u+9yVQBXW/0woI9W0nyNdwQHMnsxJB1QgvXci0umKOJYSS ImVH4bf1HqwGaT8D4gxQgMs3fG8M6LvMPLJI8gZr2KC5forj4LCTSBLPYLAvcUA/QP3H fypjRMmCivWNKrnikPyO15WHjnCZPlrqm7S4QgyTbutKPps9alYBu1L1NNziIYLpGrRw 6U+w== X-Gm-Message-State: APjAAAUm0G2fApQ6U1Okp9MJN/ITXbezh3lg8l2d7M13EvYu6vh8Qpys QL8K02/44wzP/b4AnaBCLPk= X-Google-Smtp-Source: APXvYqxzZ5hn1mgOQGusw8lcgXQvTtF5MMup2QRHiDa2JsPuT42jW0prH+kaJEl98tzpdz79TK34pQ== X-Received: by 2002:a1c:e409:: with SMTP id b9mr15310448wmh.110.1563063591427; Sat, 13 Jul 2019 17:19:51 -0700 (PDT) Received: from localhost.localdomain ([188.26.252.192]) by smtp.gmail.com with ESMTPSA id m24sm7801973wmi.39.2019.07.13.17.19.50 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 13 Jul 2019 17:19:51 -0700 (PDT) From: Vladimir Oltean To: joe.hershberger@ni.com, prabhakar.kushwaha@nxp.com, bmeng.cn@gmail.com, u-boot@lists.denx.de Date: Sun, 14 Jul 2019 03:16:53 +0300 Message-Id: <20190714001701.2781-2-olteanv@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190714001701.2781-1-olteanv@gmail.com> References: <20190714001701.2781-1-olteanv@gmail.com> Subject: [U-Boot] [PATCH v2 1/9] net: tsec: Refactor the readout of the tbi-handle property 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" The point of this patch is to eliminate the use of the locally-defined "reg" variable (which interferes with next patch) and simplify the fallback to the default CONFIG_SYS_TBIPA_VALUE in case "tbi-handle" is missing. Signed-off-by: Vladimir Oltean Acked-by: Joe Hershberger Reviewed-by: Bin Meng --- Changes from v1: None. drivers/net/tsec.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index 06a9b4fb03ce..53eb5470f4c8 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -798,6 +798,7 @@ int tsec_probe(struct udevice *dev) struct eth_pdata *pdata = dev_get_platdata(dev); struct fsl_pq_mdio_info mdio_info; struct ofnode_phandle_args phandle_args; + u32 tbiaddr = CONFIG_SYS_TBIPA_VALUE; ofnode parent; const char *phy_mode; int ret; @@ -825,14 +826,12 @@ int tsec_probe(struct udevice *dev) return -ENOENT; } - if (dev_read_phandle_with_args(dev, "tbi-handle", NULL, 0, 0, - &phandle_args)) { - priv->tbiaddr = CONFIG_SYS_TBIPA_VALUE; - } else { - int reg = ofnode_read_u32_default(phandle_args.node, "reg", - CONFIG_SYS_TBIPA_VALUE); - priv->tbiaddr = reg; - } + ret = dev_read_phandle_with_args(dev, "tbi-handle", NULL, 0, 0, + &phandle_args); + if (ret == 0) + ofnode_read_u32(phandle_args.node, "reg", &tbiaddr); + + priv->tbiaddr = tbiaddr; phy_mode = dev_read_prop(dev, "phy-connection-type", NULL); if (phy_mode) From patchwork Sun Jul 14 00:16:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1131668 X-Patchwork-Delegate: joe.hershberger@gmail.com 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="m3w4Wra0"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45mS4j4dnzz9sDQ for ; Sun, 14 Jul 2019 10:21:09 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 48D3BC21DB5; Sun, 14 Jul 2019 00:20:35 +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=FREEMAIL_FROM, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID 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 C4017C21DFD; Sun, 14 Jul 2019 00:19:59 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5E736C21E1D; Sun, 14 Jul 2019 00:19:55 +0000 (UTC) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by lists.denx.de (Postfix) with ESMTPS id A3042C21D4A for ; Sun, 14 Jul 2019 00:19:52 +0000 (UTC) Received: by mail-wr1-f68.google.com with SMTP id p13so13399113wru.10 for ; Sat, 13 Jul 2019 17:19:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WPdDuBNEns/4T0QEcLWEs0CZ9m6wx8bm5JjxIZiv770=; b=m3w4Wra0xKC8T1QYSTwkd+8z1C78+70zBC162Pv5EN3TF4h4zStzGHeLdE39w3zHBT WFT1Ic5F842uTWAZ0G70DotMOvak8nUwUrpvyvLVxBh4dIPwvr8xyCBSDtYL+D6iqQaK NvLCsMQYExk+F7ypDAi094/GNqtW9I/qFCTc0sbgDzzLUf4zQrOijnXT46a8ScHL/o63 PoCA6YpFZwSRngGJAFC7LvzYxbAw+j/LqFqwnjOWxpHJMMDxWOhb20CqS1T+qb/Bo/XU NU8DWFRSlbooh4yuxGCsP6eeLw0nSfa1Hx2xPe7x6e7EWiWDb9+T3HdqND6+s0VjX+f3 7HBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WPdDuBNEns/4T0QEcLWEs0CZ9m6wx8bm5JjxIZiv770=; b=kDwL9nFa2CnuuDU46VR8/6kvNR2RJFmGbolsBoPbhromcb2A9vkezR6VXHv8wwHdIU CkIHJIV+QYh+YKIeZyKRLijeCsjcTkYRw9zVWPjjCPACdTQ5sKYJivDjOHu0+gmWHMkd m8Obsq9Ic7QFH1X+0ee/HviwP2ujAyKpqFqGneW0q21TP46KR1vSvWQPvwBIIb1J18CL jyxMLOE5S+WsbZrzOHpl+CArb1QBcpKkKSN9iFSbGa+4XSkeS6o8mFf6PG3rA/XZhukK 1nia3d1SobRevJBjjMeYMxp/2furo0ndwkUy0b/MtFB4hr5iVxaXS4JG0hQZONYiItwC HDfg== X-Gm-Message-State: APjAAAWilHDZAXsE64yS1v3B/FHvozgYg7/lIJSEzDgU1sbyuSJOszV1 +viWvo2QyeYQU31ZoU0KuM4= X-Google-Smtp-Source: APXvYqwdKM9Ntvo+zeWxFVlmvFMZXNYnXV1c767iKrOsy+1HOX0RykTRwPgNh3VdvgUCiq7XpT1JHQ== X-Received: by 2002:adf:ea4c:: with SMTP id j12mr20241753wrn.75.1563063592249; Sat, 13 Jul 2019 17:19:52 -0700 (PDT) Received: from localhost.localdomain ([188.26.252.192]) by smtp.gmail.com with ESMTPSA id m24sm7801973wmi.39.2019.07.13.17.19.51 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 13 Jul 2019 17:19:51 -0700 (PDT) From: Vladimir Oltean To: joe.hershberger@ni.com, prabhakar.kushwaha@nxp.com, bmeng.cn@gmail.com, u-boot@lists.denx.de Date: Sun, 14 Jul 2019 03:16:54 +0300 Message-Id: <20190714001701.2781-3-olteanv@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190714001701.2781-1-olteanv@gmail.com> References: <20190714001701.2781-1-olteanv@gmail.com> Subject: [U-Boot] [PATCH v2 2/9] net: tsec: Fix offset of MDIO registers for DM_ETH 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" By convention, the eTSEC MDIO controller nodes are defined in DT at 0x2d24000 and 0x2d50000, but actually U-Boot does not touch the interrupt portion of the register map (MDIO_IEVENTM, MDIO_IMASKM, MDIO_EMAPM). That leaves only the MDIO bus registers (MDIO_MIIMCFG, MDIO_MIIMCOM, MDIO_MIIMADD, MDIO_MIIMADD, MDIO_MIIMCON, MDIO_MIIMSTAT) which start at the 0x520 offset. So shift the DT-defined register map by the offset of MDIO_MIIMCFG when mapping the MDIO bus registers. Signed-off-by: Vladimir Oltean Reviewed-by: Bin Meng --- Changes from v1: None. drivers/net/tsec.c | 13 +++++++------ include/tsec.h | 4 +++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index 53eb5470f4c8..576398676af7 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -801,6 +801,7 @@ int tsec_probe(struct udevice *dev) u32 tbiaddr = CONFIG_SYS_TBIPA_VALUE; ofnode parent; const char *phy_mode; + fdt_addr_t reg; int ret; pdata->iobase = (phys_addr_t)dev_read_addr(dev); @@ -817,15 +818,15 @@ int tsec_probe(struct udevice *dev) } parent = ofnode_get_parent(phandle_args.node); - if (ofnode_valid(parent)) { - int reg = ofnode_get_addr_index(parent, 0); - - priv->phyregs_sgmii = (struct tsec_mii_mng *)reg; - } else { - debug("No parent node for PHY?\n"); + if (!ofnode_valid(parent)) { + printf("No parent node for PHY?\n"); return -ENOENT; } + reg = ofnode_get_addr_index(parent, 0); + priv->phyregs_sgmii = (struct tsec_mii_mng *) + (reg + TSEC_MDIO_REGS_OFFSET); + ret = dev_read_phandle_with_args(dev, "tbi-handle", NULL, 0, 0, &phandle_args); if (ret == 0) diff --git a/include/tsec.h b/include/tsec.h index e90095121bdd..b17fa957df5b 100644 --- a/include/tsec.h +++ b/include/tsec.h @@ -17,6 +17,8 @@ #include #include +#define TSEC_MDIO_REGS_OFFSET 0x520 + #ifndef CONFIG_DM_ETH #ifdef CONFIG_ARCH_LS1021A @@ -27,7 +29,7 @@ #define TSEC_MDIO_OFFSET 0x01000 #endif -#define CONFIG_SYS_MDIO_BASE_ADDR (MDIO_BASE_ADDR + 0x520) +#define CONFIG_SYS_MDIO_BASE_ADDR (MDIO_BASE_ADDR + TSEC_MDIO_REGS_OFFSET) #define TSEC_GET_REGS(num, offset) \ (struct tsec __iomem *)\ From patchwork Sun Jul 14 00:16:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1131669 X-Patchwork-Delegate: joe.hershberger@gmail.com 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="WARWcDQs"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45mS5f1G7mz9sMQ for ; Sun, 14 Jul 2019 10:21:57 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id AA238C21DE8; Sun, 14 Jul 2019 00:20:22 +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=FREEMAIL_FROM, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID 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 45980C21E02; Sun, 14 Jul 2019 00:19:59 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 02E37C21DA6; Sun, 14 Jul 2019 00:19:56 +0000 (UTC) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by lists.denx.de (Postfix) with ESMTPS id 7C87DC21DA6 for ; Sun, 14 Jul 2019 00:19:53 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id v19so11892689wmj.5 for ; Sat, 13 Jul 2019 17:19:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+PVKUrjv/fP0UbTMwX/8iyVo3jzakgmJ5VKzwuFlJu0=; b=WARWcDQshgbE5dyUYcxxJxzO2IeSp+7p3tOlDLoq8QbEeHLAOkx3XSw7uSEQM1L3uE NQbKHBpXlocIm5PYU2EmcG0ZIT0dPHdKyVfge9x34yV2VLsorrY9etL/E0T5WoRYgsHr 5GZGfNuqKzbY+4jKOIfjKJmhuwpJVZeP4VZlxEP4PC0VMp7lJ0dzMARhVABhQkN8CSRC vf9BruIrG6d3rkqwNrEzn+9wJy8N5cc1qXCsn8nUM3ysuHex83wdzFHvdo1ssvoEIzfW 6tkcmVMI8Iaz1SeDk5LEDV0r5qb6KbRt+ORgxrvJvXHcIncSXMQQKG1Kk1LULIvcK5UP DoPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+PVKUrjv/fP0UbTMwX/8iyVo3jzakgmJ5VKzwuFlJu0=; b=M6YZpEq0PbbSibZRsTN0Nz+gchS8/82qVhNzDlrdAblbRyAvS4vp5rWJ0FGVNGwCGp xm4F4w2IGVR9KtCNOTDn7N6ljkz3lr0vHTojMLFfUqjZv3qLWJsAenAh3vOZzSsVjGCe PBxk1NoM/tMV5gqWsIMy4SUm5M8F/9e7Dy6lAn7C6tllo/rwCSfeQwYJpIFC9WzSYL8/ /XtLWUCARtIivOhDtnjR7KyjaQyPrIDsLQPzZD9UHAT49/K7IdGjLjiRhQQBFGFdIelT cgWuEwZQ/ehPs7vB3ZlnuZ54ne/9erCuq13Y2Zdhq2Ml57n4E5a24vcwFgUzq8zt1GTf 06QQ== X-Gm-Message-State: APjAAAVIrwK7/5APes6j5oBuGdQxve8CiF5FLcObmqwOy1LGirYTWKB3 9qQX96JhgWcXyF2zaPGZL8o= X-Google-Smtp-Source: APXvYqzUHmCXPGUgPVJWyCRHvWHnaHD8hPV+03p1pkXyKBLyT0PwfBNDc/6wmgvGCv9xUa/mleFUdA== X-Received: by 2002:a1c:cf0b:: with SMTP id f11mr16601377wmg.138.1563063593096; Sat, 13 Jul 2019 17:19:53 -0700 (PDT) Received: from localhost.localdomain ([188.26.252.192]) by smtp.gmail.com with ESMTPSA id m24sm7801973wmi.39.2019.07.13.17.19.52 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 13 Jul 2019 17:19:52 -0700 (PDT) From: Vladimir Oltean To: joe.hershberger@ni.com, prabhakar.kushwaha@nxp.com, bmeng.cn@gmail.com, u-boot@lists.denx.de Date: Sun, 14 Jul 2019 03:16:55 +0300 Message-Id: <20190714001701.2781-4-olteanv@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190714001701.2781-1-olteanv@gmail.com> References: <20190714001701.2781-1-olteanv@gmail.com> Subject: [U-Boot] [PATCH v2 3/9] net: tsec: Reverse Christmas tree notation 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" This is a cosmetic patch that reorders variable definitions in the inverse order of their line length, where possible. Signed-off-by: Vladimir Oltean Acked-by: Joe Hershberger Reviewed-by: Bin Meng --- Changes from v1: None. drivers/net/tsec.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index 576398676af7..ce19ff9228fd 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -259,8 +259,8 @@ static int tsec_send(struct udevice *dev, void *packet, int length) { struct tsec_private *priv = (struct tsec_private *)dev->priv; struct tsec __iomem *regs = priv->regs; - u16 status; int result = 0; + u16 status; int i; /* Find an empty buffer descriptor */ @@ -708,9 +708,9 @@ static int init_phy(struct tsec_private *priv) */ static int tsec_initialize(bd_t *bis, struct tsec_info_struct *tsec_info) { + struct tsec_private *priv; struct eth_device *dev; int i; - struct tsec_private *priv; dev = (struct eth_device *)malloc(sizeof(*dev)); @@ -794,14 +794,14 @@ int tsec_standard_init(bd_t *bis) #else /* CONFIG_DM_ETH */ int tsec_probe(struct udevice *dev) { - struct tsec_private *priv = dev_get_priv(dev); struct eth_pdata *pdata = dev_get_platdata(dev); - struct fsl_pq_mdio_info mdio_info; + struct tsec_private *priv = dev_get_priv(dev); struct ofnode_phandle_args phandle_args; u32 tbiaddr = CONFIG_SYS_TBIPA_VALUE; - ofnode parent; + struct fsl_pq_mdio_info mdio_info; const char *phy_mode; fdt_addr_t reg; + ofnode parent; int ret; pdata->iobase = (phys_addr_t)dev_read_addr(dev); From patchwork Sun Jul 14 00:16:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1131673 X-Patchwork-Delegate: joe.hershberger@gmail.com 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Rv9nJPao"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45mS7c5tRwz9sMQ for ; Sun, 14 Jul 2019 10:23:40 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 842BDC21D56; Sun, 14 Jul 2019 00:21:15 +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=FREEMAIL_FROM, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID 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 D1625C21E39; Sun, 14 Jul 2019 00:20:08 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 341C3C21DB6; Sun, 14 Jul 2019 00:19:57 +0000 (UTC) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by lists.denx.de (Postfix) with ESMTPS id 5ABA6C21DDC for ; Sun, 14 Jul 2019 00:19:54 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id f9so13382213wre.12 for ; Sat, 13 Jul 2019 17:19:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EQ2MrWHFxO8hqbiqLV3mqVnMZcO286TeHwx36+rlE2I=; b=Rv9nJPao8Rl079bY0o4L+z6nZE6WFNDB+XYQLTDhfhG9M44JhyffcCQEcb5ZSwGj6P /K424Lxd15R+F9+v6cdyrh9wJkmblZpMkmxzsMNYwQf9oND0ZJhpTQds1wHPT2Y297ks nr6zSXNV+CkcgzvzZIRT8Hy3xvjw4zbpB3ut8jMR15CoTz7WaHgh5kiyTelxb0aNHBtb bY93SzF2XEZuXwBiZVu6ILeWyBO6LBKHuCKEn6MOiFqP+bTQMhC2ACXkxbJSF835SSgS kZeFI0n3DncqzVxVOgq7ZeEsfLU4SpJdcZQq2PmBxReAMYvcC5NCB+Q1y6cFmsPnZUgn 2flw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EQ2MrWHFxO8hqbiqLV3mqVnMZcO286TeHwx36+rlE2I=; b=jpoL3j+W49FVwDYSStnjubwW160O8vcHywwdcZoJCeEJqyVfRKrHQT1YFyZ4mlpDx3 sRlyDZPM8kQV/FadUQZSYhMXkzKjz+wPiH/qu+9nrdYXkb3nNLPbcSvkz8OY+/CT6/jC hxIi0p3pGkDNv0iWdGXigyK125PkZDAKcdDKU4K9GD51Pt1RmTr4ecZKEKyyXkNPehbN 39ZghgVIRsYHACKnFBCHzR6KyWIpxXJrfrKyS4Lo/weST+zWQm8eycuCFRAcWWz2Tkxz rYOAVw9wFiXtIgnCCyiHXD9loFhfWf1vGA/w22dOTDX+Tds7hVnFKIGPVK1FP36I9wmO 8mag== X-Gm-Message-State: APjAAAV3otEksKjao0vDdHOKyTeYr93uE7/5VcPq9O4SGteT02WkUdaH ESbxMvNTTzynlV8x3yPLdD8= X-Google-Smtp-Source: APXvYqwHcpB9dFnZhDj5pctZHdBkFhjqOr39FVbGh6eRfRLroMxm8LkSaBkCUM/TkgX2gWLHJYWQOA== X-Received: by 2002:a5d:428c:: with SMTP id k12mr20078795wrq.81.1563063593988; Sat, 13 Jul 2019 17:19:53 -0700 (PDT) Received: from localhost.localdomain ([188.26.252.192]) by smtp.gmail.com with ESMTPSA id m24sm7801973wmi.39.2019.07.13.17.19.53 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 13 Jul 2019 17:19:53 -0700 (PDT) From: Vladimir Oltean To: joe.hershberger@ni.com, prabhakar.kushwaha@nxp.com, bmeng.cn@gmail.com, u-boot@lists.denx.de Date: Sun, 14 Jul 2019 03:16:56 +0300 Message-Id: <20190714001701.2781-5-olteanv@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190714001701.2781-1-olteanv@gmail.com> References: <20190714001701.2781-1-olteanv@gmail.com> Subject: [U-Boot] [PATCH v2 4/9] net: tsec: Make errors visible 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" This replaces debug() calls with printf() so that it is immediately obvious from the console that something is wrong. Signed-off-by: Vladimir Oltean Acked-by: Joe Hershberger Reviewed-by: Bin Meng --- Changes from v1: None. drivers/net/tsec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index ce19ff9228fd..1e20fe4cd246 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -268,7 +268,7 @@ static int tsec_send(struct udevice *dev, void *packet, int length) in_be16(&priv->txbd[priv->tx_idx].status) & TXBD_READY; i++) { if (i >= TOUT_LOOP) { - debug("%s: tsec: tx buffers full\n", dev->name); + printf("%s: tsec: tx buffers full\n", dev->name); return result; } } @@ -287,7 +287,7 @@ static int tsec_send(struct udevice *dev, void *packet, int length) in_be16(&priv->txbd[priv->tx_idx].status) & TXBD_READY; i++) { if (i >= TOUT_LOOP) { - debug("%s: tsec: tx error\n", dev->name); + printf("%s: tsec: tx error\n", dev->name); return result; } } @@ -809,7 +809,7 @@ int tsec_probe(struct udevice *dev) if (dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0, &phandle_args)) { - debug("phy-handle does not exist under tsec %s\n", dev->name); + printf("phy-handle does not exist under tsec %s\n", dev->name); return -ENOENT; } else { int reg = ofnode_read_u32_default(phandle_args.node, "reg", 0); @@ -838,7 +838,7 @@ int tsec_probe(struct udevice *dev) if (phy_mode) pdata->phy_interface = phy_get_interface_by_name(phy_mode); if (pdata->phy_interface == -1) { - debug("Invalid PHY interface '%s'\n", phy_mode); + printf("Invalid PHY interface '%s'\n", phy_mode); return -EINVAL; } priv->interface = pdata->phy_interface; From patchwork Sun Jul 14 00:16:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1131675 X-Patchwork-Delegate: joe.hershberger@gmail.com 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="c9SebeAj"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45mS8l0VZGz9sDQ for ; Sun, 14 Jul 2019 10:24:38 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id AAF53C21E08; Sun, 14 Jul 2019 00:21:02 +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=FREEMAIL_FROM, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID 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 58821C21DA1; Sun, 14 Jul 2019 00:20:05 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 376EFC21DD4; Sun, 14 Jul 2019 00:19:58 +0000 (UTC) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by lists.denx.de (Postfix) with ESMTPS id 23901C21C50 for ; Sun, 14 Jul 2019 00:19:55 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id v15so11893723wml.0 for ; Sat, 13 Jul 2019 17:19:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xHl0j8ZwNq2/zTXkp/K2agS8DKyWZiD0m43JDav64DY=; b=c9SebeAj1H6ks25SKgIbxQFfS92mX2SF1Tp0rT0LMyAC5uaLBSrH/h69RpKtuPFO7p VGQ/QjEpEITm92hJhkdKS7BqOtK+SV0vzcA50pXO5OnNnd/6aXPuVWs81fo8y8/q0ugH T902diigUlGMjJ8s2AyUOMLZLAZYRZTGFo9/mCbIPhIPSa92fR1Bmin2C/h/2DLAnnkL +/XQPAVdJPMq+ngLD9P+FTdaxpeaJGL5tZAr9UPS6gYMCVeRGfXqfmrEHLpdJAHIsc38 sSIoeYUJinrxWoxwGhGHnLzNdi/clErkXDip/XpJoYX8KMKIVxD66v6lxqIUwpeekfnI MuHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xHl0j8ZwNq2/zTXkp/K2agS8DKyWZiD0m43JDav64DY=; b=ksh1gFuy/TbaeNVuVvoodrSEMTluj0zph69ZSAzwTAMgIEHTRUvMwN4gdWamMhaQdj wOnflIamPRmeFRV7W4PTXhO9+voiVgTy2y3cYVB1U2IZNcrp21/U6aAdJ/MjMs0VkSLf FmEQnQfsuRCyY8n0mHXRISEGVVONppPLYgUREfK/poUf/0vNq4hmH5y0wkbhT37SPd0F FiJlDpcneK13TFMKAnQ4X0Bu2KGSvOpKqbT5bg2V/m/YRB0lv8QYwfTTXCAEdiosw7WJ R+Kdb3z7pmUr6twowBIQGnykOpiPhdAzh9QSBugYDJ+ugaQC9E3jASwqoRh61XbM7+4p CvVw== X-Gm-Message-State: APjAAAWMsT+2VkcEBz6Ts22N8yL6AE3xUyyfDlAOSIEbcXSajI/azdLO CQUu0WTK1m7AX7GWub4Z85M= X-Google-Smtp-Source: APXvYqxnZ5AYaxe/DtZGPrEyf0CXOvRmPhFXC3smoVR7DnnvpT4Kz9qYCyvnsQ4OXK0CgniI3BMiig== X-Received: by 2002:a1c:c706:: with SMTP id x6mr15732562wmf.162.1563063594778; Sat, 13 Jul 2019 17:19:54 -0700 (PDT) Received: from localhost.localdomain ([188.26.252.192]) by smtp.gmail.com with ESMTPSA id m24sm7801973wmi.39.2019.07.13.17.19.54 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 13 Jul 2019 17:19:54 -0700 (PDT) From: Vladimir Oltean To: joe.hershberger@ni.com, prabhakar.kushwaha@nxp.com, bmeng.cn@gmail.com, u-boot@lists.denx.de Date: Sun, 14 Jul 2019 03:16:57 +0300 Message-Id: <20190714001701.2781-6-olteanv@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190714001701.2781-1-olteanv@gmail.com> References: <20190714001701.2781-1-olteanv@gmail.com> Subject: [U-Boot] [PATCH v2 5/9] net: tsec: Common handling of MAC station address for DM_ETH 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" In tsec_init, the MAC address is retrieved from 2 different structures depending on whether DM_ETH is enabled or not. But since the field name is the same inside both structures, we can conditionally define the structure of the correct type and simplify the assignments. Signed-off-by: Vladimir Oltean Acked-by: Joe Hershberger Reviewed-by: Bin Meng --- Changes from v1: None. drivers/net/tsec.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index 1e20fe4cd246..f6278817330d 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -560,6 +560,8 @@ static int tsec_init(struct udevice *dev) struct tsec_private *priv = (struct tsec_private *)dev->priv; #ifdef CONFIG_DM_ETH struct eth_pdata *pdata = dev_get_platdata(dev); +#else + struct eth_device *pdata = dev; #endif struct tsec __iomem *regs = priv->regs; u32 tempval; @@ -580,21 +582,12 @@ static int tsec_init(struct udevice *dev) * order (BE), MACnADDR1 is set to 0xCDAB7856 and * MACnADDR2 is set to 0x34120000. */ -#ifndef CONFIG_DM_ETH - tempval = (dev->enetaddr[5] << 24) | (dev->enetaddr[4] << 16) | - (dev->enetaddr[3] << 8) | dev->enetaddr[2]; -#else tempval = (pdata->enetaddr[5] << 24) | (pdata->enetaddr[4] << 16) | (pdata->enetaddr[3] << 8) | pdata->enetaddr[2]; -#endif out_be32(®s->macstnaddr1, tempval); -#ifndef CONFIG_DM_ETH - tempval = (dev->enetaddr[1] << 24) | (dev->enetaddr[0] << 16); -#else tempval = (pdata->enetaddr[1] << 24) | (pdata->enetaddr[0] << 16); -#endif out_be32(®s->macstnaddr2, tempval); From patchwork Sun Jul 14 00:16:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1131670 X-Patchwork-Delegate: joe.hershberger@gmail.com 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="kwWf24aN"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45mS5v2vg4z9sDQ for ; Sun, 14 Jul 2019 10:22:11 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id EC2ADC21DF3; Sun, 14 Jul 2019 00:20:49 +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=FREEMAIL_FROM, T_DKIM_INVALID 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 B8134C21D56; Sun, 14 Jul 2019 00:20:04 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 14797C21D83; Sun, 14 Jul 2019 00:19:59 +0000 (UTC) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by lists.denx.de (Postfix) with ESMTPS id 08937C21E12 for ; Sun, 14 Jul 2019 00:19:56 +0000 (UTC) Received: by mail-wm1-f66.google.com with SMTP id v19so11892714wmj.5 for ; Sat, 13 Jul 2019 17:19:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Yj3cqZlatGW01KY12GhNbaxvHrMMhyvmCoHnWJ+zBrI=; b=kwWf24aNBsgBLRBcVQ0JscRW8Gq8vPy6bXDSTnCgF3/mdx8sp1CstrbJd3eXNxhh4O 63oxBb1fA6NexdHrY+tCzuNtwlNEZwJv5jbu22POtB9/3NzGa9OjrhQlLxJN/WTvqKad gX9ITXojM19PQcxbMEBWuTwUxkHiPy3KIIJVh8V24WSoq65aPioRaysuO+PeGLLsFkI5 iIzLmUWOsIMfAcgLCpQ8bc1FLpfbdVwyg6LsQauuEj5TlldisaAYLfmbIOs7eYrjnnL6 82Iv4fM6/gnSqGTVG5Q8ebeBkUQil83AObuk46vbk2puWYmuguI86MoDSb3sdaF47ySP 38/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Yj3cqZlatGW01KY12GhNbaxvHrMMhyvmCoHnWJ+zBrI=; b=otELNDFkJDfzoouXs5xTWyingbS+TPKq88JN/f7rOOEyfAdIhB6NW1Q4uZ10GHTv8W 9vv8w2hEX5SHwrTP6W2582RuCsTV8VYWEW0hlPgR0tdv9gIarYmUvy0r/1Ux09t0sHVL gYcGc4wcS6QSP7UnZnsWH9nHU5y2hmWrapCUbk4VQ/URenGeVcGovV3g9C8EFWmh49TJ Bw8Ldb1Nq9kTX03DZ6fP8/awNLmyc+JBxezJqVg64NEVtIlHc8bEA3mVprYE8qC04LXf ltbppi54hNhoyaSyZl8KZU3gT7YN444eCrZkfe+8dMC/0siIBadnPEUhdxPAGPBBuQ5E RDzQ== X-Gm-Message-State: APjAAAWH52C3EUEBFRANqt8AfUU16G1ND0zWhP0R4OQWJj/9H7htlZRn 51yzS58BVIUDtoS+Eea0Zko= X-Google-Smtp-Source: APXvYqzOM848KPxx7hiAc4E3rqHWHdlPIGFYvJVI0OUgZ/A1Posf7OXm920otdm9IKT/oiCJteDEqA== X-Received: by 2002:a1c:345:: with SMTP id 66mr16276542wmd.8.1563063595571; Sat, 13 Jul 2019 17:19:55 -0700 (PDT) Received: from localhost.localdomain ([188.26.252.192]) by smtp.gmail.com with ESMTPSA id m24sm7801973wmi.39.2019.07.13.17.19.54 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 13 Jul 2019 17:19:55 -0700 (PDT) From: Vladimir Oltean To: joe.hershberger@ni.com, prabhakar.kushwaha@nxp.com, bmeng.cn@gmail.com, u-boot@lists.denx.de Date: Sun, 14 Jul 2019 03:16:58 +0300 Message-Id: <20190714001701.2781-7-olteanv@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190714001701.2781-1-olteanv@gmail.com> References: <20190714001701.2781-1-olteanv@gmail.com> Subject: [U-Boot] [PATCH v2 6/9] net: tsec: Change compatible strings to match Linux 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" In the case of the tsec network driver, so far there has been no mainline user of DM_ETH where the DT bindings get used. In the case of the mdio bus, it looks like the "fsl,tsec-mdio" string was made up for the documentation, but there is no mainline code that parses the "compatible" property anyway. In both cases, there are no DT blobs that contain the old strings. So change the documentation to "fsl,etsec2" for the Ethernet ports and "fsl,etsec2-mdio" for the MDIO buses, which are strings that Linux also uses, at least for LS1021A. More compatible strings can be added once other (PowerPC) SoCs are migrated to DM_ETH. The current ls1021a.dtsi doesn't match what was documented for the MDIO buses anyway (the "compatible" is "gianfar" currently). This will be fixed in the next patch. Fixes: 69a00875e3db ("doc: dt-bindings: Describe Freescale TSEC ethernet controller") Signed-off-by: Vladimir Oltean Reviewed-by: Bin Meng --- Changes from v1: Patch is new. doc/device-tree-bindings/net/fsl-tsec-phy.txt | 4 ++-- drivers/net/tsec.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/device-tree-bindings/net/fsl-tsec-phy.txt b/doc/device-tree-bindings/net/fsl-tsec-phy.txt index c5bf48c3cb51..59989e3b09d6 100644 --- a/doc/device-tree-bindings/net/fsl-tsec-phy.txt +++ b/doc/device-tree-bindings/net/fsl-tsec-phy.txt @@ -28,13 +28,13 @@ device that exists on this bus, a PHY node should be created. Required properties: - compatible : Should define the compatible device type for the - mdio. Currently supported string/device is "fsl,tsec-mdio". + mdio. Currently supported string/device is "fsl,etsec2-mdio". - reg : Offset and length of the register set for the device Example: mdio@24520 { - compatible = "fsl,tsec-mdio"; + compatible = "fsl,etsec2-mdio"; reg = <0x24520 0x20>; ethernet-phy@0 { diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index f6278817330d..f85cdcb97ebf 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -880,7 +880,7 @@ static const struct eth_ops tsec_ops = { }; static const struct udevice_id tsec_ids[] = { - { .compatible = "fsl,tsec" }, + { .compatible = "fsl,etsec2" }, { } }; From patchwork Sun Jul 14 00:16:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1131672 X-Patchwork-Delegate: prabhakar@freescale.com 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="N6tziP3o"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45mS7b3LMSz9sDQ for ; Sun, 14 Jul 2019 10:23:39 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 36838C21DB3; Sun, 14 Jul 2019 00:21:41 +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=FREEMAIL_FROM, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID 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 09DB4C21DD4; Sun, 14 Jul 2019 00:20:12 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id F1E53C21DF8; Sun, 14 Jul 2019 00:20:00 +0000 (UTC) Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by lists.denx.de (Postfix) with ESMTPS id E6D19C21D8E for ; Sun, 14 Jul 2019 00:19:56 +0000 (UTC) Received: by mail-wm1-f68.google.com with SMTP id v15so11893745wml.0 for ; Sat, 13 Jul 2019 17:19:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=X248sfdv4mLIDaOnyGLWM07hEH46VcP6Zx9bnH5A1rU=; b=N6tziP3oQtgn6rB2sWUA3u69ClNsPsOscT281gXqi8gKRRCFd3uLLxw82tGXfwRqps XSR3l/wDSJQTZtXdj3AZ+sdG9HMFYLQDbvQiZ8DA9kZ7kqJgMSaePMpj0NzQufZoeUEH wYf8WZ8lhwdD6AO6DXvJ4m4DRJIb83BYt7P55N8tuqWUe3LihX/m6X9cl2WZOUXwm/SM 1LsOaqMNLaApsVIwQFrVIMHJIUMaYcIVH7nBdRaJZDxdm3jyTFCKET3wetZZBtNBFFzg RdH10T7P0dKl8uDRqEvmLgmfjIC4Pyg0ZWVcdmzeH4Wonlh8AAtcZAhOJQePNIgUsuPM UIIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=X248sfdv4mLIDaOnyGLWM07hEH46VcP6Zx9bnH5A1rU=; b=rQp+TbM7yRV1J0RuUPjLjiGMRYb0vvtBjEtmo2qVwZmeSsrE7C8HoJuUJLJXXzVjW6 k+hPZaNUOAjgYDe+3zF1+omyjgQ818GALLCUeZQOtXXQLPofBMxPhz4JWUHXywDq+8Ex 0UOXGD3v1sh6JM53hbd8r1MfpsE7jVys9HyVJugq1b6szL00J/8ros9Lj6IU916NWHkM pzzv7ZadiezOZzHtq2od1PLI4gjl725/6OPj42l/fZLLi5SVdRXEWMRTv2bRvqG+uheP mAxF90wU4bzIF9+CYCuRUJSF8awQM5JdGnhy992QeT0DzsYG9rGBvOh9j9THxnpc9X6g ckbQ== X-Gm-Message-State: APjAAAUyN2Apgul3jxj2v4OkHFhmV2XQGT8q4SQ+UmsIz4PxyDgo/UqM lDhm9qRAmNdbTVlY5fOmB3g= X-Google-Smtp-Source: APXvYqwOiea4JIUfl5aZf5jmcQ/i2iUPweQrLlUdcBrkCd4hKfM0SSl7Yc++e0PlQm2J/61aROsCag== X-Received: by 2002:a7b:c215:: with SMTP id x21mr16099806wmi.38.1563063596466; Sat, 13 Jul 2019 17:19:56 -0700 (PDT) Received: from localhost.localdomain ([188.26.252.192]) by smtp.gmail.com with ESMTPSA id m24sm7801973wmi.39.2019.07.13.17.19.55 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 13 Jul 2019 17:19:56 -0700 (PDT) From: Vladimir Oltean To: joe.hershberger@ni.com, prabhakar.kushwaha@nxp.com, bmeng.cn@gmail.com, u-boot@lists.denx.de Date: Sun, 14 Jul 2019 03:16:59 +0300 Message-Id: <20190714001701.2781-8-olteanv@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190714001701.2781-1-olteanv@gmail.com> References: <20190714001701.2781-1-olteanv@gmail.com> Subject: [U-Boot] [PATCH v2 7/9] arm: ls1021atwr: Convert to use driver model TSEC driver 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: Bin Meng Now that we have added driver model support to the TSEC driver, convert ls1021atwr board to use it. This depends on previous DM series for ls1021atwr: http://patchwork.ozlabs.org/patch/561855/ Signed-off-by: Bin Meng Signed-off-by: Vladimir Oltean [Vladimir] Made the following changes: - Added 'status = "disabled";' for all Ethernet ports in ls1021a.dtsi - Fixed the confusion between the SGMII/TBI PCS for enet0 and enet1 - a mistake ported over from Linux. Each SGMII PCS lies on the private MDIO bus of the interface (and the RGMII enet2 has no SGMII PCS). - Added CONFIG_DM_ETH to all ls1021atwr_* defconfigs - Completely removed non-DM_ETH support from ls1021atwr - Changed "compatible" string from "fsl,tsec-mdio" to "fsl,etsec2-mdio" and from "fsl,tsec" to "fsl,etsec2" to match Linux --- Changes from v1: Applied non-reverse #ifdef logic where possible. Removed the non-DM_ETH code from board/freescale/ls1021atwr/ and include/configs/ls1021atwr.h. Aligned compatible strings to Linux. arch/arm/cpu/armv7/ls102xa/cpu.c | 2 +- arch/arm/cpu/armv7/ls102xa/fdt.c | 10 +++++ arch/arm/dts/ls1021a-twr.dtsi | 32 ++++++++++++++++ arch/arm/dts/ls1021a.dtsi | 30 +++++++++++++-- board/freescale/ls1021atwr/ls1021atwr.c | 38 ------------------- configs/ls1021atwr_nor_SECURE_BOOT_defconfig | 2 + configs/ls1021atwr_nor_defconfig | 2 + configs/ls1021atwr_nor_lpuart_defconfig | 2 + configs/ls1021atwr_qspi_defconfig | 2 + ...s1021atwr_sdcard_ifc_SECURE_BOOT_defconfig | 2 + configs/ls1021atwr_sdcard_ifc_defconfig | 2 + configs/ls1021atwr_sdcard_qspi_defconfig | 2 + include/configs/ls1021atwr.h | 28 +------------- 13 files changed, 85 insertions(+), 69 deletions(-) diff --git a/arch/arm/cpu/armv7/ls102xa/cpu.c b/arch/arm/cpu/armv7/ls102xa/cpu.c index ecf9e869855e..9ccfe1042ce5 100644 --- a/arch/arm/cpu/armv7/ls102xa/cpu.c +++ b/arch/arm/cpu/armv7/ls102xa/cpu.c @@ -296,7 +296,7 @@ int cpu_mmc_init(bd_t *bis) int cpu_eth_init(bd_t *bis) { -#ifdef CONFIG_TSEC_ENET +#if defined(CONFIG_TSEC_ENET) && !defined(CONFIG_DM_ETH) tsec_standard_init(bis); #endif diff --git a/arch/arm/cpu/armv7/ls102xa/fdt.c b/arch/arm/cpu/armv7/ls102xa/fdt.c index 8bf9c42b2260..1aadffff5991 100644 --- a/arch/arm/cpu/armv7/ls102xa/fdt.c +++ b/arch/arm/cpu/armv7/ls102xa/fdt.c @@ -16,12 +16,17 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; void ft_fixup_enet_phy_connect_type(void *fdt) { +#ifdef CONFIG_DM_ETH + struct udevice *dev; +#else struct eth_device *dev; +#endif struct tsec_private *priv; const char *enet_path, *phy_path; char enet[16]; @@ -29,7 +34,12 @@ void ft_fixup_enet_phy_connect_type(void *fdt) int phy_node; int i = 0; uint32_t ph; +#ifdef CONFIG_DM_ETH + char *name[3] = { "ethernet@2d10000", "ethernet@2d50000", + "ethernet@2d90000" }; +#else char *name[3] = { "eTSEC1", "eTSEC2", "eTSEC3" }; +#endif for (; i < ARRAY_SIZE(name); i++) { dev = eth_get_dev_by_name(name[i]); diff --git a/arch/arm/dts/ls1021a-twr.dtsi b/arch/arm/dts/ls1021a-twr.dtsi index 5d3275ced913..27c96f95400a 100644 --- a/arch/arm/dts/ls1021a-twr.dtsi +++ b/arch/arm/dts/ls1021a-twr.dtsi @@ -51,6 +51,26 @@ }; }; +&enet0 { + tbi-handle = <&tbi0>; + phy-handle = <&sgmii_phy2>; + phy-connection-type = "sgmii"; + status = "okay"; +}; + +&enet1 { + tbi-handle = <&tbi1>; + phy-handle = <&sgmii_phy0>; + phy-connection-type = "sgmii"; + status = "okay"; +}; + +&enet2 { + phy-handle = <&rgmii_phy1>; + phy-connection-type = "rgmii-id"; + status = "okay"; +}; + &i2c0 { status = "okay"; }; @@ -84,12 +104,24 @@ sgmii_phy0: ethernet-phy@0 { reg = <0x0>; }; + rgmii_phy1: ethernet-phy@1 { reg = <0x1>; }; + sgmii_phy2: ethernet-phy@2 { reg = <0x2>; }; + + /* SGMII PCS for enet0 */ + tbi0: tbi-phy@1f { + reg = <0x1f>; + device_type = "tbi-phy"; + }; +}; + +&mdio1 { + /* SGMII PCS for enet1 */ tbi1: tbi-phy@1f { reg = <0x1f>; device_type = "tbi-phy"; diff --git a/arch/arm/dts/ls1021a.dtsi b/arch/arm/dts/ls1021a.dtsi index 7fb24ab68787..e419d9c44fcb 100644 --- a/arch/arm/dts/ls1021a.dtsi +++ b/arch/arm/dts/ls1021a.dtsi @@ -350,12 +350,36 @@ <&platform_clk 1>; }; + enet0: ethernet@2d10000 { + compatible = "fsl,etsec2"; + reg = <0x2d10000 0x1000>; + status = "disabled"; + }; + + enet1: ethernet@2d50000 { + compatible = "fsl,etsec2"; + reg = <0x2d50000 0x1000>; + status = "disabled"; + }; + + enet2: ethernet@2d90000 { + compatible = "fsl,etsec2"; + reg = <0x2d90000 0x1000>; + status = "disabled"; + }; + mdio0: mdio@2d24000 { - compatible = "gianfar"; - device_type = "mdio"; + compatible = "fsl,etsec2-mdio"; + reg = <0x2d24000 0x4000>; + #address-cells = <1>; + #size-cells = <0>; + }; + + mdio1: mdio@2d64000 { + compatible = "fsl,etsec2-mdio"; + reg = <0x2d64000 0x4000>; #address-cells = <1>; #size-cells = <0>; - reg = <0x2d24000 0x4000>; }; usb@8600000 { diff --git a/board/freescale/ls1021atwr/ls1021atwr.c b/board/freescale/ls1021atwr/ls1021atwr.c index 01ba1bc96213..fcf2ec97889d 100644 --- a/board/freescale/ls1021atwr/ls1021atwr.c +++ b/board/freescale/ls1021atwr/ls1021atwr.c @@ -248,44 +248,6 @@ int board_mmc_init(bd_t *bis) int board_eth_init(bd_t *bis) { -#ifdef CONFIG_TSEC_ENET - struct fsl_pq_mdio_info mdio_info; - struct tsec_info_struct tsec_info[4]; - int num = 0; - -#ifdef CONFIG_TSEC1 - SET_STD_TSEC_INFO(tsec_info[num], 1); - if (is_serdes_configured(SGMII_TSEC1)) { - puts("eTSEC1 is in sgmii mode.\n"); - tsec_info[num].flags |= TSEC_SGMII; - } - num++; -#endif -#ifdef CONFIG_TSEC2 - SET_STD_TSEC_INFO(tsec_info[num], 2); - if (is_serdes_configured(SGMII_TSEC2)) { - puts("eTSEC2 is in sgmii mode.\n"); - tsec_info[num].flags |= TSEC_SGMII; - } - num++; -#endif -#ifdef CONFIG_TSEC3 - SET_STD_TSEC_INFO(tsec_info[num], 3); - tsec_info[num].interface = PHY_INTERFACE_MODE_RGMII_ID; - num++; -#endif - if (!num) { - printf("No TSECs initialized\n"); - return 0; - } - - mdio_info.regs = (struct tsec_mii_mng *)CONFIG_SYS_MDIO_BASE_ADDR; - mdio_info.name = DEFAULT_MII_NAME; - fsl_pq_mdio_init(bis, &mdio_info); - - tsec_eth_init(bis, tsec_info, num); -#endif - return pci_eth_init(bis); } diff --git a/configs/ls1021atwr_nor_SECURE_BOOT_defconfig b/configs/ls1021atwr_nor_SECURE_BOOT_defconfig index 6c4bb9aaf665..830affc925b5 100644 --- a/configs/ls1021atwr_nor_SECURE_BOOT_defconfig +++ b/configs/ls1021atwr_nor_SECURE_BOOT_defconfig @@ -40,7 +40,9 @@ CONFIG_SYS_FLASH_CFI=y CONFIG_PHY_GIGE=y CONFIG_E1000=y CONFIG_MII=y +CONFIG_DM_ETH=y CONFIG_TSEC_ENET=y +CONFIG_PHY_ATHEROS=y CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_DM_PCI_COMPAT=y diff --git a/configs/ls1021atwr_nor_defconfig b/configs/ls1021atwr_nor_defconfig index 9d8c2024c04e..c4d18c6f6907 100644 --- a/configs/ls1021atwr_nor_defconfig +++ b/configs/ls1021atwr_nor_defconfig @@ -40,7 +40,9 @@ CONFIG_SYS_FLASH_CFI=y CONFIG_PHY_GIGE=y CONFIG_E1000=y CONFIG_MII=y +CONFIG_DM_ETH=y CONFIG_TSEC_ENET=y +CONFIG_PHY_ATHEROS=y CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_DM_PCI_COMPAT=y diff --git a/configs/ls1021atwr_nor_lpuart_defconfig b/configs/ls1021atwr_nor_lpuart_defconfig index b9cfdb6fd69e..b74d58a3487c 100644 --- a/configs/ls1021atwr_nor_lpuart_defconfig +++ b/configs/ls1021atwr_nor_lpuart_defconfig @@ -42,7 +42,9 @@ CONFIG_SYS_FLASH_CFI=y CONFIG_PHY_GIGE=y CONFIG_E1000=y CONFIG_MII=y +CONFIG_DM_ETH=y CONFIG_TSEC_ENET=y +CONFIG_PHY_ATHEROS=y CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_DM_PCI_COMPAT=y diff --git a/configs/ls1021atwr_qspi_defconfig b/configs/ls1021atwr_qspi_defconfig index 8c27c5908cb5..911061a37881 100644 --- a/configs/ls1021atwr_qspi_defconfig +++ b/configs/ls1021atwr_qspi_defconfig @@ -42,7 +42,9 @@ CONFIG_SPI_FLASH_STMICRO=y CONFIG_PHY_GIGE=y CONFIG_E1000=y CONFIG_MII=y +CONFIG_DM_ETH=y CONFIG_TSEC_ENET=y +CONFIG_PHY_ATHEROS=y CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_DM_PCI_COMPAT=y diff --git a/configs/ls1021atwr_sdcard_ifc_SECURE_BOOT_defconfig b/configs/ls1021atwr_sdcard_ifc_SECURE_BOOT_defconfig index 979878d560f4..d8c26393cead 100644 --- a/configs/ls1021atwr_sdcard_ifc_SECURE_BOOT_defconfig +++ b/configs/ls1021atwr_sdcard_ifc_SECURE_BOOT_defconfig @@ -53,7 +53,9 @@ CONFIG_SYS_FLASH_CFI=y CONFIG_PHY_GIGE=y CONFIG_E1000=y CONFIG_MII=y +CONFIG_DM_ETH=y CONFIG_TSEC_ENET=y +CONFIG_PHY_ATHEROS=y CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_DM_PCI_COMPAT=y diff --git a/configs/ls1021atwr_sdcard_ifc_defconfig b/configs/ls1021atwr_sdcard_ifc_defconfig index 59af172cb8a1..d23c87504c9b 100644 --- a/configs/ls1021atwr_sdcard_ifc_defconfig +++ b/configs/ls1021atwr_sdcard_ifc_defconfig @@ -54,7 +54,9 @@ CONFIG_SYS_FLASH_CFI=y CONFIG_PHY_GIGE=y CONFIG_E1000=y CONFIG_MII=y +CONFIG_DM_ETH=y CONFIG_TSEC_ENET=y +CONFIG_PHY_ATHEROS=y CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_DM_PCI_COMPAT=y diff --git a/configs/ls1021atwr_sdcard_qspi_defconfig b/configs/ls1021atwr_sdcard_qspi_defconfig index d7fec5e365eb..7b2c2900a060 100644 --- a/configs/ls1021atwr_sdcard_qspi_defconfig +++ b/configs/ls1021atwr_sdcard_qspi_defconfig @@ -53,7 +53,9 @@ CONFIG_SPI_FLASH_STMICRO=y CONFIG_PHY_GIGE=y CONFIG_E1000=y CONFIG_MII=y +CONFIG_DM_ETH=y CONFIG_TSEC_ENET=y +CONFIG_PHY_ATHEROS=y CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_DM_PCI_COMPAT=y diff --git a/include/configs/ls1021atwr.h b/include/configs/ls1021atwr.h index de0c9c7f26af..cbf7a496a564 100644 --- a/include/configs/ls1021atwr.h +++ b/include/configs/ls1021atwr.h @@ -260,33 +260,7 @@ */ #ifdef CONFIG_TSEC_ENET -#define CONFIG_MII_DEFAULT_TSEC 1 -#define CONFIG_TSEC1 1 -#define CONFIG_TSEC1_NAME "eTSEC1" -#define CONFIG_TSEC2 1 -#define CONFIG_TSEC2_NAME "eTSEC2" -#define CONFIG_TSEC3 1 -#define CONFIG_TSEC3_NAME "eTSEC3" - -#define TSEC1_PHY_ADDR 2 -#define TSEC2_PHY_ADDR 0 -#define TSEC3_PHY_ADDR 1 - -#define TSEC1_FLAGS (TSEC_GIGABIT | TSEC_REDUCED) -#define TSEC2_FLAGS (TSEC_GIGABIT | TSEC_REDUCED) -#define TSEC3_FLAGS (TSEC_GIGABIT | TSEC_REDUCED) - -#define TSEC1_PHYIDX 0 -#define TSEC2_PHYIDX 0 -#define TSEC3_PHYIDX 0 - -#define CONFIG_ETHPRIME "eTSEC1" - -#define CONFIG_PHY_ATHEROS - -#define CONFIG_HAS_ETH0 -#define CONFIG_HAS_ETH1 -#define CONFIG_HAS_ETH2 +#define CONFIG_ETHPRIME "ethernet@2d10000" #endif /* PCIe */ From patchwork Sun Jul 14 00:17:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1131671 X-Patchwork-Delegate: prabhakar@freescale.com 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="fWyBPkgY"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45mS6x2VPpz9sDQ for ; Sun, 14 Jul 2019 10:23:05 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id EDE2CC21DB3; Sun, 14 Jul 2019 00:21:27 +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=FREEMAIL_FROM, T_DKIM_INVALID 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 67F93C21E18; Sun, 14 Jul 2019 00:20:11 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6044AC21E31; Sun, 14 Jul 2019 00:20:01 +0000 (UTC) Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by lists.denx.de (Postfix) with ESMTPS id BAEEEC21E1D for ; Sun, 14 Jul 2019 00:19:57 +0000 (UTC) Received: by mail-wm1-f46.google.com with SMTP id 207so11885077wma.1 for ; Sat, 13 Jul 2019 17:19:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=A2YCQmaS/Grtpv8Sccuxde9pMmqNR8Gd7PmU6arw3xw=; b=fWyBPkgYVLCyuCTKYNvhqsdYfcrrSAcTf/4mwV+//3wsuSmLpW6JWy5RixiHDtIbrj GP9fgyzCCGJ6jJiDPKV6AIyyb9Rv9Gj5yOoxIWL+a9lL40T9jfZnoNs7dpA+KTKaVJWe bFEQTaX3UazkXqbWVrkJk0H6F5xYUS6m4Xpe5weeNxzQhEoczcxXjCjn6tATbsVQwDMY xNx/cbr+08zrO9lSFDI3xeZ7GPhwQ0rCi6DsS+dcN/KskzzxcPBgaWlC5CFt9d3X5yd+ zuEYIPv2qS38tTnLDMEgGHxYDPhn+BNc/BUeW+KVajzzQwiStYNkzPWPbSk/iYOizAV/ EpRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=A2YCQmaS/Grtpv8Sccuxde9pMmqNR8Gd7PmU6arw3xw=; b=egDJpjSYZyMQOsDXDXZkwGLROKzjh7J4NqujcPxmphVIkh1ciAAukGN9nx0xX+Wc+Y 9TvtiCxUAa4oArXSrHF7gLNfKvVIiUIhqIcoIo19857/F5Woq6G0ycsIql2FKzDVciJs 8G9Cr4EzAeEWCHQaKmLU5Mu4ctuojQju346u4XWgeu+I8X81vYeV0OR8AP+RfYPpWJ7/ rA4WSB+28CL8ZJLTBhkaNkJRWcaZNjyBcIZQY25/1YYl+SXa/fadqI4+4k0gPeDtlpgG 1A64lEFeYLCRuPM3hdY67E7CoZ7ewoY8wzubml81lI2cLE0LctRGnR+vmBqhTSRwaJxQ pltw== X-Gm-Message-State: APjAAAUUeSOBE1Q05/fuL2R0x39XDWpsfyOORUpaGdMJjadbSvOGYF1s vvXpLNDtlc7u++UDPkJdei6AMZ7W8DY= X-Google-Smtp-Source: APXvYqzFejL/tIg/jVIECUulTYYD1kABvUX7F9W461l/D0BC1TO/EvDfLFwmdmEJNr+y40YWFg7WWQ== X-Received: by 2002:a1c:f61a:: with SMTP id w26mr16903565wmc.75.1563063597369; Sat, 13 Jul 2019 17:19:57 -0700 (PDT) Received: from localhost.localdomain ([188.26.252.192]) by smtp.gmail.com with ESMTPSA id m24sm7801973wmi.39.2019.07.13.17.19.56 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 13 Jul 2019 17:19:56 -0700 (PDT) From: Vladimir Oltean To: joe.hershberger@ni.com, prabhakar.kushwaha@nxp.com, bmeng.cn@gmail.com, u-boot@lists.denx.de Date: Sun, 14 Jul 2019 03:17:00 +0300 Message-Id: <20190714001701.2781-9-olteanv@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190714001701.2781-1-olteanv@gmail.com> References: <20190714001701.2781-1-olteanv@gmail.com> Subject: [U-Boot] [PATCH v2 8/9] configs: ls1021atwr: Fix distro_bootcmd for QSPI boot 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" Due to a typo, "run qspi_bootcmd" and "env exists secureboot" got concatenated instead of being separated by a semicolon. Signed-off-by: Vladimir Oltean Reviewed-by: Bin Meng Reviewed-by: Joe Hershberger --- Changes from v1: None. include/configs/ls1021atwr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/configs/ls1021atwr.h b/include/configs/ls1021atwr.h index cbf7a496a564..31abee81edd2 100644 --- a/include/configs/ls1021atwr.h +++ b/include/configs/ls1021atwr.h @@ -418,7 +418,7 @@ #undef CONFIG_BOOTCOMMAND #if defined(CONFIG_QSPI_BOOT) || defined(CONFIG_SD_BOOT_QSPI) -#define CONFIG_BOOTCOMMAND "run distro_bootcmd; run qspi_bootcmd" \ +#define CONFIG_BOOTCOMMAND "run distro_bootcmd; run qspi_bootcmd; " \ "env exists secureboot && esbc_halt" #elif defined(CONFIG_SD_BOOT) #define CONFIG_BOOTCOMMAND "run distro_bootcmd; run sd_bootcmd; " \ From patchwork Sun Jul 14 00:17:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 1131674 X-Patchwork-Delegate: prabhakar@freescale.com 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="sU6XUpk3"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45mS871BK9z9sDQ for ; Sun, 14 Jul 2019 10:24:07 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id DB4A7C21CB6; Sun, 14 Jul 2019 00:22:04 +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=FREEMAIL_FROM, T_DKIM_INVALID 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 AB07BC21D4A; Sun, 14 Jul 2019 00:20:40 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2E2ECC21C51; Sun, 14 Jul 2019 00:20:03 +0000 (UTC) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by lists.denx.de (Postfix) with ESMTPS id 76055C21DED for ; Sun, 14 Jul 2019 00:19:59 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id v15so11893780wml.0 for ; Sat, 13 Jul 2019 17:19:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WY7aYRVeEbzn9wvSwtsoWe3LcYGAEfbG+91E9zY+ZKg=; b=sU6XUpk3GA+isxuW421zg6yNrSwckY25uzypQMefHsFBWVo78o9N7yjAfZqmbv1TO4 gqyoK7wjzbOQDajbGoZptcvxBv8snrtBJQLpLB6S0+fIyuoWn5VlBmHcXQQqog+Rp1F/ 21770VBWUulYRtqtGcXzG44B40xJByIlGob1dolt5f2vCnkt0sWTWc2D5nghV7/bTKZ1 8479Nfo/iyVXZOBqxhU8QkVMxSr7zvRbS0BIFIFNTIR7XiM9kiH0zc/DVc5HFvsq4GAm 6zuQstDyeSjMmznO56aF3SpEGKNILh9pRWYzsjCJu7iTRQzTZWU23I9au9Pea513HxlV JkDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WY7aYRVeEbzn9wvSwtsoWe3LcYGAEfbG+91E9zY+ZKg=; b=BWDts+Ld5qvCoPnetxkWaiM3gldwqd2ng88IS+Q3GZi2QakYsNKjoDKdzMIsMJKyzo 7KGpIN3cuwAbvdAYjLcCgL18phnZgYEyC/Z0yz9bQppmdMn2xJF7DebtehX1tvvlzbWa /kRIrL4yC62uzdC9i48qXzhe3MD5BAwXMS2MjLPbamYdi37M7brfwPESdia0S0OHUfIN 0/CDOtoEy8QhPFEwZ2k+iLPM8rfrVmOsRwHRrStbnP2fQBnVBLOTG3L3omruk96FH7la WOr8df79m/A/kNAqGN3l74P9geBoRL3KgejbHbCIlrS7O4bo8xWwCFv+SvwixIu7H961 Guww== X-Gm-Message-State: APjAAAVYR8RsJd48THubYpmRL2opxOFuqynxcZ6crvw3iNkcmEDeRtyZ 2vY5ayv9uKNc1oyk0D6/wnnrlUfHcMQ= X-Google-Smtp-Source: APXvYqzbsELjIwVMEkglEQnV1RRXWf1kb3rKt+O6EaU62hQzRBzbfsxptJFwMQtNsl/PDWO/Y7D9xQ== X-Received: by 2002:a7b:c251:: with SMTP id b17mr16490075wmj.143.1563063598503; Sat, 13 Jul 2019 17:19:58 -0700 (PDT) Received: from localhost.localdomain ([188.26.252.192]) by smtp.gmail.com with ESMTPSA id m24sm7801973wmi.39.2019.07.13.17.19.57 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 13 Jul 2019 17:19:58 -0700 (PDT) From: Vladimir Oltean To: joe.hershberger@ni.com, prabhakar.kushwaha@nxp.com, bmeng.cn@gmail.com, u-boot@lists.denx.de Date: Sun, 14 Jul 2019 03:17:01 +0300 Message-Id: <20190714001701.2781-10-olteanv@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190714001701.2781-1-olteanv@gmail.com> References: <20190714001701.2781-1-olteanv@gmail.com> Cc: Xiaoliang Yang , Jianchao Wang , Mingkai Hu Subject: [U-Boot] [PATCH v2 9/9] Add support for the NXP LS1021A-TSN board 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: Jianchao Wang The LS1021A-TSN is a development board built by VVDN/Argonboards in partnership with NXP. It features the LS1021A SoC and the first-generation SJA1105T Ethernet switch for prototyping implementations of a subset of IEEE 802.1 TSN standards. Supported boot media: microSD card (via SPL), QSPI flash. Rev. A of the board uses a Spansion S25FL512S_256K serial flash, which is 64 MB in size and has an erase sector size of 256KB (therefore, flashing the RCW would erase part of U-Boot). Rev. B and C of the board use a Spansion S25FL256S1 serial flash, which is only 32 MB in size but has an erase sector size of 64KB (therefore the RCW image can be flashed without erasing U-Boot). To avoid the problems above, the U-Boot base address has been selected at 0x100000 (the start of the 5th 256KB erase sector), which works for all board revisions. Actually 0x40000 would have been enough, but 0x100000 is common for all Layerscape devices. eTSEC3 is connecting directly to SJA1105 via an RGMII fixed-link, but SJA1105 is currently not supported by uboot. Therefore, eTSEC3 is disabled. Signed-off-by: Xiaoliang Yang Signed-off-by: Mingkai Hu Signed-off-by: Jianchao Wang Signed-off-by: Changming Huang Signed-off-by: Vladimir Oltean [Vladimir] Code taken from https://github.com/openil/u-boot (which itself is mostly copied from ls1021a-iot) and adapted with the following changes: - Add a008850 errata workaround - Converted eTSEC, MMC to DM to avoid all build warnings - Plugged in distro boot feature, including support for extlinux.conf - Added defconfig for QSPI boot - Added the board/freescale/ls1021atsn/README.rst for initial setup - Increased CONFIG_SYS_MONITOR_LEN so that the SPL malloc pool does not get overwritten during copying of the u-boot.bin payload from MMC to DDR. Reviewed-by: Bin Meng --- Changes from v1: Increased CONFIG_SYS_MONITOR_LEN so that the SPL malloc pool does not get overwritten during copying of the u-boot.bin payload from MMC to DDR. Completely removed all traces of IFC support (for CPLD control), which has no chance of working on this board. Made ddrmc_init a static function. arch/arm/Kconfig | 14 + arch/arm/dts/Makefile | 2 +- arch/arm/dts/ls1021a-tsn.dts | 77 +++++ board/freescale/ls1021atsn/Kconfig | 18 ++ board/freescale/ls1021atsn/MAINTAINERS | 8 + board/freescale/ls1021atsn/Makefile | 3 + board/freescale/ls1021atsn/README.rst | 97 ++++++ board/freescale/ls1021atsn/ls1021atsn.c | 259 ++++++++++++++++ board/freescale/ls1021atsn/ls102xa_pbi.cfg | 15 + board/freescale/ls1021atsn/ls102xa_rcw_sd.cfg | 8 + configs/ls1021atsn_qspi_defconfig | 77 +++++ configs/ls1021atsn_sdcard_defconfig | 86 ++++++ include/configs/ls1021atsn.h | 289 ++++++++++++++++++ 13 files changed, 952 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/ls1021a-tsn.dts create mode 100644 board/freescale/ls1021atsn/Kconfig create mode 100644 board/freescale/ls1021atsn/MAINTAINERS create mode 100644 board/freescale/ls1021atsn/Makefile create mode 100644 board/freescale/ls1021atsn/README.rst create mode 100644 board/freescale/ls1021atsn/ls1021atsn.c create mode 100644 board/freescale/ls1021atsn/ls102xa_pbi.cfg create mode 100644 board/freescale/ls1021atsn/ls102xa_rcw_sd.cfg create mode 100644 configs/ls1021atsn_qspi_defconfig create mode 100644 configs/ls1021atsn_sdcard_defconfig create mode 100644 include/configs/ls1021atsn.h diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 87541977259c..ee5b2af28500 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1337,6 +1337,19 @@ config TARGET_LS1021ATWR select SUPPORT_SPL imply SCSI +config TARGET_LS1021ATSN + bool "Support ls1021atsn" + select ARCH_LS1021A + select ARCH_SUPPORT_PSCI + select BOARD_EARLY_INIT_F + select BOARD_LATE_INIT + select CPU_V7A + select CPU_V7_HAS_NONSEC + select CPU_V7_HAS_VIRT + select LS1_DEEP_SLEEP + select SUPPORT_SPL + imply SCSI + config TARGET_LS1021AIOT bool "Support ls1021aiot" select ARCH_LS1021A @@ -1713,6 +1726,7 @@ source "board/freescale/ls1028a/Kconfig" source "board/freescale/ls1021aqds/Kconfig" source "board/freescale/ls1043aqds/Kconfig" source "board/freescale/ls1021atwr/Kconfig" +source "board/freescale/ls1021atsn/Kconfig" source "board/freescale/ls1021aiot/Kconfig" source "board/freescale/ls1046aqds/Kconfig" source "board/freescale/ls1043ardb/Kconfig" diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 20dbc2ff8480..bd63944c0819 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -326,7 +326,7 @@ dtb-$(CONFIG_TARGET_STV0991) += stv0991.dtb dtb-$(CONFIG_ARCH_LS1021A) += ls1021a-qds-duart.dtb \ ls1021a-qds-lpuart.dtb \ ls1021a-twr-duart.dtb ls1021a-twr-lpuart.dtb \ - ls1021a-iot-duart.dtb + ls1021a-iot-duart.dtb ls1021a-tsn.dtb dtb-$(CONFIG_FSL_LSCH3) += fsl-ls2080a-qds.dtb \ fsl-ls2080a-rdb.dtb \ fsl-ls2081a-rdb.dtb \ diff --git a/arch/arm/dts/ls1021a-tsn.dts b/arch/arm/dts/ls1021a-tsn.dts new file mode 100644 index 000000000000..f633074099dc --- /dev/null +++ b/arch/arm/dts/ls1021a-tsn.dts @@ -0,0 +1,77 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright 2016-2018 NXP Semiconductors + * Copyright 2019 Vladimir Oltean + */ + +/dts-v1/; +#include "ls1021a.dtsi" + +/ { + model = "NXP LS1021A-TSN Board"; + + aliases { + enet0-sgmii-phy = &sgmii_phy2; + enet1-sgmii-phy = &sgmii_phy1; + spi0 = &qspi; + spi1 = &dspi1; + }; +}; + +&enet0 { + tbi-handle = <&tbi0>; + phy-handle = <&sgmii_phy2>; + phy-mode = "sgmii"; + status = "okay"; +}; + +&enet1 { + tbi-handle = <&tbi1>; + phy-handle = <&sgmii_phy1>; + phy-mode = "sgmii"; + status = "okay"; +}; + +&i2c0 { + status = "okay"; +}; + +&mdio0 { + /* AR8031 */ + sgmii_phy1: ethernet-phy@1 { + reg = <0x1>; + }; + + /* AR8031 */ + sgmii_phy2: ethernet-phy@2 { + reg = <0x2>; + }; + + /* SGMII PCS for enet0 */ + tbi0: tbi-phy@1f { + reg = <0x1f>; + device_type = "tbi-phy"; + }; +}; + +&mdio1 { + /* SGMII PCS for enet1 */ + tbi1: tbi-phy@1f { + reg = <0x1f>; + device_type = "tbi-phy"; + }; +}; + +&qspi { + bus-num = <0>; + status = "okay"; + + flash@0 { + compatible = "spi-flash"; + spi-max-frequency = <20000000>; + reg = <0>; + }; +}; + +&uart0 { + status = "okay"; +}; diff --git a/board/freescale/ls1021atsn/Kconfig b/board/freescale/ls1021atsn/Kconfig new file mode 100644 index 000000000000..d999fa469002 --- /dev/null +++ b/board/freescale/ls1021atsn/Kconfig @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0 +if TARGET_LS1021ATSN + +config SYS_BOARD + default "ls1021atsn" + +config SYS_VENDOR + default "freescale" + +config SYS_SOC + default "ls102xa" + +config SYS_CONFIG_NAME + default "ls1021atsn" + +source "board/freescale/common/Kconfig" + +endif diff --git a/board/freescale/ls1021atsn/MAINTAINERS b/board/freescale/ls1021atsn/MAINTAINERS new file mode 100644 index 000000000000..560bb615d2fe --- /dev/null +++ b/board/freescale/ls1021atsn/MAINTAINERS @@ -0,0 +1,8 @@ +NXP LS1021A-TSN Board +M: Vladimir Oltean +S: Maintained +F: arch/arm/dts/ls1021a-tsn.dts +F: board/freescale/ls1021atsn/ +F: include/configs/ls1021atsn.h +F: configs/ls1021atsn_qspi_defconfig +F: configs/ls1021atsn_sdcard_defconfig diff --git a/board/freescale/ls1021atsn/Makefile b/board/freescale/ls1021atsn/Makefile new file mode 100644 index 000000000000..b4808f05e8e0 --- /dev/null +++ b/board/freescale/ls1021atsn/Makefile @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 +obj-y += ls1021atsn.o +obj-$(CONFIG_ARMV7_PSCI) += ../ls1021atwr/psci.o diff --git a/board/freescale/ls1021atsn/README.rst b/board/freescale/ls1021atsn/README.rst new file mode 100644 index 000000000000..cdec02f1a357 --- /dev/null +++ b/board/freescale/ls1021atsn/README.rst @@ -0,0 +1,97 @@ +.. SPDX-License-Identifier: GPL-2.0 + +LS1021A-TSN Board Overview +========================== + + - 1GB DDR3 at 800 MHz + - Spansion/Cypress 64 MB (Rev. A) / 32 MB (Rev. B and C) QSPI NOR flash + - Ethernet + - 2 SGMII 10/100/1G Ethernet ports (Atheros AR8031) + - One SJA1105T switch with 4 Ethernet ports (Broadcom BCM5464R) + - One internal RGMII port connected to the switch + - SDHC + - microSDHC/SDXC connector + - Other I/O + - One Serial port + - Arduino and expansion headers + - mPCIE slot + - SATA port + - USB3.0 port + +LS1021A Memory map +================== + +The addresses in brackets are physical addresses. + +============== ============== ============================== ======= +Start Address End Address Description Size +============== ============== ============================== ======= +0x00_0000_0000 0x00_000F_FFFF Secure Boot ROM 1MB +0x00_0100_0000 0x00_0FFF_FFFF CCSRBAR 240MB +0x00_1000_0000 0x00_1000_FFFF OCRAM0 64KB +0x00_1001_0000 0x00_1001_FFFF OCRAM1 64KB +0x00_2000_0000 0x00_20FF_FFFF DCSR 16MB +0x00_4000_0000 0x00_5FFF_FFFF QSPI 512MB +0x00_6000_0000 0x00_67FF_FFFF IFC - NOR Flash 128MB +0x00_8000_0000 0x00_FFFF_FFFF DRAM1 2GB +============== ============== ============================== ======= + +Compiling and flashing +====================== + +The LS1021A-TSN board comes along with a microSD card with OpenIL U-Boot that +can be used to update its internal QSPI flash (which is empty out of the +factory). + +To compile and flash an SD card image:: + + make ls1021atsn_sdcard_defconfig && make -j 8 && sudo cp u-boot-with-spl-pbl.bin /srv/tftpboot/ + => tftp 0x82000000 u-boot-with-spl-pbl.bin && mmc rescan && mmc erase 8 0x1100 && mmc write 0x82000000 8 0x1100 + +For the QSPI flash, first obtain the Reset Configuration Word binary for +bootimg from the QSPI flash from the rcw project +(https://source.codeaurora.org/external/qoriq/qoriq-components/rcw):: + + make -j 8 && sudo cp ls1021atsn/SSR_PNS_30/rcw_1200_qspiboot.bin.swapped /srv/tftpboot/ + +The above RCW binary takes care of swapping the QSPI AMBA memory, so that the +U-Boot binary does not need to be swapped when flashing it. + +To compile and flash a U-Boot image for QSPI:: + + make ls1021atsn_qspi_defconfig && make -j 8 && sudo cp u-boot.bin /srv/tftpboot/ + +Then optionally create a custom uboot-env.txt file (although the default +environment already supports distro boot) and convert it to binary format:: + + mkenvimage -s 2M -o /srv/tftpboot/uboot-env.bin uboot-env.txt + +To program the QSPI flash with the images:: + + => tftp 0x82000000 rcw_1200_qspiboot.bin.swapped && sf probe && sf erase 0x0 +${filesize} && sf write 0x82000000 0x0 ${filesize} + => tftp 0x82000000 u-boot.bin && sf probe && sf erase 0x100000 +${filesize} && sf write 0x82000000 0x100000 ${filesize} + => tftp 0x82000000 uboot-env.bin && sf probe && sf erase 0x400000 +${filesize} && sf write 0x82000000 0x400000 ${filesize} + +The boards contain an AT24 I2C EEPROM that is supposed to hold the MAC +addresses of the Ethernet interfaces, however the EEPROM comes blank out of +the factory, and the MAC addresses are printed on a label on the bottom of +the boards. + +To write the MAC addresses to the EEPROM, the following needs to be done once:: + + => mac id + => mac 0 00:1F:7B:xx:xx:xx + => mac 1 00:1F:7B:xx:xx:xx + => mac 2 00:1F:7B:xx:xx:xx + => mac save + +The switch ports do not have their own MAC address - they inherit it from the +master enet2 port. + +Known issues and limitations +============================ + +- The 4 SJA1105 switch ports are not functional in U-Boot for now. +- Since the IFC pins are multiplexed with QSPI on LS1021A, currently there is + no way to talk to the CPLD for e.g. running the "qixis_reset" command, or + turning the fan on, etc. diff --git a/board/freescale/ls1021atsn/ls1021atsn.c b/board/freescale/ls1021atsn/ls1021atsn.c new file mode 100644 index 000000000000..97fc97a54af8 --- /dev/null +++ b/board/freescale/ls1021atsn/ls1021atsn.c @@ -0,0 +1,259 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright 2016-2019 NXP Semiconductors + */ +#include +#include +#include +#include +#include +#include +#include "../common/sleep.h" +#include +#include +#include +#include +#include +#ifdef CONFIG_U_QE +#include +#endif + +DECLARE_GLOBAL_DATA_PTR; + +static void ddrmc_init(void) +{ +#if (!defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)) + struct ccsr_ddr *ddr = (struct ccsr_ddr *)CONFIG_SYS_FSL_DDR_ADDR; + u32 temp_sdram_cfg, tmp; + + out_be32(&ddr->sdram_cfg, DDR_SDRAM_CFG); + + out_be32(&ddr->cs0_bnds, DDR_CS0_BNDS); + out_be32(&ddr->cs0_config, DDR_CS0_CONFIG); + + out_be32(&ddr->timing_cfg_0, DDR_TIMING_CFG_0); + out_be32(&ddr->timing_cfg_1, DDR_TIMING_CFG_1); + out_be32(&ddr->timing_cfg_2, DDR_TIMING_CFG_2); + out_be32(&ddr->timing_cfg_3, DDR_TIMING_CFG_3); + out_be32(&ddr->timing_cfg_4, DDR_TIMING_CFG_4); + out_be32(&ddr->timing_cfg_5, DDR_TIMING_CFG_5); + +#ifdef CONFIG_DEEP_SLEEP + if (is_warm_boot()) { + out_be32(&ddr->sdram_cfg_2, + DDR_SDRAM_CFG_2 & ~SDRAM_CFG2_D_INIT); + out_be32(&ddr->init_addr, CONFIG_SYS_SDRAM_BASE); + out_be32(&ddr->init_ext_addr, (1 << 31)); + + /* DRAM VRef will not be trained */ + out_be32(&ddr->ddr_cdr2, + DDR_DDR_CDR2 & ~DDR_CDR2_VREF_TRAIN_EN); + } else +#endif + { + out_be32(&ddr->sdram_cfg_2, DDR_SDRAM_CFG_2); + out_be32(&ddr->ddr_cdr2, DDR_DDR_CDR2); + } + + out_be32(&ddr->sdram_mode, DDR_SDRAM_MODE); + out_be32(&ddr->sdram_mode_2, DDR_SDRAM_MODE_2); + + out_be32(&ddr->sdram_interval, DDR_SDRAM_INTERVAL); + + out_be32(&ddr->ddr_wrlvl_cntl, DDR_DDR_WRLVL_CNTL); + + out_be32(&ddr->ddr_wrlvl_cntl_2, DDR_DDR_WRLVL_CNTL_2); + out_be32(&ddr->ddr_wrlvl_cntl_3, DDR_DDR_WRLVL_CNTL_3); + + out_be32(&ddr->ddr_cdr1, DDR_DDR_CDR1); + + out_be32(&ddr->sdram_clk_cntl, DDR_SDRAM_CLK_CNTL); + out_be32(&ddr->ddr_zq_cntl, DDR_DDR_ZQ_CNTL); + + out_be32(&ddr->cs0_config_2, DDR_CS0_CONFIG_2); + + /* DDR erratum A-009942 */ + tmp = in_be32(&ddr->debug[28]); + out_be32(&ddr->debug[28], tmp | 0x0070006f); + + udelay(1); + +#ifdef CONFIG_DEEP_SLEEP + if (is_warm_boot()) { + /* enter self-refresh */ + temp_sdram_cfg = in_be32(&ddr->sdram_cfg_2); + temp_sdram_cfg |= SDRAM_CFG2_FRC_SR; + out_be32(&ddr->sdram_cfg_2, temp_sdram_cfg); + + temp_sdram_cfg = (DDR_SDRAM_CFG_MEM_EN | SDRAM_CFG_BI); + } else +#endif + temp_sdram_cfg = (DDR_SDRAM_CFG_MEM_EN & ~SDRAM_CFG_BI); + + out_be32(&ddr->sdram_cfg, DDR_SDRAM_CFG | temp_sdram_cfg); + +#ifdef CONFIG_DEEP_SLEEP + if (is_warm_boot()) { + /* exit self-refresh */ + temp_sdram_cfg = in_be32(&ddr->sdram_cfg_2); + temp_sdram_cfg &= ~SDRAM_CFG2_FRC_SR; + out_be32(&ddr->sdram_cfg_2, temp_sdram_cfg); + } +#endif +#endif /* !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD) */ +} + +int dram_init(void) +{ + ddrmc_init(); + + erratum_a008850_post(); + + gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE); + +#if defined(CONFIG_DEEP_SLEEP) && !defined(CONFIG_SPL_BUILD) + fsl_dp_resume(); +#endif + + return 0; +} + +int board_eth_init(bd_t *bis) +{ + return pci_eth_init(bis); +} + +int board_early_init_f(void) +{ + struct ccsr_scfg *scfg = (struct ccsr_scfg *)CONFIG_SYS_FSL_SCFG_ADDR; + +#ifdef CONFIG_TSEC_ENET + /* Clear BD & FR bits for big endian BD's and frame data (aka set + * correct eTSEC endianness). This is crucial in ensuring that it does + * not report Data Parity Errors in its RX/TX FIFOs when attempting to + * send traffic. + */ + clrbits_be32(&scfg->etsecdmamcr, SCFG_ETSECDMAMCR_LE_BD_FR); + /* EC3_GTX_CLK125 (of enet2) used for all RGMII interfaces */ + out_be32(&scfg->etsecmcr, SCFG_ETSECCMCR_GE2_CLK125); +#endif + + arch_soc_init(); + +#if defined(CONFIG_DEEP_SLEEP) + if (is_warm_boot()) { + timer_init(); + dram_init(); + } +#endif + + return 0; +} + +#ifdef CONFIG_SPL_BUILD +void board_init_f(ulong dummy) +{ + void (*second_uboot)(void); + + /* Clear the BSS */ + memset(__bss_start, 0, __bss_end - __bss_start); + + get_clocks(); + +#if defined(CONFIG_DEEP_SLEEP) + if (is_warm_boot()) + fsl_dp_disable_console(); +#endif + + preloader_console_init(); + + dram_init(); + + /* Allow OCRAM access permission as R/W */ +#ifdef CONFIG_LAYERSCAPE_NS_ACCESS + enable_layerscape_ns_access(); + enable_layerscape_ns_access(); +#endif + + /* + * if it is woken up from deep sleep, then jump to second + * stage uboot and continue executing without recopying + * it from SD since it has already been reserved in memory + * in last boot. + */ + if (is_warm_boot()) { + second_uboot = (void (*)(void))CONFIG_SYS_TEXT_BASE; + second_uboot(); + } + + board_init_r(NULL, 0); +} +#endif + +int board_init(void) +{ +#ifndef CONFIG_SYS_FSL_NO_SERDES + fsl_serdes_init(); +#endif + ls102xa_smmu_stream_id_init(); + +#ifdef CONFIG_LAYERSCAPE_NS_ACCESS + enable_layerscape_ns_access(); +#endif + +#ifdef CONFIG_U_QE + u_qe_init(); +#endif + + return 0; +} + +#if defined(CONFIG_SPL_BUILD) +void spl_board_init(void) +{ + ls102xa_smmu_stream_id_init(); +} +#endif + +#ifdef CONFIG_BOARD_LATE_INIT +int board_late_init(void) +{ +#ifdef CONFIG_CHAIN_OF_TRUST + fsl_setenv_chain_of_trust(); +#endif + + return 0; +} +#endif + +#if defined(CONFIG_MISC_INIT_R) +int misc_init_r(void) +{ +#ifdef CONFIG_FSL_DEVICE_DISABLE + device_disable(devdis_tbl, ARRAY_SIZE(devdis_tbl)); +#endif + +#ifdef CONFIG_FSL_CAAM + return sec_init(); +#endif +} +#endif + +#if defined(CONFIG_DEEP_SLEEP) +void board_sleep_prepare(void) +{ +#ifdef CONFIG_LAYERSCAPE_NS_ACCESS + enable_layerscape_ns_access(); +#endif +} +#endif + +int ft_board_setup(void *blob, bd_t *bd) +{ + ft_cpu_setup(blob, bd); + +#ifdef CONFIG_PCI + ft_pci_setup(blob, bd); +#endif + + return 0; +} diff --git a/board/freescale/ls1021atsn/ls102xa_pbi.cfg b/board/freescale/ls1021atsn/ls102xa_pbi.cfg new file mode 100644 index 000000000000..ba1499b26440 --- /dev/null +++ b/board/freescale/ls1021atsn/ls102xa_pbi.cfg @@ -0,0 +1,15 @@ +# PBI commands + +09570200 ffffffff +09570158 00000300 +8940007c 21f47300 + +# Configure Scratch register +09ee0200 10000000 +# Configure alternate space +09570158 00001000 +# Flush PBL data +096100c0 000FFFFF + +09ea085c 00502880 +09ea0560 80800000 diff --git a/board/freescale/ls1021atsn/ls102xa_rcw_sd.cfg b/board/freescale/ls1021atsn/ls102xa_rcw_sd.cfg new file mode 100644 index 000000000000..a6fc91436f25 --- /dev/null +++ b/board/freescale/ls1021atsn/ls102xa_rcw_sd.cfg @@ -0,0 +1,8 @@ +# PBL preamble and RCW header +aa55aa55 01ee0100 + +# Disable IFC, enable QSPI and DSPI +0608000c 00000000 00000000 00000000 +30000000 08007900 40105a00 21046000 +00000000 00000000 00000000 10002000 +20124801 8804b340 00000000 00000000 diff --git a/configs/ls1021atsn_qspi_defconfig b/configs/ls1021atsn_qspi_defconfig new file mode 100644 index 000000000000..6a1c0f124c93 --- /dev/null +++ b/configs/ls1021atsn_qspi_defconfig @@ -0,0 +1,77 @@ +CONFIG_ARM=y +CONFIG_TARGET_LS1021ATSN=y +CONFIG_SYS_TEXT_BASE=0x40100000 +CONFIG_DEFAULT_DEVICE_TREE="ls1021a-tsn" +CONFIG_BOARD_EARLY_INIT_F=y +CONFIG_SYS_FSL_CLK=y +CONFIG_SYS_EXTRA_OPTIONS="QSPI_BOOT" +CONFIG_QSPI_BOOT=y +CONFIG_BOOTDELAY=3 +CONFIG_HUSH_PARSER=y +CONFIG_CMD_GREPENV=y +CONFIG_CMD_MEMINFO=y +CONFIG_CMD_GPT=y +CONFIG_CMD_FAT=y +CONFIG_FSL_ESDHC=y +CONFIG_CMD_SF=y +CONFIG_OF_CONTROL=y +CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_DM=y +CONFIG_FSL_CAAM=y +CONFIG_SPI=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_ATMEL=y +CONFIG_SPI_FLASH_STMICRO=y +CONFIG_SPI_FLASH_BAR=y +CONFIG_SPI_FLASH_SPANSION=y +CONFIG_NETDEVICES=y +CONFIG_DM_ETH=y +CONFIG_TSEC_ENET=y +CONFIG_MII=y +CONFIG_SYS_NS16550=y +CONFIG_DM_SPI=y +CONFIG_DM_SPI_FLASH=y +CONFIG_SPI_FLASH_DATAFLASH=y +CONFIG_FSL_DSPI=y +CONFIG_FSL_QSPI=y +CONFIG_PCI=y +CONFIG_CMD_PCI=y +CONFIG_DM_PCI=y +CONFIG_DM_PCI_COMPAT=y +CONFIG_CMD_MMC=y +CONFIG_DM_MMC=y +CONFIG_FSL_SPI_ALIGNED_TXFIFO=y +CONFIG_USB=y +CONFIG_DM_USB=y +CONFIG_CMD_USB=y +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_FSL=y +CONFIG_USB_XHCI_DWC3=y +CONFIG_HAS_FSL_XHCI_USB=y +CONFIG_USB_STORAGE=y +CONFIG_CMD_EXT2=y +CONFIG_PCIE_LAYERSCAPE=y +CONFIG_PHYLIB=y +CONFIG_PHY_GIGE=y +CONFIG_PHY_ATHEROS=y +CONFIG_PHY_BROADCOM=y +CONFIG_PHY_FIXED=y +CONFIG_CMD_PING=y +CONFIG_CMD_DHCP=y +CONFIG_CMD_MII=y +CONFIG_CMDLINE_TAG=y +CONFIG_CMDLINE_EDITING=y +CONFIG_AUTO_COMPLETE=y +CONFIG_NR_DRAM_BANKS=1 +CONFIG_CMD_BOOTZ=y +CONFIG_SYS_LONGHELP=y +CONFIG_FIT=y +CONFIG_CMD_DM=y +CONFIG_AHCI=y +CONFIG_CMD_I2C=y +CONFIG_BLK=y +CONFIG_CMD_PART=y +CONFIG_CMD_FS_GENERIC=y +CONFIG_CMD_FS_UUID=y +CONFIG_SILENT_CONSOLE=y +CONFIG_DISTRO_DEFAULTS=y diff --git a/configs/ls1021atsn_sdcard_defconfig b/configs/ls1021atsn_sdcard_defconfig new file mode 100644 index 000000000000..b157a1008107 --- /dev/null +++ b/configs/ls1021atsn_sdcard_defconfig @@ -0,0 +1,86 @@ +CONFIG_ARM=y +CONFIG_TARGET_LS1021ATSN=y +CONFIG_SPL_TEXT_BASE=0x10000000 +CONFIG_SYS_TEXT_BASE=0x82000000 +CONFIG_DEFAULT_DEVICE_TREE="ls1021a-tsn" +CONFIG_BOARD_EARLY_INIT_F=y +CONFIG_SPL=y +CONFIG_SPL_FRAMEWORK=y +CONFIG_SYS_FSL_CLK=y +CONFIG_SYS_EXTRA_OPTIONS="RAMBOOT_PBL,SPL_FSL_PBL,SD_BOOT,SD_BOOT_QSPI" +CONFIG_SD_BOOT=y +CONFIG_BOOTDELAY=3 +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xe8 +CONFIG_HUSH_PARSER=y +CONFIG_CMD_GREPENV=y +CONFIG_CMD_MEMINFO=y +CONFIG_CMD_GPT=y +CONFIG_CMD_FAT=y +CONFIG_CMD_MMC=y +CONFIG_FSL_ESDHC=y +CONFIG_CMD_SF=y +CONFIG_OF_CONTROL=y +CONFIG_ENV_IS_IN_MMC=y +CONFIG_DM=y +CONFIG_FSL_CAAM=y +CONFIG_SPI=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_ATMEL=y +CONFIG_SPI_FLASH_STMICRO=y +CONFIG_SPI_FLASH_BAR=y +CONFIG_SPI_FLASH_SPANSION=y +CONFIG_NETDEVICES=y +CONFIG_DM_ETH=y +CONFIG_TSEC_ENET=y +CONFIG_MII=y +CONFIG_SYS_NS16550=y +CONFIG_DM_SPI=y +CONFIG_DM_SPI_FLASH=y +CONFIG_SPI_FLASH_DATAFLASH=y +CONFIG_FSL_DSPI=y +CONFIG_FSL_QSPI=y +CONFIG_PCI=y +CONFIG_CMD_PCI=y +CONFIG_DM_PCI=y +CONFIG_DM_PCI_COMPAT=y +CONFIG_USB=y +CONFIG_DM_USB=y +CONFIG_CMD_USB=y +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_FSL=y +CONFIG_USB_XHCI_DWC3=y +CONFIG_HAS_FSL_XHCI_USB=y +CONFIG_USB_STORAGE=y +CONFIG_CMD_EXT2=y +CONFIG_PCIE_LAYERSCAPE=y +CONFIG_PHYLIB=y +CONFIG_PHY_GIGE=y +CONFIG_PHY_ATHEROS=y +CONFIG_PHY_BROADCOM=y +CONFIG_PHY_FIXED=y +CONFIG_CMD_PING=y +CONFIG_CMD_DHCP=y +CONFIG_CMD_MII=y +CONFIG_CMDLINE_TAG=y +CONFIG_CMDLINE_EDITING=y +CONFIG_AUTO_COMPLETE=y +CONFIG_NR_DRAM_BANKS=1 +CONFIG_CMD_BOOTZ=y +CONFIG_SYS_LONGHELP=y +CONFIG_FIT=y +CONFIG_SPL_MMC_SUPPORT=y +CONFIG_SPL_SERIAL_SUPPORT=y +CONFIG_SPL_I2C_SUPPORT=y +CONFIG_SPL_ENV_SUPPORT=y +CONFIG_SPL_LIBCOMMON_SUPPORT=y +CONFIG_CMD_DM=y +CONFIG_AHCI=y +CONFIG_CMD_I2C=y +CONFIG_BLK=y +CONFIG_DM_MMC=y +CONFIG_CMD_PART=y +CONFIG_CMD_FS_GENERIC=y +CONFIG_CMD_FS_UUID=y +CONFIG_SILENT_CONSOLE=y +CONFIG_DISTRO_DEFAULTS=y diff --git a/include/configs/ls1021atsn.h b/include/configs/ls1021atsn.h new file mode 100644 index 000000000000..b6f2422e7137 --- /dev/null +++ b/include/configs/ls1021atsn.h @@ -0,0 +1,289 @@ +/* SPDX-License-Identifier: GPL-2.0 + * Copyright 2016-2018 NXP Semiconductors + * Copyright 2019 Vladimir Oltean + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + +#define CONFIG_ARMV7_SECURE_BASE OCRAM_BASE_S_ADDR + +#define CONFIG_SYS_FSL_CLK + +#define CONFIG_DEEP_SLEEP + +/* + * Size of malloc() pool + */ +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 16 * 1024 * 1024) + +#define CONFIG_SYS_INIT_RAM_ADDR OCRAM_BASE_ADDR +#define CONFIG_SYS_INIT_RAM_SIZE OCRAM_SIZE + +/* XHCI Support - enabled by default */ +#define CONFIG_USB_MAX_CONTROLLER_COUNT 1 + +#define CONFIG_SYS_CLK_FREQ 100000000 +#define CONFIG_DDR_CLK_FREQ 100000000 + +#define DDR_SDRAM_CFG 0x470c0008 +#define DDR_CS0_BNDS 0x008000bf +#define DDR_CS0_CONFIG 0x80014302 +#define DDR_TIMING_CFG_0 0x50550004 +#define DDR_TIMING_CFG_1 0xbcb38c56 +#define DDR_TIMING_CFG_2 0x0040d120 +#define DDR_TIMING_CFG_3 0x010e1000 +#define DDR_TIMING_CFG_4 0x00000001 +#define DDR_TIMING_CFG_5 0x03401400 +#define DDR_SDRAM_CFG_2 0x00401010 +#define DDR_SDRAM_MODE 0x00061c60 +#define DDR_SDRAM_MODE_2 0x00180000 +#define DDR_SDRAM_INTERVAL 0x18600618 +#define DDR_DDR_WRLVL_CNTL 0x8655f605 +#define DDR_DDR_WRLVL_CNTL_2 0x05060607 +#define DDR_DDR_WRLVL_CNTL_3 0x05050505 +#define DDR_DDR_CDR1 0x80040000 +#define DDR_DDR_CDR2 0x00000001 +#define DDR_SDRAM_CLK_CNTL 0x02000000 +#define DDR_DDR_ZQ_CNTL 0x89080600 +#define DDR_CS0_CONFIG_2 0 +#define DDR_SDRAM_CFG_MEM_EN 0x80000000 +#define SDRAM_CFG2_D_INIT 0x00000010 +#define DDR_CDR2_VREF_TRAIN_EN 0x00000080 +#define SDRAM_CFG2_FRC_SR 0x80000000 +#define SDRAM_CFG_BI 0x00000001 + +#define CONFIG_CHIP_SELECTS_PER_CTRL 4 + +#ifdef CONFIG_RAMBOOT_PBL +#define CONFIG_SYS_FSL_PBL_PBI \ + "board/freescale/ls1021atsn/ls102xa_pbi.cfg" +#endif + +#ifdef CONFIG_SD_BOOT +#define CONFIG_SYS_FSL_PBL_RCW \ + "board/freescale/ls1021atsn/ls102xa_rcw_sd.cfg" +#define CONFIG_SPL_LDSCRIPT "arch/$(ARCH)/cpu/u-boot-spl.lds" +#define CONFIG_SPL_LIBGENERIC_SUPPORT +#define CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT +#define CONFIG_SPL_WATCHDOG_SUPPORT +#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0xe8 + +#ifdef CONFIG_SECURE_BOOT +#define CONFIG_U_BOOT_HDR_SIZE (16 << 10) +#endif /* ifdef CONFIG_SECURE_BOOT */ + +#define CONFIG_SPL_MAX_SIZE 0x1a000 +#define CONFIG_SPL_STACK 0x1001d000 +#define CONFIG_SPL_PAD_TO 0x1c000 + +#define CONFIG_SYS_SPL_MALLOC_START (CONFIG_SYS_TEXT_BASE + \ + CONFIG_SYS_MONITOR_LEN) +#define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000 +#define CONFIG_SPL_BSS_START_ADDR 0x80100000 +#define CONFIG_SPL_BSS_MAX_SIZE 0x80000 + +#ifdef CONFIG_U_BOOT_HDR_SIZE +/* + * HDR would be appended at end of image and copied to DDR along + * with U-Boot image. Here u-boot max. size is 512K. So if binary + * size increases then increase this size in case of secure boot as + * it uses raw u-boot image instead of fit image. + */ +#define CONFIG_SYS_MONITOR_LEN (0x100000 + CONFIG_U_BOOT_HDR_SIZE) +#else +#define CONFIG_SYS_MONITOR_LEN 0x100000 +#endif /* ifdef CONFIG_U_BOOT_HDR_SIZE */ +#endif + +#define CONFIG_NR_DRAM_BANKS 1 +#define PHYS_SDRAM 0x80000000 +#define PHYS_SDRAM_SIZE (1u * 1024 * 1024 * 1024) + +#define CONFIG_SYS_DDR_SDRAM_BASE 0x80000000UL +#define CONFIG_SYS_SDRAM_BASE CONFIG_SYS_DDR_SDRAM_BASE + +#define CONFIG_CHIP_SELECTS_PER_CTRL 4 + +/* + * Serial Port + */ +#define CONFIG_CONS_INDEX 1 +#define CONFIG_SYS_NS16550_SERIAL +#ifndef CONFIG_DM_SERIAL +#define CONFIG_SYS_NS16550_REG_SIZE 1 +#endif +#define CONFIG_SYS_NS16550_CLK get_serial_clock() + +#define CONFIG_BAUDRATE 115200 + +/* + * I2C + */ +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC +#define CONFIG_SYS_I2C_MXC_I2C1 /* enable I2C bus 1 */ +#define CONFIG_SYS_I2C_MXC_I2C2 /* enable I2C bus 2 */ +#define CONFIG_SYS_I2C_MXC_I2C3 /* enable I2C bus 3 */ + +/* EEPROM */ +#define CONFIG_ID_EEPROM +#define CONFIG_SYS_I2C_EEPROM_NXID +#define CONFIG_SYS_EEPROM_BUS_NUM 0 +#define CONFIG_SYS_I2C_EEPROM_ADDR 0x51 +#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2 + +/* QSPI */ +#define FSL_QSPI_FLASH_SIZE SZ_32M +#define FSL_QSPI_FLASH_NUM 2 + +#ifdef CONFIG_TSEC_ENET +#define CONFIG_ETHPRIME "ethernet@2d10000" +#endif + +/* PCIe */ +#define CONFIG_PCIE1 /* PCIE controller 1 */ +#define CONFIG_PCIE2 /* PCIE controller 2 */ +#define FSL_PCIE_COMPAT "fsl,ls1021a-pcie" +#ifdef CONFIG_PCI +#define CONFIG_PCI_SCAN_SHOW +#endif + +#define CONFIG_PEN_ADDR_BIG_ENDIAN +#define CONFIG_LAYERSCAPE_NS_ACCESS +#define CONFIG_SMP_PEN_ADDR 0x01ee0200 +#define COUNTER_FREQUENCY 12500000 + +#define CONFIG_HWCONFIG +#define HWCONFIG_BUFFER_SIZE 256 + +#define CONFIG_FSL_DEVICE_DISABLE + +#define BOOT_TARGET_DEVICES(func) \ + func(MMC, mmc, 0) \ + func(USB, usb, 0) \ + func(DHCP, dhcp, na) +#include + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "bootargs=root=/dev/ram0 rw console=ttyS0,115200\0" \ + "initrd_high=0xffffffff\0" \ + "fdt_high=0xffffffff\0" \ + "fdt_addr=0x64f00000\0" \ + "kernel_addr=0x61000000\0" \ + "kernelheader_addr=0x60800000\0" \ + "scriptaddr=0x80000000\0" \ + "scripthdraddr=0x80080000\0" \ + "fdtheader_addr_r=0x80100000\0" \ + "kernelheader_addr_r=0x80200000\0" \ + "kernel_addr_r=0x80008000\0" \ + "kernelheader_size=0x40000\0" \ + "fdt_addr_r=0x8f000000\0" \ + "ramdisk_addr_r=0xa0000000\0" \ + "load_addr=0x80008000\0" \ + "kernel_size=0x2800000\0" \ + "kernel_addr_sd=0x8000\0" \ + "kernel_size_sd=0x14000\0" \ + "kernelhdr_addr_sd=0x4000\0" \ + "kernelhdr_size_sd=0x10\0" \ + BOOTENV \ + "boot_scripts=ls1021atsn_boot.scr\0" \ + "boot_script_hdr=hdr_ls1021atsn_bs.out\0" \ + "scan_dev_for_boot_part=" \ + "part list ${devtype} ${devnum} devplist; " \ + "env exists devplist || setenv devplist 1; " \ + "for distro_bootpart in ${devplist}; do " \ + "if fstype ${devtype} " \ + "${devnum}:${distro_bootpart} " \ + "bootfstype; then " \ + "run scan_dev_for_boot; " \ + "fi; " \ + "done\0" \ + "scan_dev_for_boot=" \ + "echo Scanning ${devtype} " \ + "${devnum}:${distro_bootpart}...; " \ + "for prefix in ${boot_prefixes}; do " \ + "run scan_dev_for_scripts; " \ + "run scan_dev_for_extlinux; " \ + "done;" \ + "\0" \ + "boot_a_script=" \ + "load ${devtype} ${devnum}:${distro_bootpart} " \ + "${scriptaddr} ${prefix}${script}; " \ + "env exists secureboot && load ${devtype} " \ + "${devnum}:${distro_bootpart} " \ + "${scripthdraddr} ${prefix}${boot_script_hdr} " \ + "&& esbc_validate ${scripthdraddr};" \ + "source ${scriptaddr}\0" \ + "qspi_bootcmd=echo Trying load from qspi..;" \ + "sf probe && sf read $load_addr " \ + "$kernel_addr $kernel_size; env exists secureboot " \ + "&& sf read $kernelheader_addr_r $kernelheader_addr " \ + "$kernelheader_size && esbc_validate ${kernelheader_addr_r}; " \ + "bootm $load_addr#$board\0" \ + "sd_bootcmd=echo Trying load from SD ..;" \ + "mmcinfo && mmc read $load_addr " \ + "$kernel_addr_sd $kernel_size_sd && " \ + "env exists secureboot && mmc read $kernelheader_addr_r " \ + "$kernelhdr_addr_sd $kernelhdr_size_sd " \ + " && esbc_validate ${kernelheader_addr_r};" \ + "bootm $load_addr#$board\0" + +#undef CONFIG_BOOTCOMMAND +#if defined(CONFIG_QSPI_BOOT) +#define CONFIG_BOOTCOMMAND "run distro_bootcmd; run qspi_bootcmd; " \ + "env exists secureboot && esbc_halt" +#elif defined(CONFIG_SD_BOOT) +#define CONFIG_BOOTCOMMAND "run distro_bootcmd; run sd_bootcmd; " \ + "env exists secureboot && esbc_halt;" +#endif + +/* + * Miscellaneous configurable options + */ +#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */ +#define CONFIG_SYS_PBSIZE \ + (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16) +#define CONFIG_SYS_MAXARGS 16 /* max number of command args */ +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE + +#define CONFIG_SYS_LOAD_ADDR 0x82000000 + +#define CONFIG_LS102XA_STREAM_ID + +#define CONFIG_SYS_INIT_SP_OFFSET \ + (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) +#define CONFIG_SYS_INIT_SP_ADDR \ + (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET) + +#ifdef CONFIG_SPL_BUILD +#define CONFIG_SYS_MONITOR_BASE CONFIG_SPL_TEXT_BASE +#else +#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE /* start of monitor */ +#endif + +#define CONFIG_SYS_QE_FW_ADDR 0x67f40000 + +/* + * Environment + */ +#define CONFIG_ENV_OVERWRITE + +#if defined(CONFIG_SD_BOOT) +#define CONFIG_ENV_OFFSET 0x300000 +#define CONFIG_SYS_MMC_ENV_DEV 0 +#define CONFIG_ENV_SIZE 0x20000 +#elif defined(CONFIG_QSPI_BOOT) +#define CONFIG_ENV_SIZE 0x2000 +#define CONFIG_ENV_OFFSET 0x300000 +#define CONFIG_ENV_SECT_SIZE 0x40000 +#endif + +#define CONFIG_OF_BOARD_SETUP +#define CONFIG_OF_STDOUT_VIA_ALIAS +#define CONFIG_MISC_INIT_R + +#include +#define CONFIG_SYS_BOOTM_LEN 0x8000000 /* 128 MB */ + +#endif