From patchwork Fri Sep 29 12:51:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819902 X-Patchwork-Delegate: wd@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 3y3Wtb2SRVz9t33 for ; Fri, 29 Sep 2017 23:02:31 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 094F3C21E13; Fri, 29 Sep 2017 12:54:45 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 23D2BC21E2F; Fri, 29 Sep 2017 12:53:23 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E405CC21DC3; Fri, 29 Sep 2017 12:53:04 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 603D7C21DAA for ; Fri, 29 Sep 2017 12:53:02 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxumq-00004w-QQ; Fri, 29 Sep 2017 14:53:00 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:19 +0200 Message-Id: <20170929125238.26226-1-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 001/080] mpc8308rdb: Fix style violation 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" Fix a indention style violation in the freescale MPC8308RDB SDRAM code. Signed-off-by: Mario Six --- board/freescale/mpc8308rdb/sdram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/freescale/mpc8308rdb/sdram.c b/board/freescale/mpc8308rdb/sdram.c index 81e155a401..cea248f724 100644 --- a/board/freescale/mpc8308rdb/sdram.c +++ b/board/freescale/mpc8308rdb/sdram.c @@ -34,7 +34,7 @@ static long fixed_sdram(void) u32 msize_log2 = __ilog2(msize); out_be32(&im->sysconf.ddrlaw[0].bar, - CONFIG_SYS_DDR_SDRAM_BASE & 0xfffff000); + CONFIG_SYS_DDR_SDRAM_BASE & 0xfffff000); out_be32(&im->sysconf.ddrlaw[0].ar, LBLAWAR_EN | (msize_log2 - 1)); out_be32(&im->sysconf.ddrcdr, CONFIG_SYS_DDRCDR_VALUE); From patchwork Fri Sep 29 12:51:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819904 X-Patchwork-Delegate: wd@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 3y3Wwh3sT0z9t4g for ; Fri, 29 Sep 2017 23:04:20 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 2D717C21E0A; Fri, 29 Sep 2017 12:58: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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 362ECC21E88; Fri, 29 Sep 2017 12:53:44 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3C635C21DD9; Fri, 29 Sep 2017 12:53:04 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id AE17EC21DEB for ; Fri, 29 Sep 2017 12:53:02 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxumq-00004w-Vt; Fri, 29 Sep 2017 14:53:01 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:20 +0200 Message-Id: <20170929125238.26226-2-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 002/080] mpc83xx: spd_sdram: Fix whitespace style violations 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" Fix whitespace style violations in the MPC83xx SPD-SDRAM code. Signed-off-by: Mario Six --- arch/powerpc/cpu/mpc83xx/spd_sdram.c | 134 +++++++++++++++++------------------ 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/arch/powerpc/cpu/mpc83xx/spd_sdram.c b/arch/powerpc/cpu/mpc83xx/spd_sdram.c index 21ab0153fc..48814a09f2 100644 --- a/arch/powerpc/cpu/mpc83xx/spd_sdram.c +++ b/arch/powerpc/cpu/mpc83xx/spd_sdram.c @@ -160,12 +160,13 @@ long int spd_sdram() /* Read SPD parameters with I2C */ CONFIG_SYS_READ_SPD(SPD_EEPROM_ADDRESS, SPD_EEPROM_OFFSET, - SPD_EEPROM_ADDR_LEN, (uchar *) &spd, sizeof(spd)); + SPD_EEPROM_ADDR_LEN, (uchar *)&spd, sizeof(spd)); #ifdef SPD_DEBUG spd_debug(&spd); #endif /* Check the memory type */ - if (spd.mem_type != SPD_MEMTYPE_DDR && spd.mem_type != SPD_MEMTYPE_DDR2) { + if (spd.mem_type != SPD_MEMTYPE_DDR && + spd.mem_type != SPD_MEMTYPE_DDR2) { debug("DDR: Module mem type is %02X\n", spd.mem_type); return 0; } @@ -185,14 +186,14 @@ long int spd_sdram() /* Check if the number of row of the module is in the range of DDRC */ if (spd.nrow_addr < 12 || spd.nrow_addr > 15) { printf("DDR: Row number is out of range of DDRC, row=%02X\n", - spd.nrow_addr); + spd.nrow_addr); return 0; } /* Check if the number of col of the module is in the range of DDRC */ if (spd.ncol_addr < 8 || spd.ncol_addr > 11) { printf("DDR: Col number is out of range of DDRC, col=%02X\n", - spd.ncol_addr); + spd.ncol_addr); return 0; } @@ -223,22 +224,22 @@ long int spd_sdram() | (odt_wr_cfg << 16) | ((spd.nbanks == 8 ? 1 : 0) << 14) | ((spd.nrow_addr - 12) << 8) - | (spd.ncol_addr - 8) ); + | (spd.ncol_addr - 8)); debug("\n"); - debug("cs0_bnds = 0x%08x\n",ddr->csbnds[0].csbnds); - debug("cs0_config = 0x%08x\n",ddr->cs_config[0]); + debug("cs0_bnds = 0x%08x\n", ddr->csbnds[0].csbnds); + debug("cs0_config = 0x%08x\n", ddr->cs_config[0]); if (n_ranks == 2) { - ddr->csbnds[1].csbnds = ( (banksize(spd.row_dens) >> 8) - | ((banksize(spd.row_dens) >> 23) - 1) ); ddr->cs_config[1] = ( 1<<31 + ddr->csbnds[1].csbnds = ((banksize(spd.row_dens) >> 8) + | ((banksize(spd.row_dens) >> 23) - 1)); | (odt_rd_cfg << 20) | (odt_wr_cfg << 16) | ((spd.nbanks == 8 ? 1 : 0) << 14) | ((spd.nrow_addr - 12) << 8) - | (spd.ncol_addr - 8) ); - debug("cs1_bnds = 0x%08x\n",ddr->csbnds[1].csbnds); - debug("cs1_config = 0x%08x\n",ddr->cs_config[1]); + | (spd.ncol_addr - 8)); + debug("cs1_bnds = 0x%08x\n", ddr->csbnds[1].csbnds); + debug("cs1_config = 0x%08x\n", ddr->cs_config[1]); } #else @@ -248,22 +249,22 @@ long int spd_sdram() | (odt_wr_cfg << 16) | ((spd.nbanks == 8 ? 1 : 0) << 14) | ((spd.nrow_addr - 12) << 8) - | (spd.ncol_addr - 8) ); + | (spd.ncol_addr - 8)); debug("\n"); - debug("cs2_bnds = 0x%08x\n",ddr->csbnds[2].csbnds); - debug("cs2_config = 0x%08x\n",ddr->cs_config[2]); + debug("cs2_bnds = 0x%08x\n", ddr->csbnds[2].csbnds); + debug("cs2_config = 0x%08x\n", ddr->cs_config[2]); if (n_ranks == 2) { - ddr->csbnds[3].csbnds = ( (banksize(spd.row_dens) >> 8) - | ((banksize(spd.row_dens) >> 23) - 1) ); ddr->cs_config[3] = ( 1<<31 + ddr->csbnds[3].csbnds = ((banksize(spd.row_dens) >> 8) + | ((banksize(spd.row_dens) >> 23) - 1)); | (odt_rd_cfg << 20) | (odt_wr_cfg << 16) | ((spd.nbanks == 8 ? 1 : 0) << 14) | ((spd.nrow_addr - 12) << 8) - | (spd.ncol_addr - 8) ); - debug("cs3_bnds = 0x%08x\n",ddr->csbnds[3].csbnds); - debug("cs3_config = 0x%08x\n",ddr->cs_config[3]); + | (spd.ncol_addr - 8)); + debug("cs3_bnds = 0x%08x\n", ddr->csbnds[3].csbnds); + debug("cs3_config = 0x%08x\n", ddr->cs_config[3]); } #endif @@ -304,19 +305,19 @@ long int spd_sdram() * 5.0 5 1001 */ caslat = __ilog2(spd.cas_lat); - if ((spd.mem_type == SPD_MEMTYPE_DDR) - && (caslat > 6)) { + if (spd.mem_type == SPD_MEMTYPE_DDR && + caslat > 6) { printf("DDR I: Invalid SPD CAS Latency: 0x%x.\n", spd.cas_lat); return 0; - } else if (spd.mem_type == SPD_MEMTYPE_DDR2 - && (caslat < 2 || caslat > 5)) { + } else if (spd.mem_type == SPD_MEMTYPE_DDR2 && + (caslat < 2 || caslat > 5)) { printf("DDR II: Invalid SPD CAS Latency: 0x%x.\n", spd.cas_lat); return 0; } debug("DDR: caslat SPD bit is %d\n", caslat); - max_bus_clk = 1000 *10 / (((spd.clk_cycle & 0xF0) >> 4) * 10 + max_bus_clk = 1000 * 10 / (((spd.clk_cycle & 0xF0) >> 4) * 10 + (spd.clk_cycle & 0x0f)); max_data_rate = max_bus_clk * 2; @@ -332,7 +333,7 @@ long int spd_sdram() caslat = 4; if (ddrc_clk <= 460 && ddrc_clk > 350) effective_data_rate = 400; - else if (ddrc_clk <=350 && ddrc_clk > 280) + else if (ddrc_clk <= 350 && ddrc_clk > 280) effective_data_rate = 333; else if (ddrc_clk <= 280 && ddrc_clk > 230) effective_data_rate = 266; @@ -395,7 +396,7 @@ long int spd_sdram() if (ddrc_clk <= 350 && ddrc_clk > 280) { /* DDR controller clk at 280~350 */ printf("DDR: DDR controller freq is more than " - "max data rate of the module\n"); + "max data rate of the module\n"); return 0; } else if (ddrc_clk <= 280 && ddrc_clk > 230) { /* DDR controller clk at 230~280 */ @@ -411,7 +412,7 @@ long int spd_sdram() if (ddrc_clk <= 350 && ddrc_clk > 230) { /* DDR controller clk at 230~350 */ printf("DDR: DDR controller freq is more than " - "max data rate of the module\n"); + "max data rate of the module\n"); return 0; } else if (ddrc_clk <= 230 && ddrc_clk > 90) { /* DDR controller clk at 90~230 */ @@ -427,7 +428,7 @@ long int spd_sdram() * Errata DDR6 work around: input enable 2 cycles earlier. * including MPC834x Rev1.0/1.1 and MPC8360 Rev1.1/1.2. */ - if(PVR_MAJ(pvr) <= 1 && spd.mem_type == SPD_MEMTYPE_DDR){ + if (PVR_MAJ(pvr) <= 1 && spd.mem_type == SPD_MEMTYPE_DDR) { if (caslat == 2) ddr->debug_reg = 0x201c0000; /* CL=2 */ else if (caslat == 3) @@ -528,11 +529,11 @@ long int spd_sdram() trfc_low = (trfc_clk - 8) & 0xf; ddr->timing_cfg_1 = - (((picos_to_clk(spd.trp * 250) & 0x07) << 28 ) | /* PRETOACT */ - ((picos_to_clk(spd.tras * 1000) & 0x0f ) << 24 ) | /* ACTTOPRE */ - (trcd_clk << 20 ) | /* ACTTORW */ - (caslat_ctrl << 16 ) | /* CASLAT */ - (trfc_low << 12 ) | /* REFEC */ + (((picos_to_clk(spd.trp * 250) & 0x07) << 28) | /* PRETOACT */ + ((picos_to_clk(spd.tras * 1000) & 0x0f) << 24) | /* ACTTOPRE */ + (trcd_clk << 20) | /* ACTTORW */ + (caslat_ctrl << 16) | /* CASLAT */ + (trfc_low << 12) | /* REFEC */ ((twr_clk & 0x07) << 8) | /* WRRREC */ ((picos_to_clk(spd.trrd * 250) & 0x07) << 4) | /* ACTTOACT */ ((twtr_clk & 0x07) << 0) /* WRTORD */ @@ -704,33 +705,33 @@ long int spd_sdram() debug("DDR: sdram_mode2 = 0x%08x\n", ddr->sdram_mode2); switch (spd.refresh) { - case 0x00: - case 0x80: - refresh_clk = picos_to_clk(15625000); - break; - case 0x01: - case 0x81: - refresh_clk = picos_to_clk(3900000); - break; - case 0x02: - case 0x82: - refresh_clk = picos_to_clk(7800000); - break; - case 0x03: - case 0x83: - refresh_clk = picos_to_clk(31300000); - break; - case 0x04: - case 0x84: - refresh_clk = picos_to_clk(62500000); - break; - case 0x05: - case 0x85: - refresh_clk = picos_to_clk(125000000); - break; - default: - refresh_clk = 0x512; - break; + case 0x00: + case 0x80: + refresh_clk = picos_to_clk(15625000); + break; + case 0x01: + case 0x81: + refresh_clk = picos_to_clk(3900000); + break; + case 0x02: + case 0x82: + refresh_clk = picos_to_clk(7800000); + break; + case 0x03: + case 0x83: + refresh_clk = picos_to_clk(31300000); + break; + case 0x04: + case 0x84: + refresh_clk = picos_to_clk(62500000); + break; + case 0x05: + case 0x85: + refresh_clk = picos_to_clk(125000000); + break; + default: + refresh_clk = 0x512; + break; } /* @@ -823,7 +824,7 @@ long int spd_sdram() debug("DDR:err_disable=0x%08x\n", ddr->err_disable); debug("DDR:err_sbe=0x%08x\n", ddr->err_sbe); #endif - debug(" DDRC ECC mode: %s\n", ddrc_ecc_enable ? "ON":"OFF"); + debug(" DDRC ECC mode: %s\n", ddrc_ecc_enable ? "ON" : "OFF"); #if defined(CONFIG_DDR_2T_TIMING) /* @@ -866,7 +867,7 @@ static __inline__ unsigned long get_tbms (void) tmp = (unsigned long long)(tbu1); tmp = (tmp << 32); tmp += (unsigned long long)(tbl); - ms = tmp/(tbclk/1000); + ms = tmp / (tbclk / 1000); return ms; } @@ -877,7 +878,7 @@ static __inline__ unsigned long get_tbms (void) void ddr_enable_ecc(unsigned int dram_size) { volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR; - volatile ddr83xx_t *ddr= &immap->ddr; + volatile ddr83xx_t *ddr = &immap->ddr; unsigned long t_start, t_end; register u64 *p; register uint size; @@ -893,9 +894,8 @@ void ddr_enable_ecc(unsigned int dram_size) #else debug("ddr init: CPU FP write method\n"); size = dram_size; - for (p = 0; p < (u64*)(size); p++) { - ppcDWstore((u32*)p, pattern); - } + for (p = 0; p < (u64 *)(size); p++) + ppcDWstore((u32 *)p, pattern); __asm__ __volatile__ ("sync"); #endif From patchwork Fri Sep 29 12:51:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819891 X-Patchwork-Delegate: wd@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 3y3Whw3zlxz9t33 for ; Fri, 29 Sep 2017 22:54:08 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id CE892C21EE0; Fri, 29 Sep 2017 12:53:21 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 80C6AC21DD9; Fri, 29 Sep 2017 12:53:18 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id CE159C21DAA; Fri, 29 Sep 2017 12:53:04 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 72ECDC21DDF for ; Fri, 29 Sep 2017 12:53:02 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxumr-00004w-4G; Fri, 29 Sep 2017 14:53:01 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:21 +0200 Message-Id: <20170929125238.26226-3-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 003/080] mpc83xx: spd_sdram: Fix style violations 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" Fix style violations in the MPC83xx SPD-SDRAM code and make the code more readable. Signed-off-by: Mario Six --- arch/powerpc/cpu/mpc83xx/spd_sdram.c | 49 ++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/arch/powerpc/cpu/mpc83xx/spd_sdram.c b/arch/powerpc/cpu/mpc83xx/spd_sdram.c index 48814a09f2..f9c41cbeb7 100644 --- a/arch/powerpc/cpu/mpc83xx/spd_sdram.c +++ b/arch/powerpc/cpu/mpc83xx/spd_sdram.c @@ -172,11 +172,10 @@ long int spd_sdram() } /* Check the number of physical bank */ - if (spd.mem_type == SPD_MEMTYPE_DDR) { + if (spd.mem_type == SPD_MEMTYPE_DDR) n_ranks = spd.nrows; - } else { + else n_ranks = (spd.nrows & 0x7) + 1; - } if (n_ranks > 2) { printf("DDR: The number of physical bank is %02X\n", n_ranks); @@ -201,10 +200,9 @@ long int spd_sdram() /* * Adjust DDR II IO voltage biasing. It just makes it work. */ - if(spd.mem_type == SPD_MEMTYPE_DDR2) { + if (spd.mem_type == SPD_MEMTYPE_DDR2) immap->sysconf.ddrcdr = CONFIG_SYS_DDRCDR_VALUE; - } - udelay(50000); + mdelay(50); #endif /* @@ -212,14 +210,13 @@ long int spd_sdram() */ odt_rd_cfg = 0; /* Never assert ODT */ odt_wr_cfg = 0; /* Never assert ODT */ - if (spd.mem_type == SPD_MEMTYPE_DDR2) { + if (spd.mem_type == SPD_MEMTYPE_DDR2) odt_wr_cfg = 1; /* Assert ODT on writes to CSn */ - } /* Setup DDR chip select register */ #ifdef CONFIG_SYS_83XX_DDR_USES_CS0 ddr->csbnds[0].csbnds = (banksize(spd.row_dens) >> 24) - 1; - ddr->cs_config[0] = ( 1 << 31 + ddr->cs_config[0] = (BIT(31) | (odt_rd_cfg << 20) | (odt_wr_cfg << 16) | ((spd.nbanks == 8 ? 1 : 0) << 14) @@ -230,9 +227,9 @@ long int spd_sdram() debug("cs0_config = 0x%08x\n", ddr->cs_config[0]); if (n_ranks == 2) { - ddr->cs_config[1] = ( 1<<31 ddr->csbnds[1].csbnds = ((banksize(spd.row_dens) >> 8) | ((banksize(spd.row_dens) >> 23) - 1)); + ddr->cs_config[1] = (BIT(31) | (odt_rd_cfg << 20) | (odt_wr_cfg << 16) | ((spd.nbanks == 8 ? 1 : 0) << 14) @@ -244,7 +241,7 @@ long int spd_sdram() #else ddr->csbnds[2].csbnds = (banksize(spd.row_dens) >> 24) - 1; - ddr->cs_config[2] = ( 1 << 31 + ddr->cs_config[2] = (BIT(31) | (odt_rd_cfg << 20) | (odt_wr_cfg << 16) | ((spd.nbanks == 8 ? 1 : 0) << 14) @@ -255,9 +252,9 @@ long int spd_sdram() debug("cs2_config = 0x%08x\n", ddr->cs_config[2]); if (n_ranks == 2) { - ddr->cs_config[3] = ( 1<<31 ddr->csbnds[3].csbnds = ((banksize(spd.row_dens) >> 8) | ((banksize(spd.row_dens) >> 23) - 1)); + ddr->cs_config[3] = (BIT(31) | (odt_rd_cfg << 20) | (odt_wr_cfg << 16) | ((spd.nbanks == 8 ? 1 : 0) << 14) @@ -445,11 +442,10 @@ long int spd_sdram() * Convert caslat clocks to DDR controller value. * Force caslat_ctrl to be DDR Controller field-sized. */ - if (spd.mem_type == SPD_MEMTYPE_DDR) { + if (spd.mem_type == SPD_MEMTYPE_DDR) caslat_ctrl = (caslat + 1) & 0x07; - } else { + else caslat_ctrl = (2 * caslat - 1) & 0x0f; - } debug("DDR: effective data rate is %d MHz\n", effective_data_rate); debug("DDR: caslat SPD bit is %d, controller field is 0x%x\n", @@ -547,13 +543,12 @@ long int spd_sdram() * add_lat + caslat must be >= 4 */ add_lat = 0; - if (spd.mem_type == SPD_MEMTYPE_DDR2 - && (odt_wr_cfg || odt_rd_cfg) - && (caslat < 4)) { + if (spd.mem_type == SPD_MEMTYPE_DDR2 && + (odt_wr_cfg || odt_rd_cfg) && + caslat < 4) { add_lat = 4 - caslat; - if ((add_lat + caslat) < 4) { + if ((add_lat + caslat) < 4) add_lat = 0; - } } /* @@ -652,7 +647,7 @@ long int spd_sdram() debug(" without ECC\n"); /* Burst length is always 4 for 64 bit data bus, 8 for 32 bit data bus, - Burst type is sequential + * Burst type is sequential */ if (spd.mem_type == SPD_MEMTYPE_DDR) { switch (caslat) { @@ -685,9 +680,9 @@ long int spd_sdram() ddr->sdram_mode = (0 - | (1 << (16 + 10)) /* DQS Differential disable */ + | BIT(16 + 10) /* DQS Differential disable */ #ifdef CONFIG_SYS_DDR_MODE_WEAK - | (1 << (16 + 1)) /* weak driver (~60%) */ + | BIT(16 + 1) /* weak driver (~60%) */ #endif | (add_lat << (16 + 3)) /* Additive Latency in EMRS1 */ | (mode_odt_enable << 16) /* ODT Enable in EMRS1 */ @@ -746,9 +741,8 @@ long int spd_sdram() */ odt_cfg = 0; #ifndef CONFIG_NEVER_ASSERT_ODT_TO_CPU - if (odt_rd_cfg | odt_wr_cfg) { + if (odt_rd_cfg | odt_wr_cfg) odt_cfg = 0x2; /* ODT to IOs during reads */ - } #endif if (spd.mem_type == SPD_MEMTYPE_DDR2) { ddr->sdram_cfg2 = (0 @@ -816,7 +810,8 @@ long int spd_sdram() /* disable error detection */ ddr->err_disable = ~ECC_ERROR_ENABLE; /* set single bit error threshold to maximum value, - * reset counter to zero */ + * reset counter to zero + */ ddr->err_sbe = (255 << ECC_ERROR_MAN_SBET_SHIFT) | (0 << ECC_ERROR_MAN_SBEC_SHIFT); } @@ -847,7 +842,7 @@ long int spd_sdram() * Use timebase counter, get_timer() is not available * at this point of initialization yet. */ -static __inline__ unsigned long get_tbms (void) +static inline unsigned long get_tbms (void) { unsigned long tbl; unsigned long tbu1, tbu2; From patchwork Fri Sep 29 12:51:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819892 X-Patchwork-Delegate: wd@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 3y3Wk96gnpz9t33 for ; Fri, 29 Sep 2017 22:55:13 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 97539C21F33; Fri, 29 Sep 2017 12:54: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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 AA3BDC21E0A; Fri, 29 Sep 2017 12:53:20 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 11352C21DAA; Fri, 29 Sep 2017 12:53:04 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 40D92C21DEF for ; Fri, 29 Sep 2017 12:53:02 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxumr-00004w-8S; Fri, 29 Sep 2017 14:53:01 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:22 +0200 Message-Id: <20170929125238.26226-4-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 004/080] include: dm: Fix 'devioe'/'devuce' typos 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" There are some typos in the documentation of some functions in read.h; fix those. Signed-off-by: Mario Six Reviewed-by: Simon Glass --- include/dm/read.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/dm/read.h b/include/dm/read.h index 8114037e97..d2f47a678f 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -255,7 +255,7 @@ int dev_count_phandle_with_args(struct udevice *dev, const char *list_name, * This walks back up the tree to find the closest #address-cells property * which controls the given node. * - * @dev: devioe to check + * @dev: device to check * @return number of address cells this node uses */ int dev_read_addr_cells(struct udevice *dev); @@ -266,7 +266,7 @@ int dev_read_addr_cells(struct udevice *dev); * This walks back up the tree to find the closest #size-cells property * which controls the given node. * - * @dev: devioe to check + * @dev: device to check * @return number of size cells this node uses */ int dev_read_size_cells(struct udevice *dev); @@ -276,7 +276,7 @@ int dev_read_size_cells(struct udevice *dev); * * This function matches fdt_address_cells(). * - * @dev: devioe to check + * @dev: device to check * @return number of address cells this node uses */ int dev_read_simple_addr_cells(struct udevice *dev); @@ -286,7 +286,7 @@ int dev_read_simple_addr_cells(struct udevice *dev); * * This function matches fdt_size_cells(). * - * @dev: devioe to check + * @dev: device to check * @return number of size cells this node uses */ int dev_read_simple_size_cells(struct udevice *dev); From patchwork Fri Sep 29 12:51:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819949 X-Patchwork-Delegate: wd@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 3y3XXc14m0z9rxj for ; Fri, 29 Sep 2017 23:32:00 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id C8F3DC21DBB; Fri, 29 Sep 2017 13:01:32 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 C8A2DC21EEE; Fri, 29 Sep 2017 12:53:56 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 333E9C21E50; Fri, 29 Sep 2017 12:53:04 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id E38D2C21DCE for ; Fri, 29 Sep 2017 12:53:02 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxumr-00004w-Cc; Fri, 29 Sep 2017 14:53:01 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:23 +0200 Message-Id: <20170929125238.26226-5-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 005/080] lib: fdtdec: Fix whitespace style violations 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" Fix some whitespace-related style violations in fdtdec.c. Signed-off-by: Mario Six Reviewed-by: Simon Glass --- lib/fdtdec.c | 56 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 107a892e79..f354a1f9af 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -80,8 +80,9 @@ const char *fdtdec_get_compatible(enum fdt_compat_id id) } fdt_addr_t fdtdec_get_addr_size_fixed(const void *blob, int node, - const char *prop_name, int index, int na, int ns, - fdt_size_t *sizep, bool translate) + const char *prop_name, int index, int na, + int ns, fdt_size_t *sizep, + bool translate) { const fdt32_t *prop, *prop_end; const fdt32_t *prop_addr, *prop_size, *prop_after_size; @@ -135,8 +136,9 @@ fdt_addr_t fdtdec_get_addr_size_fixed(const void *blob, int node, } fdt_addr_t fdtdec_get_addr_size_auto_parent(const void *blob, int parent, - int node, const char *prop_name, int index, fdt_size_t *sizep, - bool translate) + int node, const char *prop_name, + int index, fdt_size_t *sizep, + bool translate) { int na, ns; @@ -161,8 +163,9 @@ fdt_addr_t fdtdec_get_addr_size_auto_parent(const void *blob, int parent, } fdt_addr_t fdtdec_get_addr_size_auto_noparent(const void *blob, int node, - const char *prop_name, int index, fdt_size_t *sizep, - bool translate) + const char *prop_name, int index, + fdt_size_t *sizep, + bool translate) { int parent; @@ -179,7 +182,7 @@ fdt_addr_t fdtdec_get_addr_size_auto_noparent(const void *blob, int node, } fdt_addr_t fdtdec_get_addr_size(const void *blob, int node, - const char *prop_name, fdt_size_t *sizep) + const char *prop_name, fdt_size_t *sizep) { int ns = sizep ? (sizeof(fdt_size_t) / sizeof(fdt32_t)) : 0; @@ -188,15 +191,14 @@ fdt_addr_t fdtdec_get_addr_size(const void *blob, int node, ns, sizep, false); } -fdt_addr_t fdtdec_get_addr(const void *blob, int node, - const char *prop_name) +fdt_addr_t fdtdec_get_addr(const void *blob, int node, const char *prop_name) { return fdtdec_get_addr_size(blob, node, prop_name, NULL); } #if defined(CONFIG_PCI) && defined(CONFIG_DM_PCI) int fdtdec_get_pci_addr(const void *blob, int node, enum fdt_pci_space type, - const char *prop_name, struct fdt_pci_addr *addr) + const char *prop_name, struct fdt_pci_addr *addr) { const u32 *cell; int len; @@ -305,7 +307,7 @@ int fdtdec_get_pci_bar32(struct udevice *dev, struct fdt_pci_addr *addr, #endif uint64_t fdtdec_get_uint64(const void *blob, int node, const char *prop_name, - uint64_t default_val) + uint64_t default_val) { const uint64_t *cell64; int length; @@ -346,14 +348,13 @@ enum fdt_compat_id fdtdec_lookup(const void *blob, int node) return COMPAT_UNKNOWN; } -int fdtdec_next_compatible(const void *blob, int node, - enum fdt_compat_id id) +int fdtdec_next_compatible(const void *blob, int node, enum fdt_compat_id id) { return fdt_node_offset_by_compatible(blob, node, compat_names[id]); } int fdtdec_next_compatible_subnode(const void *blob, int node, - enum fdt_compat_id id, int *depthp) + enum fdt_compat_id id, int *depthp) { do { node = fdt_next_node(blob, node, depthp); @@ -367,8 +368,8 @@ int fdtdec_next_compatible_subnode(const void *blob, int node, return -FDT_ERR_NOTFOUND; } -int fdtdec_next_alias(const void *blob, const char *name, - enum fdt_compat_id id, int *upto) +int fdtdec_next_alias(const void *blob, const char *name, enum fdt_compat_id id, + int *upto) { #define MAX_STR_LEN 20 char str[MAX_STR_LEN + 20]; @@ -390,7 +391,8 @@ int fdtdec_next_alias(const void *blob, const char *name, } int fdtdec_find_aliases_for_id(const void *blob, const char *name, - enum fdt_compat_id id, int *node_list, int maxcount) + enum fdt_compat_id id, int *node_list, + int maxcount) { memset(node_list, '\0', sizeof(*node_list) * maxcount); @@ -399,7 +401,8 @@ int fdtdec_find_aliases_for_id(const void *blob, const char *name, /* TODO: Can we tighten this code up a little? */ int fdtdec_add_aliases_for_id(const void *blob, const char *name, - enum fdt_compat_id id, int *node_list, int maxcount) + enum fdt_compat_id id, int *node_list, + int maxcount) { int name_len = strlen(name); int nodes[maxcount]; @@ -426,7 +429,7 @@ int fdtdec_add_aliases_for_id(const void *blob, const char *name, } if (node >= 0) debug("%s: warning: maxcount exceeded with alias '%s'\n", - __func__, name); + __func__, name); /* Now find all the aliases */ for (offset = fdt_first_property_offset(blob, alias_node); @@ -449,7 +452,7 @@ int fdtdec_add_aliases_for_id(const void *blob, const char *name, number = simple_strtoul(path + name_len, NULL, 10); if (number < 0 || number >= maxcount) { debug("%s: warning: alias '%s' is out of range\n", - __func__, path); + __func__, path); continue; } @@ -495,7 +498,7 @@ int fdtdec_add_aliases_for_id(const void *blob, const char *name, if (!node_list[i]) { for (; j < maxcount; j++) if (nodes[j] && - fdtdec_get_is_enabled(blob, nodes[j])) + fdtdec_get_is_enabled(blob, nodes[j])) break; /* Have we run out of nodes to add? */ @@ -638,7 +641,8 @@ int fdtdec_lookup_phandle(const void *blob, int node, const char *prop_name) * @return pointer to cell, which is only valid if err == 0 */ static const void *get_prop_check_min_len(const void *blob, int node, - const char *prop_name, int min_len, int *err) + const char *prop_name, int min_len, + int *err) { const void *cell; int len; @@ -655,7 +659,7 @@ static const void *get_prop_check_min_len(const void *blob, int node, } int fdtdec_get_int_array(const void *blob, int node, const char *prop_name, - u32 *array, int count) + u32 *array, int count) { const u32 *cell; int i, err = 0; @@ -847,7 +851,7 @@ int fdtdec_get_child_count(const void *blob, int node) } int fdtdec_get_byte_array(const void *blob, int node, const char *prop_name, - u8 *array, int count) + u8 *array, int count) { const u8 *cell; int err; @@ -859,7 +863,7 @@ int fdtdec_get_byte_array(const void *blob, int node, const char *prop_name, } const u8 *fdtdec_locate_byte_array(const void *blob, int node, - const char *prop_name, int count) + const char *prop_name, int count) { const u8 *cell; int err; @@ -871,7 +875,7 @@ const u8 *fdtdec_locate_byte_array(const void *blob, int node, } int fdtdec_get_config_int(const void *blob, const char *prop_name, - int default_val) + int default_val) { int config_node; From patchwork Fri Sep 29 12:51:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819947 X-Patchwork-Delegate: wd@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 3y3XWY3rVxz9rxj for ; Fri, 29 Sep 2017 23:31:05 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 31921C21E33; Fri, 29 Sep 2017 12:56: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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 D5545C21E57; Fri, 29 Sep 2017 12:53:29 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 76FCEC21DC3; Fri, 29 Sep 2017 12:53:04 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 671F2C21DB2 for ; Fri, 29 Sep 2017 12:53:02 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxumr-00004w-Gu; Fri, 29 Sep 2017 14:53:01 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:24 +0200 Message-Id: <20170929125238.26226-6-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 006/080] lib: fdtdec: Fix some style violations 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" Fix some style violations in fdtdec.c, and reduce the scope of some variables. Signed-off-by: Mario Six Reviewed-by: Simon Glass --- lib/fdtdec.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/lib/fdtdec.c b/lib/fdtdec.c index f354a1f9af..b291c155a9 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -230,10 +230,10 @@ int fdtdec_get_pci_addr(const void *blob, int node, enum fdt_pci_space type, addr->phys_mid = fdt32_to_cpu(cell[1]); addr->phys_lo = fdt32_to_cpu(cell[1]); break; - } else { - cell += (FDT_PCI_ADDR_CELLS + - FDT_PCI_SIZE_CELLS); } + + cell += (FDT_PCI_ADDR_CELLS + + FDT_PCI_SIZE_CELLS); } if (i == num) { @@ -242,10 +242,10 @@ int fdtdec_get_pci_addr(const void *blob, int node, enum fdt_pci_space type, } return 0; - } else { - ret = -EINVAL; } + ret = -EINVAL; + fail: debug("(not found)\n"); return ret; @@ -262,11 +262,9 @@ int fdtdec_get_pci_vendev(const void *blob, int node, u16 *vendor, u16 *device) end = list + len; while (list < end) { - char *s; - len = strlen(list); if (len >= strlen("pciVVVV,DDDD")) { - s = strstr(list, "pci"); + char *s = strstr(list, "pci"); /* * check if the string is something like pciVVVV,DDDD.RR @@ -296,7 +294,7 @@ int fdtdec_get_pci_bar32(struct udevice *dev, struct fdt_pci_addr *addr, /* extract the bar number from fdt_pci_addr */ barnum = addr->phys_hi & 0xff; - if ((barnum < PCI_BASE_ADDRESS_0) || (barnum > PCI_CARDBUS_CIS)) + if (barnum < PCI_BASE_ADDRESS_0 || barnum > PCI_CARDBUS_CIS) return -EINVAL; barnum = (barnum - PCI_BASE_ADDRESS_0) / 4; @@ -332,7 +330,7 @@ int fdtdec_get_is_enabled(const void *blob, int node) */ cell = fdt_getprop(blob, node, "status", NULL); if (cell) - return 0 == strcmp(cell, "okay"); + return strcmp(cell, "okay") == 0; return 1; } @@ -342,8 +340,8 @@ enum fdt_compat_id fdtdec_lookup(const void *blob, int node) /* Search our drivers */ for (id = COMPAT_UNKNOWN; id < COMPAT_COUNT; id++) - if (0 == fdt_node_check_compatible(blob, node, - compat_names[id])) + if (fdt_node_check_compatible(blob, node, + compat_names[id]) == 0) return id; return COMPAT_UNKNOWN; } @@ -662,12 +660,14 @@ int fdtdec_get_int_array(const void *blob, int node, const char *prop_name, u32 *array, int count) { const u32 *cell; - int i, err = 0; + int err = 0; debug("%s: %s\n", __func__, prop_name); cell = get_prop_check_min_len(blob, node, prop_name, sizeof(u32) * count, &err); if (!err) { + int i; + for (i = 0; i < count; i++) array[i] = fdt32_to_cpu(cell[i]); } @@ -972,7 +972,8 @@ int fdt_get_resource(const void *fdt, int node, const char *property, while (ptr + na + ns <= end) { if (i == index) { - res->start = res->end = fdtdec_get_number(ptr, na); + res->start = fdtdec_get_number(ptr, na); + res->end = res->start; res->end += fdtdec_get_number(&ptr[na], ns) - 1; return 0; } @@ -1224,7 +1225,7 @@ int fdtdec_setup(void) # elif defined CONFIG_FIT_EMBED gd->fdt_blob = locate_dtb_in_fit(&_end); - if (gd->fdt_blob == NULL || gd->fdt_blob <= ((void *)&_end)) { + if (!gd->fdt_blob || gd->fdt_blob <= ((void *)&_end)) { puts("Failed to find proper dtb in embedded FIT Image\n"); return -1; } From patchwork Fri Sep 29 12:51:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819906 X-Patchwork-Delegate: wd@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 3y3WxV6fT9z9ryk for ; Fri, 29 Sep 2017 23:05:02 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 4BA80C21EB4; Fri, 29 Sep 2017 12:57:50 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 C1D45C21E71; Fri, 29 Sep 2017 12:53:34 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id DC4E9C21E1E; Fri, 29 Sep 2017 12:53:04 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 4D593C21DF3 for ; Fri, 29 Sep 2017 12:53:02 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxumr-00004w-LA; Fri, 29 Sep 2017 14:53:01 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:25 +0200 Message-Id: <20170929125238.26226-7-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 007/080] core: ofnode: Fix style violations 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" There are some style violations in ofnode.c; fix those. Signed-off-by: Mario Six Reviewed-by: Simon Glass --- drivers/core/ofnode.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index c6ca13fabf..a59e40aa97 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -296,7 +296,8 @@ int ofnode_parse_phandle_with_args(ofnode node, const char *list_name, int ret; ret = of_parse_phandle_with_args(ofnode_to_np(node), - list_name, cells_name, index, &args); + list_name, cells_name, index, + &args); if (ret) return ret; ofnode_from_of_phandle_args(&args, out_args); @@ -305,8 +306,9 @@ int ofnode_parse_phandle_with_args(ofnode node, const char *list_name, int ret; ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, - ofnode_to_offset(node), list_name, cells_name, - cell_count, index, &args); + ofnode_to_offset(node), + list_name, cells_name, + cell_count, index, &args); if (ret) return ret; ofnode_from_fdtdec_phandle_args(&args, out_args); @@ -532,10 +534,10 @@ int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type, addr->phys_mid = fdt32_to_cpu(cell[1]); addr->phys_lo = fdt32_to_cpu(cell[1]); break; - } else { - cell += (FDT_PCI_ADDR_CELLS + - FDT_PCI_SIZE_CELLS); } + + cell += (FDT_PCI_ADDR_CELLS + + FDT_PCI_SIZE_CELLS); } if (i == num) { @@ -544,10 +546,10 @@ int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type, } return 0; - } else { - ret = -EINVAL; } + ret = -EINVAL; + fail: debug("(not found)\n"); return ret; From patchwork Fri Sep 29 12:51:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819908 X-Patchwork-Delegate: wd@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 3y3WzF2SMpz9ryk for ; Fri, 29 Sep 2017 23:06:33 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id D6F66C21D9E; Fri, 29 Sep 2017 12:56:56 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 15F7DC21E5D; Fri, 29 Sep 2017 12:53:31 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id AC0ADC21DEF; Fri, 29 Sep 2017 12:53:04 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 3A42FC21DE6 for ; Fri, 29 Sep 2017 12:53:02 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxumr-00004w-PN; Fri, 29 Sep 2017 14:53:01 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:26 +0200 Message-Id: <20170929125238.26226-8-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 008/080] core: read: Fix style violations 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" There are some whitespace-related style violations in read.c; fix those. Signed-off-by: Mario Six Reviewed-by: Simon Glass --- drivers/core/read.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/core/read.c b/drivers/core/read.c index eacf1716fd..2766d228a6 100644 --- a/drivers/core/read.c +++ b/drivers/core/read.c @@ -65,7 +65,7 @@ void *dev_read_addr_ptr(struct udevice *dev) } fdt_addr_t dev_read_addr_size(struct udevice *dev, const char *property, - fdt_size_t *sizep) + fdt_size_t *sizep) { return ofnode_get_addr_size(dev_ofnode(dev), property, sizep); } @@ -76,7 +76,7 @@ const char *dev_read_name(struct udevice *dev) } int dev_read_stringlist_search(struct udevice *dev, const char *property, - const char *string) + const char *string) { return ofnode_stringlist_search(dev_ofnode(dev), property, string); } @@ -93,9 +93,8 @@ int dev_read_string_count(struct udevice *dev, const char *propname) } int dev_read_phandle_with_args(struct udevice *dev, const char *list_name, - const char *cells_name, int cell_count, - int index, - struct ofnode_phandle_args *out_args) + const char *cells_name, int cell_count, + int index, struct ofnode_phandle_args *out_args) { return ofnode_parse_phandle_with_args(dev_ofnode(dev), list_name, cells_name, cell_count, index, From patchwork Fri Sep 29 12:51:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819909 X-Patchwork-Delegate: wd@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 3y3Wzc1B3Cz9ryk for ; Fri, 29 Sep 2017 23:06:52 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id CA6F7C21DCA; Fri, 29 Sep 2017 13:00: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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 3DFB8C21E51; Fri, 29 Sep 2017 12:53:53 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C99DDC21E26; Fri, 29 Sep 2017 12:53:04 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 6E2FDC21DF4 for ; Fri, 29 Sep 2017 12:53:02 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxumr-00004w-Tg; Fri, 29 Sep 2017 14:53:01 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:27 +0200 Message-Id: <20170929125238.26226-9-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 009/080] core: Add {ofnode, dev}_translate_address functions 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" Signed-off-by: Mario Six Reviewed-by: Simon Glass --- drivers/core/ofnode.c | 8 ++++++++ drivers/core/read.c | 5 +++++ include/dm/ofnode.h | 13 +++++++++++++ include/dm/read.h | 17 +++++++++++++++++ 4 files changed, 43 insertions(+) diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index a59e40aa97..7f2c98614e 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -642,3 +642,11 @@ int ofnode_read_resource_byname(ofnode node, const char *name, return ofnode_read_resource(node, index, res); } + +u64 ofnode_translate_address(ofnode node, const fdt32_t *in_addr) +{ + if (ofnode_is_np(node)) + return of_translate_address(ofnode_to_np(node), in_addr); + else + return fdt_translate_address(gd->fdt_blob, ofnode_to_offset(node), in_addr); +} diff --git a/drivers/core/read.c b/drivers/core/read.c index 2766d228a6..f35ff57246 100644 --- a/drivers/core/read.c +++ b/drivers/core/read.c @@ -187,3 +187,8 @@ int dev_read_resource_byname(struct udevice *dev, const char *name, { return ofnode_read_resource_byname(dev_ofnode(dev), name, res); } + +u64 dev_translate_address(struct udevice *dev, const fdt32_t *in_addr) +{ + return ofnode_translate_address(dev_ofnode(dev), in_addr); +} diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index 79374b8f91..92ffeebf16 100644 --- a/include/dm/ofnode.h +++ b/include/dm/ofnode.h @@ -652,4 +652,17 @@ int ofnode_read_resource_byname(ofnode node, const char *name, ofnode_valid(node); \ node = ofnode_next_subnode(node)) +/** + * ofnode_translate_address() - Tranlate a device-tree address + * + * Translate an address from the device-tree into a CPU physical address. This + * function walks up the tree and applies the various bus mappings along the + * way. + * + * @ofnode: Device tree node giving the context in which to translate the + * address + * @in_addr: pointer to the address to translate + * @return the translated address; OF_BAD_ADDR on error + */ +u64 ofnode_translate_address(ofnode node, const fdt32_t *in_addr); #endif diff --git a/include/dm/read.h b/include/dm/read.h index d2f47a678f..d88a6c547e 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -410,6 +410,18 @@ int dev_read_resource(struct udevice *dev, uint index, struct resource *res); int dev_read_resource_byname(struct udevice *dev, const char *name, struct resource *res); +/** + * dev_translate_address() - Tranlate a device-tree address + * + * Translate an address from the device-tree into a CPU physical address. This + * function walks up the tree and applies the various bus mappings along the + * way. + * + * @dev: device giving the context in which to translate the address + * @in_addr: pointer to the address to translate + * @return the translated address; OF_BAD_ADDR on error + */ +u64 dev_translate_address(struct udevice *dev, const fdt32_t *in_addr); #else /* CONFIG_DM_DEV_READ_INLINE is enabled */ static inline int dev_read_u32_default(struct udevice *dev, @@ -582,6 +594,11 @@ static inline int dev_read_resource_byname(struct udevice *dev, return ofnode_read_resource_byname(dev_ofnode(dev), name, res); } +static inline u64 dev_translate_address(struct udevice *dev, const fdt32_t *in_addr) +{ + return ofnode_translate_address(dev_ofnode(dev), in_addr); +} + #endif /* CONFIG_DM_DEV_READ_INLINE */ /** From patchwork Fri Sep 29 12:51:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819920 X-Patchwork-Delegate: wd@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 3y3X8F6Shbz9t2Q for ; Fri, 29 Sep 2017 23:14:21 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 879CAC21DCE; Fri, 29 Sep 2017 12:59:51 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 ABFF9C21EBD; Fri, 29 Sep 2017 12:53:48 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6081AC21E3B; Fri, 29 Sep 2017 12:53:04 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id D1687C21DC1 for ; Fri, 29 Sep 2017 12:53:02 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxums-00004w-1c; Fri, 29 Sep 2017 14:53:02 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:28 +0200 Message-Id: <20170929125238.26226-10-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 010/080] core: Make device_is_compatible live-tree compatible 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" Judging from its name and parameters, device_is_compatible looks like it is compatible with a live device tree, but it actually isn't. Make is compatible with a live device tree. Signed-off-by: Mario Six Reviewed-by: Simon Glass --- drivers/core/device.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/core/device.c b/drivers/core/device.c index 5463d1ffa5..23de6a6246 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -702,8 +703,12 @@ int device_set_name(struct udevice *dev, const char *name) bool device_is_compatible(struct udevice *dev, const char *compat) { const void *fdt = gd->fdt_blob; + ofnode node = dev_ofnode(dev); - return !fdt_node_check_compatible(fdt, dev_of_offset(dev), compat); + if (ofnode_is_np(node)) + return of_device_is_compatible(ofnode_to_np(node), compat, NULL, NULL); + else + return !fdt_node_check_compatible(fdt, ofnode_to_offset(node), compat); } bool of_machine_is_compatible(const char *compat) From patchwork Fri Sep 29 12:51:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819913 X-Patchwork-Delegate: wd@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 3y3X1w1bTyz9t2Q for ; Fri, 29 Sep 2017 23:08:50 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 16E8DC21DCE; Fri, 29 Sep 2017 12:55: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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 6ED35C21E41; Fri, 29 Sep 2017 12:53:27 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B5279C21D9E; Fri, 29 Sep 2017 12:53:04 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id BCCD2C21DA0 for ; Fri, 29 Sep 2017 12:53:02 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxums-00004w-7G; Fri, 29 Sep 2017 14:53:02 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:29 +0200 Message-Id: <20170929125238.26226-11-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 011/080] clk: clk-uclass: Fix style violations 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" checkpatch.pl complains that the clk_ops structures used in clk-uclass.c ought to be static, so we mark them as static. Signed-off-by: Mario Six Reviewed-by: Simon Glass --- drivers/clk/clk-uclass.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index 83ba13374c..32be2e85c5 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -15,9 +15,9 @@ DECLARE_GLOBAL_DATA_PTR; -static inline struct clk_ops *clk_dev_ops(struct udevice *dev) +static inline const struct clk_ops *clk_dev_ops(struct udevice *dev) { - return (struct clk_ops *)dev->driver->ops; + return (const struct clk_ops *)dev->driver->ops; } #if CONFIG_IS_ENABLED(OF_CONTROL) @@ -60,7 +60,7 @@ int clk_get_by_index(struct udevice *dev, int index, struct clk *clk) int ret; struct ofnode_phandle_args args; struct udevice *dev_clk; - struct clk_ops *ops; + const struct clk_ops *ops; debug("%s(dev=%p, index=%d, clk=%p)\n", __func__, dev, index, clk); @@ -68,7 +68,7 @@ int clk_get_by_index(struct udevice *dev, int index, struct clk *clk) clk->dev = NULL; ret = dev_read_phandle_with_args(dev, "clocks", "#clock-cells", 0, - index, &args); + index, &args); if (ret) { debug("%s: fdtdec_parse_phandle_with_args failed: err=%d\n", __func__, ret); @@ -142,7 +142,7 @@ int clk_release_all(struct clk *clk, int count) int clk_request(struct udevice *dev, struct clk *clk) { - struct clk_ops *ops = clk_dev_ops(dev); + const struct clk_ops *ops = clk_dev_ops(dev); debug("%s(dev=%p, clk=%p)\n", __func__, dev, clk); @@ -156,7 +156,7 @@ int clk_request(struct udevice *dev, struct clk *clk) int clk_free(struct clk *clk) { - struct clk_ops *ops = clk_dev_ops(clk->dev); + const struct clk_ops *ops = clk_dev_ops(clk->dev); debug("%s(clk=%p)\n", __func__, clk); @@ -168,7 +168,7 @@ int clk_free(struct clk *clk) ulong clk_get_rate(struct clk *clk) { - struct clk_ops *ops = clk_dev_ops(clk->dev); + const struct clk_ops *ops = clk_dev_ops(clk->dev); debug("%s(clk=%p)\n", __func__, clk); @@ -180,7 +180,7 @@ ulong clk_get_rate(struct clk *clk) ulong clk_set_rate(struct clk *clk, ulong rate) { - struct clk_ops *ops = clk_dev_ops(clk->dev); + const struct clk_ops *ops = clk_dev_ops(clk->dev); debug("%s(clk=%p, rate=%lu)\n", __func__, clk, rate); @@ -192,7 +192,7 @@ ulong clk_set_rate(struct clk *clk, ulong rate) int clk_enable(struct clk *clk) { - struct clk_ops *ops = clk_dev_ops(clk->dev); + const struct clk_ops *ops = clk_dev_ops(clk->dev); debug("%s(clk=%p)\n", __func__, clk); @@ -204,7 +204,7 @@ int clk_enable(struct clk *clk) int clk_disable(struct clk *clk) { - struct clk_ops *ops = clk_dev_ops(clk->dev); + const struct clk_ops *ops = clk_dev_ops(clk->dev); debug("%s(clk=%p)\n", __func__, clk); From patchwork Fri Sep 29 12:51:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819899 X-Patchwork-Delegate: wd@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 3y3Wrl5SL9z9t33 for ; Fri, 29 Sep 2017 23:00:55 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 5D24CC21DA1; Fri, 29 Sep 2017 12:59:00 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 55690C21E5A; Fri, 29 Sep 2017 12:53:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C1D00C21E2F; Fri, 29 Sep 2017 12:53:04 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id BFFE8C21E09 for ; Fri, 29 Sep 2017 12:53:02 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxums-00004w-Bt; Fri, 29 Sep 2017 14:53:02 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:30 +0200 Message-Id: <20170929125238.26226-12-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 012/080] clk: clk_fixed_rate: Fix style violation 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" Fix a mis-indented function call in clk_fixed_rate.c Signed-off-by: Mario Six Reviewed-by: Simon Glass --- drivers/clk/clk_fixed_rate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/clk/clk_fixed_rate.c b/drivers/clk/clk_fixed_rate.c index 63565b6ed8..9dd6bc5726 100644 --- a/drivers/clk/clk_fixed_rate.c +++ b/drivers/clk/clk_fixed_rate.c @@ -31,8 +31,8 @@ const struct clk_ops clk_fixed_rate_ops = { static int clk_fixed_rate_ofdata_to_platdata(struct udevice *dev) { #if !CONFIG_IS_ENABLED(OF_PLATDATA) - to_clk_fixed_rate(dev)->fixed_rate = dev_read_u32_default(dev, - "clock-frequency", 0); + to_clk_fixed_rate(dev)->fixed_rate = + dev_read_u32_default(dev, "clock-frequency", 0); #endif return 0; From patchwork Fri Sep 29 12:51:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819894 X-Patchwork-Delegate: wd@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 3y3Wlx0bBPz9t4k for ; Fri, 29 Sep 2017 22:56:44 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id BC073C21F30; Fri, 29 Sep 2017 12:56:10 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 AA63CC21E4A; Fri, 29 Sep 2017 12:53:28 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0A6D8C21DB2; Fri, 29 Sep 2017 12:53:04 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 0C1B8C21DC8 for ; Fri, 29 Sep 2017 12:53:03 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxums-00004w-HP; Fri, 29 Sep 2017 14:53:02 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:31 +0200 Message-Id: <20170929125238.26226-13-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 013/080] clk: Remove superfluous gd declarations 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 clk uclass was converted to support a live device tree recently, hence the global data pointer declarations are no longer needed. Signed-off-by: Mario Six Reviewed-by: Simon Glass --- drivers/clk/clk-uclass.c | 2 -- drivers/clk/clk_fixed_rate.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index 32be2e85c5..fbea72091b 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -13,8 +13,6 @@ #include #include -DECLARE_GLOBAL_DATA_PTR; - static inline const struct clk_ops *clk_dev_ops(struct udevice *dev) { return (const struct clk_ops *)dev->driver->ops; diff --git a/drivers/clk/clk_fixed_rate.c b/drivers/clk/clk_fixed_rate.c index 9dd6bc5726..c9a9f0a20b 100644 --- a/drivers/clk/clk_fixed_rate.c +++ b/drivers/clk/clk_fixed_rate.c @@ -8,8 +8,6 @@ #include #include -DECLARE_GLOBAL_DATA_PTR; - struct clk_fixed_rate { unsigned long fixed_rate; }; From patchwork Fri Sep 29 12:51:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819893 X-Patchwork-Delegate: wd@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 3y3Wl33yVQz9t33 for ; Fri, 29 Sep 2017 22:55:59 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 4BA47C21DC1; Fri, 29 Sep 2017 12:53:43 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 93A7DC21DB2; Fri, 29 Sep 2017 12:53:19 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id F34F1C21DE6; Fri, 29 Sep 2017 12:53:04 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 3BAA5C21DA4 for ; Fri, 29 Sep 2017 12:53:03 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxums-00004w-Mq; Fri, 29 Sep 2017 14:53:02 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:32 +0200 Message-Id: <20170929125238.26226-14-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 014/080] spi: Fix style violation and improve code 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 patch fixes a printf specifier style violation, reduces the scope of a variable, and turns a void pointer that is used with pointer arithmetic into a u8 pointer. Signed-off-by: Mario Six --- drivers/spi/spi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 7d81fbd7f8..dea8dcda5b 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -12,7 +12,7 @@ int spi_set_wordlen(struct spi_slave *slave, unsigned int wordlen) { if (wordlen == 0 || wordlen > 32) { - printf("spi: invalid wordlen %d\n", wordlen); + printf("spi: invalid wordlen %u\n", wordlen); return -1; } @@ -24,11 +24,12 @@ int spi_set_wordlen(struct spi_slave *slave, unsigned int wordlen) void *spi_do_alloc_slave(int offset, int size, unsigned int bus, unsigned int cs) { - struct spi_slave *slave; - void *ptr; + u8 *ptr; ptr = malloc(size); if (ptr) { + struct spi_slave *slave; + memset(ptr, '\0', size); slave = (struct spi_slave *)(ptr + offset); slave->bus = bus; From patchwork Fri Sep 29 12:51:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819961 X-Patchwork-Delegate: wd@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 3y3XfG2t3Gz9t2x for ; Fri, 29 Sep 2017 23:36:54 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 13BAFC21E90; Fri, 29 Sep 2017 13:02:11 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 95049C21E13; Fri, 29 Sep 2017 12:54:10 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 70C4AC21E52; Fri, 29 Sep 2017 12:53:04 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 5BA72C21E11 for ; Fri, 29 Sep 2017 12:53:03 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxums-00004w-TN; Fri, 29 Sep 2017 14:53:02 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:33 +0200 Message-Id: <20170929125238.26226-15-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 015/080] spi: Remove obsolete spi_base_setup_slave_fdt 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" 0efc024 ("spi_flash: Add spi_flash_probe_fdt() to locate SPI by FDT node") added a helper function spi_base_setup_slave_fdt to to set up a SPI slave from a given FDT blob. The only user was the exynos SPI driver. But commit 73186c9 ("dm: exynos: Convert SPI to driver model") removed the use of this function, hence rendering it obsolete. Remove this function, as well as the CONFIG_OF_SPI option, which guarded only this function. Signed-off-by: Mario Six Reviewed-by: Simon Glass Reviewed-by: Jagan Teki --- drivers/spi/spi.c | 20 -------------------- include/spi.h | 14 -------------- scripts/config_whitelist.txt | 1 - 3 files changed, 35 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index dea8dcda5b..45e73d28e4 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -39,23 +39,3 @@ void *spi_do_alloc_slave(int offset, int size, unsigned int bus, return ptr; } - -#ifdef CONFIG_OF_SPI -struct spi_slave *spi_base_setup_slave_fdt(const void *blob, int busnum, - int node) -{ - int cs, max_hz, mode = 0; - - cs = fdtdec_get_int(blob, node, "reg", -1); - max_hz = fdtdec_get_int(blob, node, "spi-max-frequency", 100000); - if (fdtdec_get_bool(blob, node, "spi-cpol")) - mode |= SPI_CPOL; - if (fdtdec_get_bool(blob, node, "spi-cpha")) - mode |= SPI_CPHA; - if (fdtdec_get_bool(blob, node, "spi-cs-high")) - mode |= SPI_CS_HIGH; - if (fdtdec_get_bool(blob, node, "spi-half-duplex")) - mode |= SPI_PREAMBLE; - return spi_setup_slave(busnum, cs, max_hz, mode); -} -#endif diff --git a/include/spi.h b/include/spi.h index 8c4b882c54..9c69cd7e87 100644 --- a/include/spi.h +++ b/include/spi.h @@ -328,20 +328,6 @@ static inline int spi_w8r8(struct spi_slave *slave, unsigned char byte) */ struct spi_slave *spi_setup_slave_fdt(const void *blob, int slave_node, int spi_node); - -/** - * spi_base_setup_slave_fdt() - helper function to set up a SPI slace - * - * This decodes SPI properties from the slave node to determine the - * chip select and SPI parameters. - * - * @blob: Device tree blob - * @busnum: Bus number to use - * @node: Device tree node for the SPI bus - */ -struct spi_slave *spi_base_setup_slave_fdt(const void *blob, int busnum, - int node); - #ifdef CONFIG_DM_SPI /** diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index db5d88b4b5..0dbe8986a6 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -1614,7 +1614,6 @@ CONFIG_NUM_PAMU CONFIG_ODROID_REV_AIN CONFIG_OFF_PADCONF CONFIG_OF_ -CONFIG_OF_SPI CONFIG_OF_SPI_FLASH CONFIG_OF_STDOUT_PATH CONFIG_OMAP_EHCI_PHY1_RESET_GPIO From patchwork Fri Sep 29 12:51:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819898 X-Patchwork-Delegate: wd@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 3y3Wr30Jfcz9t4g for ; Fri, 29 Sep 2017 23:00:18 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id AC5A8C21DA1; Fri, 29 Sep 2017 12:54:25 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 11127C21E24; Fri, 29 Sep 2017 12:53:22 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3821CC21DD7; Fri, 29 Sep 2017 12:53:05 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 77362C21E13 for ; Fri, 29 Sep 2017 12:53:03 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxumt-00004w-1d; Fri, 29 Sep 2017 14:53:03 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:34 +0200 Message-Id: <20170929125238.26226-16-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 016/080] spi: Remove spi_flash_probe_fdt 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" Commit ba45756 ("dm: x86: spi: Convert ICH SPI driver to driver model") removed the last usage of the spi_flash_probe_fdt function, rendering it obsolete. This patch removes the function. Signed-off-by: Mario Six Reviewed-by: Simon Glass Reviewed-by: Jagan Teki --- drivers/mtd/spi/sf_probe.c | 13 ------------- include/spi_flash.h | 12 ------------ 2 files changed, 25 deletions(-) diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c index 7b296378d2..e25513b77a 100644 --- a/drivers/mtd/spi/sf_probe.c +++ b/drivers/mtd/spi/sf_probe.c @@ -87,19 +87,6 @@ struct spi_flash *spi_flash_probe(unsigned int busnum, unsigned int cs, return spi_flash_probe_tail(bus); } -#ifdef CONFIG_OF_SPI_FLASH -struct spi_flash *spi_flash_probe_fdt(const void *blob, int slave_node, - int spi_node) -{ - struct spi_slave *bus; - - bus = spi_setup_slave_fdt(blob, slave_node, spi_node); - if (!bus) - return NULL; - return spi_flash_probe_tail(bus); -} -#endif - void spi_flash_free(struct spi_flash *flash) { #ifdef CONFIG_SPI_FLASH_MTD diff --git a/include/spi_flash.h b/include/spi_flash.h index be2fe3f84c..f3c4e83424 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -194,18 +194,6 @@ void sandbox_sf_unbind_emul(struct sandbox_state *state, int busnum, int cs); struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs, unsigned int max_hz, unsigned int spi_mode); -/** - * Set up a new SPI flash from an fdt node - * - * @param blob Device tree blob - * @param slave_node Pointer to this SPI slave node in the device tree - * @param spi_node Cached pointer to the SPI interface this node belongs - * to - * @return 0 if ok, -1 on error - */ -struct spi_flash *spi_flash_probe_fdt(const void *blob, int slave_node, - int spi_node); - void spi_flash_free(struct spi_flash *flash); static inline int spi_flash_read(struct spi_flash *flash, u32 offset, From patchwork Fri Sep 29 12:51:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819895 X-Patchwork-Delegate: wd@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 3y3Wmm0qh0z9t33 for ; Fri, 29 Sep 2017 22:57:28 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id B041CC21F30; Fri, 29 Sep 2017 12:55:29 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 E156AC21DC6; Fri, 29 Sep 2017 12:53:25 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 8D2E6C21DDD; Fri, 29 Sep 2017 12:53:05 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 62185C21DE4 for ; Fri, 29 Sep 2017 12:53:04 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxumt-00004w-6O; Fri, 29 Sep 2017 14:53:03 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:35 +0200 Message-Id: <20170929125238.26226-17-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 017/080] spi: Remove spi_setup_slave_fdt 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" A previous patch removed the spi_flash_probe_fdt function, which contained the last call of the spi_setup_slave_fdt function, which is now equally obsolete. This patch removes the function. Signed-off-by: Mario Six Reviewed-by: Simon Glass Reviewed-by: Jagan Teki --- drivers/spi/spi-uclass.c | 16 ---------------- include/spi.h | 13 ------------- 2 files changed, 29 deletions(-) diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c index e06a603ab1..6db0eb02b4 100644 --- a/drivers/spi/spi-uclass.c +++ b/drivers/spi/spi-uclass.c @@ -348,22 +348,6 @@ err: } /* Compatibility function - to be removed */ -struct spi_slave *spi_setup_slave_fdt(const void *blob, int node, - int bus_node) -{ - struct udevice *bus, *dev; - int ret; - - ret = uclass_get_device_by_of_offset(UCLASS_SPI, bus_node, &bus); - if (ret) - return NULL; - ret = device_get_child_by_of_offset(bus, node, &dev); - if (ret) - return NULL; - return dev_get_parent_priv(dev); -} - -/* Compatibility function - to be removed */ struct spi_slave *spi_setup_slave(unsigned int busnum, unsigned int cs, unsigned int speed, unsigned int mode) { diff --git a/include/spi.h b/include/spi.h index 9c69cd7e87..ebaf2e5f3a 100644 --- a/include/spi.h +++ b/include/spi.h @@ -315,19 +315,6 @@ static inline int spi_w8r8(struct spi_slave *slave, unsigned char byte) return ret < 0 ? ret : din[1]; } -/** - * Set up a SPI slave for a particular device tree node - * - * This calls spi_setup_slave() with the correct bus number. Call - * spi_free_slave() to free it later. - * - * @param blob: Device tree blob - * @param slave_node: Slave node to use - * @param spi_node: SPI peripheral node to use - * @return pointer to new spi_slave structure - */ -struct spi_slave *spi_setup_slave_fdt(const void *blob, int slave_node, - int spi_node); #ifdef CONFIG_DM_SPI /** From patchwork Fri Sep 29 12:51:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819900 X-Patchwork-Delegate: wd@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 3y3WtL4Y7sz9t4k for ; Fri, 29 Sep 2017 23:02:18 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 5A4CAC21EBB; Fri, 29 Sep 2017 13:00:25 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 47997C21EC1; Fri, 29 Sep 2017 12:53:51 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 971EBC21E43; Fri, 29 Sep 2017 12:53:04 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 0612CC21E16 for ; Fri, 29 Sep 2017 12:53:04 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxumt-00004w-Ae; Fri, 29 Sep 2017 14:53:03 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:36 +0200 Message-Id: <20170929125238.26226-18-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 018/080] spi: Remove CONFIG_OF_SPI_FLASH 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" Previous patches removed the last usages of this config variable, so that it is now obsolete. This patch removes it from the whitelist. Signed-off-by: Mario Six Reviewed-by: Simon Glass Reviewed-by: Jagan Teki --- scripts/config_whitelist.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 0dbe8986a6..f8236beef5 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -1614,7 +1614,6 @@ CONFIG_NUM_PAMU CONFIG_ODROID_REV_AIN CONFIG_OFF_PADCONF CONFIG_OF_ -CONFIG_OF_SPI_FLASH CONFIG_OF_STDOUT_PATH CONFIG_OMAP_EHCI_PHY1_RESET_GPIO CONFIG_OMAP_EHCI_PHY2_RESET_GPIO From patchwork Fri Sep 29 12:51:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819924 X-Patchwork-Delegate: wd@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 3y3XHS4HW7z9t32 for ; Fri, 29 Sep 2017 23:20:36 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 33B1DC21E09; Fri, 29 Sep 2017 13:01:14 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 9CB0BC21ECF; Fri, 29 Sep 2017 12:53:55 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id AA86EC21E4B; Fri, 29 Sep 2017 12:53:04 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id D9171C21E0C for ; Fri, 29 Sep 2017 12:53:03 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxumt-00004w-GO; Fri, 29 Sep 2017 14:53:03 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:37 +0200 Message-Id: <20170929125238.26226-19-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 019/080] spi: sf_probe: Fix style violations 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" Fix two indention-related style violations. Signed-off-by: Mario Six --- drivers/mtd/spi/sf_probe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c index e25513b77a..68009a6328 100644 --- a/drivers/mtd/spi/sf_probe.c +++ b/drivers/mtd/spi/sf_probe.c @@ -77,7 +77,7 @@ static struct spi_flash *spi_flash_probe_tail(struct spi_slave *bus) } struct spi_flash *spi_flash_probe(unsigned int busnum, unsigned int cs, - unsigned int max_hz, unsigned int spi_mode) + unsigned int max_hz, unsigned int spi_mode) { struct spi_slave *bus; @@ -107,7 +107,7 @@ static int spi_flash_std_read(struct udevice *dev, u32 offset, size_t len, } static int spi_flash_std_write(struct udevice *dev, u32 offset, size_t len, - const void *buf) + const void *buf) { struct spi_flash *flash = dev_get_uclass_priv(dev); From patchwork Fri Sep 29 12:51:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819915 X-Patchwork-Delegate: wd@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 3y3X471V59z9t2Q for ; Fri, 29 Sep 2017 23:10:47 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 9EA47C21DB5; Fri, 29 Sep 2017 13:00:58 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 6FEE1C21EDD; Fri, 29 Sep 2017 12:53:54 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3D13EC21E48; Fri, 29 Sep 2017 12:53:05 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 1C8E0C21E21 for ; Fri, 29 Sep 2017 12:53:04 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxumt-00004w-M3; Fri, 29 Sep 2017 14:53:03 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:38 +0200 Message-Id: <20170929125238.26226-20-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 020/080] spi: spi-uclass: Fix style violations 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" Remove a superfluous newline, and reduce the scope of a variable. Signed-off-by: Mario Six Reviewed-by: Simon Glass Reviewed-by: Jagan Teki --- drivers/spi/spi-uclass.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c index 6db0eb02b4..15d90a54a1 100644 --- a/drivers/spi/spi-uclass.c +++ b/drivers/spi/spi-uclass.c @@ -50,7 +50,6 @@ int dm_spi_claim_bus(struct udevice *dev) struct dm_spi_bus *spi = dev_get_uclass_priv(bus); struct spi_slave *slave = dev_get_parent_priv(dev); int speed; - int ret; speed = slave->max_hz; if (spi->max_hz) { @@ -62,7 +61,8 @@ int dm_spi_claim_bus(struct udevice *dev) if (!speed) speed = 100000; if (speed != slave->speed) { - ret = spi_set_speed_mode(bus, speed, slave->mode); + int ret = spi_set_speed_mode(bus, speed, slave->mode); + if (ret) return ret; slave->speed = speed; @@ -129,7 +129,6 @@ static int spi_post_probe(struct udevice *bus) #if defined(CONFIG_NEEDS_MANUAL_RELOC) struct dm_spi_ops *ops = spi_get_ops(bus); - if (ops->claim_bus) ops->claim_bus += gd->reloc_off; if (ops->release_bus) From patchwork Fri Sep 29 12:51:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819965 X-Patchwork-Delegate: wd@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 3y3XhN2fV4z9rvt for ; Fri, 29 Sep 2017 23:38:44 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id D3DD4C21EC5; Fri, 29 Sep 2017 13:01:51 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 AB568C21E16; Fri, 29 Sep 2017 12:54:09 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5D851C21DF3; Fri, 29 Sep 2017 12:53:04 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 63D32C21DC3 for ; Fri, 29 Sep 2017 12:53:04 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxumt-00004w-RZ; Fri, 29 Sep 2017 14:53:03 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:39 +0200 Message-Id: <20170929125238.26226-21-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 021/080] sf_probe: Merge spi_flash_probe_tail into spi_flash_probe 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" spi_flash_probe_tail is now only called from spi_flash_probe, hence we can merge its body into spi_flash_probe. Signed-off-by: Mario Six Reviewed-by: Simon Glass --- drivers/mtd/spi/sf_probe.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c index 68009a6328..09143d7868 100644 --- a/drivers/mtd/spi/sf_probe.c +++ b/drivers/mtd/spi/sf_probe.c @@ -55,10 +55,16 @@ err_read_id: } #ifndef CONFIG_DM_SPI_FLASH -static struct spi_flash *spi_flash_probe_tail(struct spi_slave *bus) +struct spi_flash *spi_flash_probe(unsigned int busnum, unsigned int cs, + unsigned int max_hz, unsigned int spi_mode) { + struct spi_slave *bus; struct spi_flash *flash; + bus = spi_setup_slave(busnum, cs, max_hz, spi_mode); + if (!bus) + return NULL; + /* Allocate space if needed (not used by sf-uclass */ flash = calloc(1, sizeof(*flash)); if (!flash) { @@ -76,17 +82,6 @@ static struct spi_flash *spi_flash_probe_tail(struct spi_slave *bus) return flash; } -struct spi_flash *spi_flash_probe(unsigned int busnum, unsigned int cs, - unsigned int max_hz, unsigned int spi_mode) -{ - struct spi_slave *bus; - - bus = spi_setup_slave(busnum, cs, max_hz, spi_mode); - if (!bus) - return NULL; - return spi_flash_probe_tail(bus); -} - void spi_flash_free(struct spi_flash *flash) { #ifdef CONFIG_SPI_FLASH_MTD From patchwork Fri Sep 29 12:51:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819956 X-Patchwork-Delegate: wd@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 3y3XZp55sGz9t2x for ; Fri, 29 Sep 2017 23:33:54 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 62D71C21EBA; Fri, 29 Sep 2017 13:02:30 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 B7123C21EEF; Fri, 29 Sep 2017 12:54:11 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C55BDC21E52; Fri, 29 Sep 2017 12:53:05 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id A9F2BC21DF3 for ; Fri, 29 Sep 2017 12:53:04 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxumt-00004w-Vp; Fri, 29 Sep 2017 14:53:04 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:40 +0200 Message-Id: <20170929125238.26226-22-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 022/080] net: tsec: Fix style violations 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" Signed-off-by: Mario Six --- drivers/net/tsec.c | 72 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index 18e7a83d0f..aa261845f3 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -74,11 +74,11 @@ static void tsec_configure_serdes(struct tsec_private *priv) * to the register offset used for external PHY accesses */ tsec_local_mdio_write(priv->phyregs_sgmii, in_be32(&priv->regs->tbipa), - 0, TBI_ANA, TBIANA_SETTINGS); + 0, TBI_ANA, TBIANA_SETTINGS); tsec_local_mdio_write(priv->phyregs_sgmii, in_be32(&priv->regs->tbipa), - 0, TBI_TBICON, TBICON_CLK_SELECT); + 0, TBI_TBICON, TBICON_CLK_SELECT); tsec_local_mdio_write(priv->phyregs_sgmii, in_be32(&priv->regs->tbipa), - 0, TBI_CR, CONFIG_TSEC_TBICR_SETTINGS); + 0, TBI_CR, CONFIG_TSEC_TBICR_SETTINGS); } #ifdef CONFIG_MCAST_TFTP @@ -116,7 +116,7 @@ static int tsec_mcast_addr(struct udevice *dev, const u8 *mcast_mac, int set) whichbit = (result >> 24) & 0x1f; /* the 5 LSB = which bit to set */ whichreg = result >> 29; /* the 3 MSB = which reg to set it in */ - value = 1 << (31-whichbit); + value = BIT(31 - whichbit); if (set) setbits_be32(®s->hash.gaddr0 + whichreg, value); @@ -171,7 +171,6 @@ static void init_registers(struct tsec __iomem *regs) out_be32(®s->attr, ATTR_INIT_SETTINGS); out_be32(®s->attreli, ATTRELI_INIT_SETTINGS); - } /* @@ -222,8 +221,8 @@ static void adjust_link(struct tsec_private *priv, struct phy_device *phydev) out_be32(®s->maccfg2, maccfg2); printf("Speed: %d, %s duplex%s\n", phydev->speed, - (phydev->duplex) ? "full" : "half", - (phydev->port == PORT_FIBRE) ? ", fiber mode" : ""); + (phydev->duplex) ? "full" : "half", + (phydev->port == PORT_FIBRE) ? ", fiber mode" : ""); } /* @@ -240,7 +239,7 @@ 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; - uint16_t status; + u16 status; int result = 0; int i; @@ -287,7 +286,7 @@ static int tsec_recv(struct eth_device *dev) while (!(in_be16(&priv->rxbd[priv->rx_idx].status) & RXBD_EMPTY)) { int length = in_be16(&priv->rxbd[priv->rx_idx].length); - uint16_t status = in_be16(&priv->rxbd[priv->rx_idx].status); + u16 status = in_be16(&priv->rxbd[priv->rx_idx].status); uchar *packet = net_rx_packets[priv->rx_idx]; /* Send the packet up if there were no errors */ @@ -323,8 +322,8 @@ static int tsec_recv(struct udevice *dev, int flags, uchar **packetp) if (!(in_be16(&priv->rxbd[priv->rx_idx].status) & RXBD_EMPTY)) { int length = in_be16(&priv->rxbd[priv->rx_idx].length); - uint16_t status = in_be16(&priv->rxbd[priv->rx_idx].status); - uint32_t buf; + u16 status = in_be16(&priv->rxbd[priv->rx_idx].status); + u32 buf; /* Send the packet up if there were no errors */ if (!(status & RXBD_STATS)) { @@ -347,7 +346,7 @@ static int tsec_recv(struct udevice *dev, int flags, uchar **packetp) static int tsec_free_pkt(struct udevice *dev, uchar *packet, int length) { struct tsec_private *priv = (struct tsec_private *)dev->priv; - uint16_t status; + u16 status; out_be16(&priv->rxbd[priv->rx_idx].length, 0); @@ -427,7 +426,8 @@ void redundant_init(struct tsec_private *priv) clrbits_be32(®s->dmactrl, DMACTRL_GRS | DMACTRL_GTS); do { - uint16_t status; + u16 status; + tsec_send(priv->dev, (void *)pkt, sizeof(pkt)); /* Wait for buffer to be received */ @@ -478,7 +478,7 @@ void redundant_init(struct tsec_private *priv) static void startup_tsec(struct tsec_private *priv) { struct tsec __iomem *regs = priv->regs; - uint16_t status; + u16 status; int i; /* reset the indices to zero */ @@ -532,7 +532,7 @@ static void startup_tsec(struct tsec_private *priv) * This allows U-Boot to find the first active controller. */ #ifndef CONFIG_DM_ETH -static int tsec_init(struct eth_device *dev, bd_t * bd) +static int tsec_init(struct eth_device *dev, bd_t *bd) #else static int tsec_init(struct udevice *dev) #endif @@ -616,22 +616,23 @@ static phy_interface_t tsec_get_interface(struct tsec_private *priv) } if (ecntrl & ECNTRL_REDUCED_MODE) { + phy_interface_t interface; + if (ecntrl & ECNTRL_REDUCED_MII_MODE) return PHY_INTERFACE_MODE_RMII; - else { - phy_interface_t interface = priv->interface; - - /* - * This isn't autodetected, so it must - * be set by the platform code. - */ - if ((interface == PHY_INTERFACE_MODE_RGMII_ID) || - (interface == PHY_INTERFACE_MODE_RGMII_TXID) || - (interface == PHY_INTERFACE_MODE_RGMII_RXID)) - return interface; - - return PHY_INTERFACE_MODE_RGMII; - } + + interface = priv->interface; + + /* + * This isn't autodetected, so it must + * be set by the platform code. + */ + if (interface == PHY_INTERFACE_MODE_RGMII_ID || + interface == PHY_INTERFACE_MODE_RGMII_TXID || + interface == PHY_INTERFACE_MODE_RGMII_RXID) + return interface; + + return PHY_INTERFACE_MODE_RGMII; } if (priv->flags & TSEC_GIGABIT) @@ -691,16 +692,16 @@ static int tsec_initialize(bd_t *bis, struct tsec_info_struct *tsec_info) int i; struct tsec_private *priv; - dev = (struct eth_device *)malloc(sizeof *dev); + dev = (struct eth_device *)malloc(sizeof(*dev)); - if (NULL == dev) + if (!dev) return 0; - memset(dev, 0, sizeof *dev); + memset(dev, 0, sizeof(*dev)); priv = (struct tsec_private *)malloc(sizeof(*priv)); - if (NULL == priv) + if (!priv) { return 0; priv->regs = tsec_info->regs; @@ -747,10 +748,11 @@ static int tsec_initialize(bd_t *bis, struct tsec_info_struct *tsec_info) int tsec_eth_init(bd_t *bis, struct tsec_info_struct *tsecs, int num) { int i; - int ret, count = 0; + int count = 0; for (i = 0; i < num; i++) { - ret = tsec_initialize(bis, &tsecs[i]); + int ret = tsec_initialize(bis, &tsecs[i]); + if (ret > 0) count += ret; } From patchwork Fri Sep 29 12:51:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819950 X-Patchwork-Delegate: wd@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 3y3XXm0y3fz9rxj for ; Fri, 29 Sep 2017 23:32:08 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id C310AC21E0A; Fri, 29 Sep 2017 13:00:09 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 E8DB1C21EC3; Fri, 29 Sep 2017 12:53:49 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2F6F8C21E18; Fri, 29 Sep 2017 12:53:05 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 7C5CEC21DAA for ; Fri, 29 Sep 2017 12:53:04 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxumu-00004w-3o; Fri, 29 Sep 2017 14:53:04 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:41 +0200 Message-Id: <20170929125238.26226-23-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 023/080] net: tsec: Fix memory leak in error path 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" tsec_initialize allocates a private driver structure using malloc. Should the memory allocation of this private structure fail, the function execution is aborted with a return 0, but the previously allocated device structure is never freed, hence leaked. Free the device structure in the error case. Signed-off-by: Mario Six --- drivers/net/tsec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index aa261845f3..44140fb037 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -702,7 +702,9 @@ static int tsec_initialize(bd_t *bis, struct tsec_info_struct *tsec_info) priv = (struct tsec_private *)malloc(sizeof(*priv)); if (!priv) { + free(dev); return 0; + } priv->regs = tsec_info->regs; priv->phyregs_sgmii = tsec_info->miiregs_sgmii; From patchwork Fri Sep 29 12:51:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819910 X-Patchwork-Delegate: wd@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 3y3Wzc4GHmz9t4g for ; Fri, 29 Sep 2017 23:06:52 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 467E5C21EF2; Fri, 29 Sep 2017 12:59:17 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 70753C21D8D; Fri, 29 Sep 2017 12:53:46 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 03667C21DA0; Fri, 29 Sep 2017 12:53:05 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id BDBC9C21DB2 for ; Fri, 29 Sep 2017 12:53:04 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxumu-00004w-9L; Fri, 29 Sep 2017 14:53:04 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:42 +0200 Message-Id: <20170929125238.26226-24-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 024/080] net: tsec: Make live-tree compatible 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" Make the tsec ethernet driver compatible with a live device tree. Signed-off-by: Mario Six Reviewed-by: Simon Glass --- drivers/net/tsec.c | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index 44140fb037..3eb09e93b2 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -20,8 +20,6 @@ #include #include -DECLARE_GLOBAL_DATA_PTR; - #ifndef CONFIG_DM_ETH /* Default initializations for TSEC controllers. */ @@ -779,45 +777,42 @@ 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; - int offset = 0; - int reg; + struct ofnode_phandle_args phandle_args; + ofnode parent; const char *phy_mode; int ret; - pdata->iobase = (phys_addr_t)devfdt_get_addr(dev); + pdata->iobase = (phys_addr_t)dev_read_addr(dev); priv->regs = (struct tsec *)pdata->iobase; - offset = fdtdec_lookup_phandle(gd->fdt_blob, dev_of_offset(dev), - "phy-handle"); - if (offset > 0) { - reg = fdtdec_get_int(gd->fdt_blob, offset, "reg", 0); - priv->phyaddr = reg; - } else { + 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); return -ENOENT; + } else { + int reg = ofnode_read_u32_default(phandle_args.node, "reg", 0); + priv->phyaddr = reg; } - offset = fdt_parent_offset(gd->fdt_blob, offset); - if (offset > 0) { - reg = fdtdec_get_int(gd->fdt_blob, offset, "reg", 0); + parent = ofnode_get_parent(phandle_args.node); + if (ofnode_valid(parent)) { + int reg = ofnode_read_u32_default(parent, "reg", 0); priv->phyregs_sgmii = (struct tsec_mii_mng *)(reg + 0x520); } else { debug("No parent node for PHY?\n"); return -ENOENT; } - offset = fdtdec_lookup_phandle(gd->fdt_blob, dev_of_offset(dev), - "tbi-handle"); - if (offset > 0) { - reg = fdtdec_get_int(gd->fdt_blob, offset, "reg", - CONFIG_SYS_TBIPA_VALUE); - priv->tbiaddr = reg; - } else { + 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; } - phy_mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), - "phy-connection-type", NULL); + phy_mode = dev_read_prop(dev, "phy-connection-type", NULL); if (phy_mode) pdata->phy_interface = phy_get_interface_by_name(phy_mode); if (pdata->phy_interface == -1) { From patchwork Fri Sep 29 12:51:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819903 X-Patchwork-Delegate: wd@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 3y3Wtf6Zp1z9t33 for ; Fri, 29 Sep 2017 23:02:34 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id EEA9DC21E7F; Fri, 29 Sep 2017 12:58: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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 0F239C21DAB; Fri, 29 Sep 2017 12:53:43 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 71BB6C21E28; Fri, 29 Sep 2017 12:53:05 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 565F2C21DC3 for ; Fri, 29 Sep 2017 12:53:05 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxumu-00004w-Db; Fri, 29 Sep 2017 14:53:04 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:43 +0200 Message-Id: <20170929125238.26226-25-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 025/080] i2c: fsl_i2c: Fix style violations 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" Fix some style violations in the fsl_i2c I2C driver, and use shorter type names for variables in some cases. Signed-off-by: Mario Six Reviewed-by: Heiko Schocher --- drivers/i2c/fsl_i2c.c | 111 +++++++++++++++++++++++++------------------------- 1 file changed, 56 insertions(+), 55 deletions(-) -- 2.11.0 diff --git a/drivers/i2c/fsl_i2c.c b/drivers/i2c/fsl_i2c.c index ff3dc25927..d957cf6286 100644 --- a/drivers/i2c/fsl_i2c.c +++ b/drivers/i2c/fsl_i2c.c @@ -116,10 +116,10 @@ static const struct { * * The return value is the actual bus speed that is set. */ -static unsigned int set_i2c_bus_speed(const struct fsl_i2c_base *base, - unsigned int i2c_clk, unsigned int speed) +static uint set_i2c_bus_speed(const struct fsl_i2c_base *base, + uint i2c_clk, uint speed) { - unsigned short divider = min(i2c_clk / speed, (unsigned int)USHRT_MAX); + ushort divider = min(i2c_clk / speed, (uint)USHRT_MAX); /* * We want to choose an FDR/DFSR that generates an I2C bus speed that @@ -130,8 +130,8 @@ static unsigned int set_i2c_bus_speed(const struct fsl_i2c_base *base, #ifdef __PPC__ u8 dfsr, fdr = 0x31; /* Default if no FDR found */ /* a, b and dfsr matches identifiers A,B and C respectively in AN2919 */ - unsigned short a, b, ga, gb; - unsigned long c_div, est_div; + ushort a, b, ga, gb; + ulong c_div, est_div; #ifdef CONFIG_FSL_I2C_CUSTOM_DFSR dfsr = CONFIG_FSL_I2C_CUSTOM_DFSR; @@ -151,18 +151,21 @@ static unsigned int set_i2c_bus_speed(const struct fsl_i2c_base *base, for (ga = 0x4, a = 10; a <= 30; ga++, a += 2) { for (gb = 0; gb < 8; gb++) { b = 16 << gb; - c_div = b * (a + ((3*dfsr)/b)*2); - if ((c_div > divider) && (c_div < est_div)) { - unsigned short bin_gb, bin_ga; + c_div = b * (a + ((3 * dfsr) / b) * 2); + if (c_div > divider && c_div < est_div) { + ushort bin_gb, bin_ga; est_div = c_div; bin_gb = gb << 2; bin_ga = (ga & 0x3) | ((ga & 0x4) << 3); fdr = bin_gb | bin_ga; speed = i2c_clk / est_div; - debug("FDR:0x%.2x, div:%ld, ga:0x%x, gb:0x%x, " - "a:%d, b:%d, speed:%d\n", - fdr, est_div, ga, gb, a, b, speed); + + debug("FDR: 0x%.2x, ", fdr); + debug("div: %ld, ", est_div); + debug("ga: 0x%x, gb: 0x%x, ", ga, gb); + debug("a: %d, b: %d, speed: %d\n", a, b, speed); + /* Condition 2 not accounted for */ debug("Tr <= %d ns\n", (b - 3 * dfsr) * 1000000 / @@ -174,13 +177,13 @@ static unsigned int set_i2c_bus_speed(const struct fsl_i2c_base *base, if (a == 24) a += 4; } - debug("divider:%d, est_div:%ld, DFSR:%d\n", divider, est_div, dfsr); - debug("FDR:0x%.2x, speed:%d\n", fdr, speed); + debug("divider: %d, est_div: %ld, DFSR: %d\n", divider, est_div, dfsr); + debug("FDR: 0x%.2x, speed: %d\n", fdr, speed); #endif writeb(dfsr, &base->dfsrr); /* set default filter */ writeb(fdr, &base->fdr); /* set bus speed */ #else - unsigned int i; + uint i; for (i = 0; i < ARRAY_SIZE(fsl_i2c_speed_map); i++) if (fsl_i2c_speed_map[i].divider >= divider) { @@ -197,7 +200,7 @@ static unsigned int set_i2c_bus_speed(const struct fsl_i2c_base *base, } #ifndef CONFIG_DM_I2C -static unsigned int get_i2c_clock(int bus) +static uint get_i2c_clock(int bus) { if (bus) return gd->arch.i2c2_clk; /* I2C2 clock */ @@ -211,10 +214,11 @@ static int fsl_i2c_fixup(const struct fsl_i2c_base *base) const unsigned long long timeout = usec2ticks(CONFIG_I2C_MBB_TIMEOUT); unsigned long long timeval = 0; int ret = -1; - unsigned int flags = 0; + uint flags = 0; #ifdef CONFIG_SYS_FSL_ERRATUM_I2C_A004447 - unsigned int svr = get_svr(); + uint svr = get_svr(); + if ((SVR_SOC_VER(svr) == SVR_8548 && IS_SVR_REV(svr, 3, 1)) || (SVR_REV(svr) <= CONFIG_SYS_FSL_A004447_SVR_REV)) flags = I2C_CR_BIT6; @@ -263,7 +267,7 @@ static void __i2c_init(const struct fsl_i2c_base *base, int speed, int /* Call board specific i2c bus reset routine before accessing the * environment, which might be in a chip on that bus. For details * about this problem see doc/I2C_Edge_Conditions. - */ + */ i2c_init_board(); #endif writeb(0, &base->cr); /* stop I2C controller */ @@ -286,8 +290,7 @@ static void __i2c_init(const struct fsl_i2c_base *base, int speed, int } } -static int -i2c_wait4bus(const struct fsl_i2c_base *base) +static int i2c_wait4bus(const struct fsl_i2c_base *base) { unsigned long long timeval = get_ticks(); const unsigned long long timeout = usec2ticks(CONFIG_I2C_MBB_TIMEOUT); @@ -300,8 +303,7 @@ i2c_wait4bus(const struct fsl_i2c_base *base) return 0; } -static inline int -i2c_wait(const struct fsl_i2c_base *base, int write) +static inline int i2c_wait(const struct fsl_i2c_base *base, int write) { u32 csr; unsigned long long timeval = get_ticks(); @@ -317,29 +319,29 @@ i2c_wait(const struct fsl_i2c_base *base, int write) writeb(0x0, &base->sr); if (csr & I2C_SR_MAL) { - debug("i2c_wait: MAL\n"); + debug("%s: MAL\n", __func__); return -1; } if (!(csr & I2C_SR_MCF)) { - debug("i2c_wait: unfinished\n"); + debug("%s: unfinished\n", __func__); return -1; } if (write == I2C_WRITE_BIT && (csr & I2C_SR_RXAK)) { - debug("i2c_wait: No RXACK\n"); + debug("%s: No RXACK\n", __func__); return -1; } return 0; } while ((get_ticks() - timeval) < timeout); - debug("i2c_wait: timed out\n"); + debug("%s: timed out\n", __func__); return -1; } -static inline int -i2c_write_addr(const struct fsl_i2c_base *base, u8 dev, u8 dir, int rsta) +static inline int i2c_write_addr(const struct fsl_i2c_base *base, u8 dev, + u8 dir, int rsta) { writeb(I2C_CR_MEN | I2C_CR_MSTA | I2C_CR_MTX | (rsta ? I2C_CR_RSTA : 0), @@ -353,8 +355,8 @@ i2c_write_addr(const struct fsl_i2c_base *base, u8 dev, u8 dir, int rsta) return 1; } -static inline int -__i2c_write_data(const struct fsl_i2c_base *base, u8 *data, int length) +static inline int __i2c_write_data(const struct fsl_i2c_base *base, u8 *data, + int length) { int i; @@ -368,8 +370,8 @@ __i2c_write_data(const struct fsl_i2c_base *base, u8 *data, int length) return i; } -static inline int -__i2c_read_data(const struct fsl_i2c_base *base, u8 *data, int length) +static inline int __i2c_read_data(const struct fsl_i2c_base *base, u8 *data, + int length) { int i; @@ -399,9 +401,8 @@ __i2c_read_data(const struct fsl_i2c_base *base, u8 *data, int length) return i; } -static int -__i2c_read(const struct fsl_i2c_base *base, u8 chip_addr, u8 *offset, int olen, - u8 *data, int dlen) +static int __i2c_read(const struct fsl_i2c_base *base, u8 chip_addr, u8 *offset, + int olen, u8 *data, int dlen) { int ret = -1; /* signal error */ @@ -447,9 +448,8 @@ __i2c_read(const struct fsl_i2c_base *base, u8 chip_addr, u8 *offset, int olen, return -1; } -static int -__i2c_write(const struct fsl_i2c_base *base, u8 chip_addr, u8 *offset, int olen, - u8 *data, int dlen) +static int __i2c_write(const struct fsl_i2c_base *base, u8 chip_addr, + u8 *offset, int olen, u8 *data, int dlen) { int ret = -1; /* signal error */ @@ -471,10 +471,9 @@ __i2c_write(const struct fsl_i2c_base *base, u8 chip_addr, u8 *offset, int olen, return -1; } -static int -__i2c_probe_chip(const struct fsl_i2c_base *base, uchar chip) +static int __i2c_probe_chip(const struct fsl_i2c_base *base, uchar chip) { - /* For unknow reason the controller will ACK when + /* For unknown reason the controller will ACK when * probing for a slave with the same address, so skip * it. */ @@ -484,8 +483,8 @@ __i2c_probe_chip(const struct fsl_i2c_base *base, uchar chip) return __i2c_read(base, chip, 0, 0, NULL, 0); } -static unsigned int __i2c_set_bus_speed(const struct fsl_i2c_base *base, - unsigned int speed, int i2c_clk) +static uint __i2c_set_bus_speed(const struct fsl_i2c_base *base, + uint speed, int i2c_clk) { writeb(0, &base->cr); /* stop controller */ set_i2c_bus_speed(base, i2c_clk, speed); @@ -501,32 +500,30 @@ static void fsl_i2c_init(struct i2c_adapter *adap, int speed, int slaveadd) get_i2c_clock(adap->hwadapnr), adap->hwadapnr); } -static int -fsl_i2c_probe_chip(struct i2c_adapter *adap, uchar chip) +static int fsl_i2c_probe_chip(struct i2c_adapter *adap, uchar chip) { return __i2c_probe_chip(i2c_base[adap->hwadapnr], chip); } -static int -fsl_i2c_read(struct i2c_adapter *adap, u8 chip_addr, uint offset, int olen, - u8 *data, int dlen) +static int fsl_i2c_read(struct i2c_adapter *adap, u8 chip_addr, uint offset, + int olen, u8 *data, int dlen) { u8 *o = (u8 *)&offset; + return __i2c_read(i2c_base[adap->hwadapnr], chip_addr, &o[4 - olen], olen, data, dlen); } -static int -fsl_i2c_write(struct i2c_adapter *adap, u8 chip_addr, uint offset, int olen, - u8 *data, int dlen) +static int fsl_i2c_write(struct i2c_adapter *adap, u8 chip_addr, uint offset, + int olen, u8 *data, int dlen) { u8 *o = (u8 *)&offset; + return __i2c_write(i2c_base[adap->hwadapnr], chip_addr, &o[4 - olen], olen, data, dlen); } -static unsigned int fsl_i2c_set_bus_speed(struct i2c_adapter *adap, - unsigned int speed) +static uint fsl_i2c_set_bus_speed(struct i2c_adapter *adap, uint speed) { return __i2c_set_bus_speed(i2c_base[adap->hwadapnr], speed, get_i2c_clock(adap->hwadapnr)); @@ -562,12 +559,14 @@ static int fsl_i2c_probe_chip(struct udevice *bus, u32 chip_addr, u32 chip_flags) { struct fsl_i2c_dev *dev = dev_get_priv(bus); + return __i2c_probe_chip(dev->base, chip_addr); } -static int fsl_i2c_set_bus_speed(struct udevice *bus, unsigned int speed) +static int fsl_i2c_set_bus_speed(struct udevice *bus, uint speed) { struct fsl_i2c_dev *dev = dev_get_priv(bus); + return __i2c_set_bus_speed(dev->base, speed, dev->i2c_clk); } @@ -600,6 +599,7 @@ static int fsl_i2c_ofdata_to_platdata(struct udevice *bus) static int fsl_i2c_probe(struct udevice *bus) { struct fsl_i2c_dev *dev = dev_get_priv(bus); + __i2c_init(dev->base, dev->speed, dev->slaveadd, dev->i2c_clk, dev->index); return 0; @@ -613,7 +613,8 @@ static int fsl_i2c_xfer(struct udevice *bus, struct i2c_msg *msg, int nmsgs) memset(&dummy, 0, sizeof(struct i2c_msg)); /* We expect either two messages (one with an offset and one with the - * actucal data) or one message (just data) */ + * actual data) or one message (just data) + */ if (nmsgs > 2 || nmsgs == 0) { debug("%s: Only one or two messages are supported.", __func__); return -1; From patchwork Fri Sep 29 12:51:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819917 X-Patchwork-Delegate: wd@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 3y3X5n4nrzz9t2Q for ; Fri, 29 Sep 2017 23:12:13 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 68869C21E3C; Fri, 29 Sep 2017 12:55: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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 7834EC21E32; Fri, 29 Sep 2017 12:53:24 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2A948C21DA4; Fri, 29 Sep 2017 12:53:09 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 0268FC21DF3 for ; Fri, 29 Sep 2017 12:53:09 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxumy-00004w-Jt; Fri, 29 Sep 2017 14:53:08 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:44 +0200 Message-Id: <20170929125238.26226-26-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 026/080] i2c: fsl_i2c: Remove inline declarations 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" Some functions in the fsl_i2c driver are declared as inline, even though they are quite large, which needlessly increases the size of the resulting binary. This patch removes the inline declarations. Signed-off-by: Mario Six Reviewed-by: Heiko Schocher --- drivers/i2c/fsl_i2c.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/i2c/fsl_i2c.c b/drivers/i2c/fsl_i2c.c index d957cf6286..a7f3ec472f 100644 --- a/drivers/i2c/fsl_i2c.c +++ b/drivers/i2c/fsl_i2c.c @@ -303,7 +303,7 @@ static int i2c_wait4bus(const struct fsl_i2c_base *base) return 0; } -static inline int i2c_wait(const struct fsl_i2c_base *base, int write) +static int i2c_wait(const struct fsl_i2c_base *base, int write) { u32 csr; unsigned long long timeval = get_ticks(); @@ -340,8 +340,8 @@ static inline int i2c_wait(const struct fsl_i2c_base *base, int write) return -1; } -static inline int i2c_write_addr(const struct fsl_i2c_base *base, u8 dev, - u8 dir, int rsta) +static int i2c_write_addr(const struct fsl_i2c_base *base, u8 dev, + u8 dir, int rsta) { writeb(I2C_CR_MEN | I2C_CR_MSTA | I2C_CR_MTX | (rsta ? I2C_CR_RSTA : 0), @@ -355,8 +355,8 @@ static inline int i2c_write_addr(const struct fsl_i2c_base *base, u8 dev, return 1; } -static inline int __i2c_write_data(const struct fsl_i2c_base *base, u8 *data, - int length) +static int __i2c_write_data(const struct fsl_i2c_base *base, u8 *data, + int length) { int i; @@ -370,8 +370,8 @@ static inline int __i2c_write_data(const struct fsl_i2c_base *base, u8 *data, return i; } -static inline int __i2c_read_data(const struct fsl_i2c_base *base, u8 *data, - int length) +static int __i2c_read_data(const struct fsl_i2c_base *base, u8 *data, + int length) { int i; From patchwork Fri Sep 29 12:51:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819933 X-Patchwork-Delegate: wd@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 3y3XNc03VWz9t3s for ; Fri, 29 Sep 2017 23:25:03 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id AC46CC21D8D; Fri, 29 Sep 2017 12:59:34 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 72758C21EAE; Fri, 29 Sep 2017 12:53:47 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E016EC21DAA; Fri, 29 Sep 2017 12:53:09 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 1BE3CC21E09 for ; Fri, 29 Sep 2017 12:53:09 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxumy-00004w-OA; Fri, 29 Sep 2017 14:53:08 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:45 +0200 Message-Id: <20170929125238.26226-27-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 027/080] i2c: fsl_i2c: Make live-tree compatible 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" Make the fsl_i2c driver compatible with a live device tree. Signed-off-by: Mario Six Reviewed-by: Heiko Schocher --- drivers/i2c/fsl_i2c.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/i2c/fsl_i2c.c b/drivers/i2c/fsl_i2c.c index a7f3ec472f..cb0f5ea233 100644 --- a/drivers/i2c/fsl_i2c.c +++ b/drivers/i2c/fsl_i2c.c @@ -574,22 +574,18 @@ static int fsl_i2c_ofdata_to_platdata(struct udevice *bus) { struct fsl_i2c_dev *dev = dev_get_priv(bus); fdt_addr_t addr; - fdt_size_t size; - int node = dev_of_offset(bus); - addr = fdtdec_get_addr_size_auto_noparent(gd->fdt_blob, node, "reg", 0, - &size, false); + addr = dev_read_u32_default(bus, "reg", -1); - dev->base = map_sysmem(CONFIG_SYS_IMMR + addr, size); + dev->base = map_sysmem(CONFIG_SYS_IMMR + addr, sizeof(struct fsl_i2c_base)); if (!dev->base) return -ENOMEM; - dev->index = fdtdec_get_int(gd->fdt_blob, node, "cell-index", -1); - dev->slaveadd = fdtdec_get_int(gd->fdt_blob, node, - "u-boot,i2c-slave-addr", 0x7f); - dev->speed = fdtdec_get_int(gd->fdt_blob, node, "clock-frequency", - 400000); + dev->index = dev_read_u32_default(bus, "cell-index", -1); + dev->slaveadd = dev_read_u32_default(bus, "u-boot,i2c-slave-addr", + 0x7f); + dev->speed = dev_read_u32_default(bus, "clock-frequency", 400000); dev->i2c_clk = dev->index ? gd->arch.i2c2_clk : gd->arch.i2c1_clk; From patchwork Fri Sep 29 12:51:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819896 X-Patchwork-Delegate: wd@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 3y3WpP3fcRz9t4g for ; Fri, 29 Sep 2017 22:58:53 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 2F5DCC21F4E; Fri, 29 Sep 2017 12:57: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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 6DCF2C21E68; Fri, 29 Sep 2017 12:53:32 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 73A8DC21E0E; Fri, 29 Sep 2017 12:53:13 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 53DF5C21DCE for ; Fri, 29 Sep 2017 12:53:13 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxun2-00004w-SY; Fri, 29 Sep 2017 14:53:12 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:46 +0200 Message-Id: <20170929125238.26226-28-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 028/080] gpio: pca953x_gpio: Fix style violations 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" Fix some style violations in the pca953x_gpio driver. Signed-off-by: Mario Six --- drivers/gpio/pca953x_gpio.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) -- 2.11.0 diff --git a/drivers/gpio/pca953x_gpio.c b/drivers/gpio/pca953x_gpio.c index 4962f25230..9ad81fe2ba 100644 --- a/drivers/gpio/pca953x_gpio.c +++ b/drivers/gpio/pca953x_gpio.c @@ -123,7 +123,8 @@ static int pca953x_read_regs(struct udevice *dev, int reg, u8 *val) ret = dm_i2c_read(dev, reg << 1, val, info->bank_count); } else if (info->gpio_count == 40) { /* Auto increment */ - ret = dm_i2c_read(dev, (reg << 3) | 0x80, val, info->bank_count); + ret = dm_i2c_read(dev, (reg << 3) | 0x80, val, + info->bank_count); } else { dev_err(dev, "Unsupported now\n"); return -EINVAL; @@ -143,7 +144,7 @@ static int pca953x_is_output(struct udevice *dev, int offset) return !(info->reg_direction[bank] & (1 << off)); } -static int pca953x_get_value(struct udevice *dev, unsigned offset) +static int pca953x_get_value(struct udevice *dev, uint offset) { int ret; u8 val = 0; @@ -157,8 +158,7 @@ static int pca953x_get_value(struct udevice *dev, unsigned offset) return (val >> off) & 0x1; } -static int pca953x_set_value(struct udevice *dev, unsigned offset, - int value) +static int pca953x_set_value(struct udevice *dev, uint offset, int value) { struct pca953x_info *info = dev_get_platdata(dev); int bank = offset / BANK_SZ; @@ -180,7 +180,7 @@ static int pca953x_set_value(struct udevice *dev, unsigned offset, return 0; } -static int pca953x_set_direction(struct udevice *dev, unsigned offset, int dir) +static int pca953x_set_direction(struct udevice *dev, uint offset, int dir) { struct pca953x_info *info = dev_get_platdata(dev); int bank = offset / BANK_SZ; @@ -202,13 +202,12 @@ static int pca953x_set_direction(struct udevice *dev, unsigned offset, int dir) return 0; } -static int pca953x_direction_input(struct udevice *dev, unsigned offset) +static int pca953x_direction_input(struct udevice *dev, uint offset) { return pca953x_set_direction(dev, offset, PCA953X_DIRECTION_IN); } -static int pca953x_direction_output(struct udevice *dev, unsigned offset, - int value) +static int pca953x_direction_output(struct udevice *dev, uint offset, int value) { /* Configure output value. */ pca953x_set_value(dev, offset, value); @@ -219,7 +218,7 @@ static int pca953x_direction_output(struct udevice *dev, unsigned offset, return 0; } -static int pca953x_get_function(struct udevice *dev, unsigned offset) +static int pca953x_get_function(struct udevice *dev, uint offset) { if (pca953x_is_output(dev, offset)) return GPIOF_OUTPUT; @@ -231,7 +230,7 @@ static int pca953x_xlate(struct udevice *dev, struct gpio_desc *desc, struct ofnode_phandle_args *args) { desc->offset = args->args[0]; - desc->flags = args->args[1] & GPIO_ACTIVE_LOW ? GPIOD_ACTIVE_LOW : 0; + desc->flags = args->args[1] & (GPIO_ACTIVE_LOW ? GPIOD_ACTIVE_LOW : 0); return 0; } From patchwork Fri Sep 29 12:51:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819912 X-Patchwork-Delegate: wd@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 3y3X1w1fVBz9t4g for ; Fri, 29 Sep 2017 23:08:50 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 88063C21EC7; Fri, 29 Sep 2017 12:57:32 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 B4FABC21E7F; Fri, 29 Sep 2017 12:53:33 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D35E0C21DEF; Fri, 29 Sep 2017 12:53:13 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 7100DC21DA0 for ; Fri, 29 Sep 2017 12:53:13 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxun3-00004w-0V; Fri, 29 Sep 2017 14:53:13 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:47 +0200 Message-Id: <20170929125238.26226-29-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 029/080] gpio: pca953x_gpio: Make live-tree compatible 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" Make the pca953x_gpio driver compatible with a live device tree. Signed-off-by: Mario Six Reviewed-by: Simon Glass --- drivers/gpio/pca953x_gpio.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 2.11.0 diff --git a/drivers/gpio/pca953x_gpio.c b/drivers/gpio/pca953x_gpio.c index 9ad81fe2ba..05bc4049c2 100644 --- a/drivers/gpio/pca953x_gpio.c +++ b/drivers/gpio/pca953x_gpio.c @@ -50,8 +50,6 @@ enum { #define MAX_BANK 5 #define BANK_SZ 8 -DECLARE_GLOBAL_DATA_PTR; - /* * struct pca953x_info - Data for pca953x * @@ -264,7 +262,7 @@ static int pca953x_probe(struct udevice *dev) return -ENODEV; } - addr = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "reg", 0); + addr = dev_read_addr(dev); if (addr == 0) return -ENODEV; From patchwork Fri Sep 29 12:51:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819955 X-Patchwork-Delegate: wd@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 3y3XZm2Lg4z9t2x for ; Fri, 29 Sep 2017 23:33:52 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id DDC37C21E8E; Fri, 29 Sep 2017 13:02: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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 B002BC21EBC; Fri, 29 Sep 2017 12:54:12 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6ED2DC21EBC; Fri, 29 Sep 2017 12:53:18 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id D2825C21DDD for ; Fri, 29 Sep 2017 12:53:17 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxun7-00004w-6N; Fri, 29 Sep 2017 14:53:17 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:48 +0200 Message-Id: <20170929125238.26226-30-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 030/080] serial: ns16550: Fix style violation 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" Clarify the computation precedence in two ternary operator constructions. Signed-off-by: Mario Six Reviewed-by: Simon Glass --- drivers/serial/ns16550.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index c702304e79..6f9ce689cf 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -339,9 +339,9 @@ static int ns16550_serial_pending(struct udevice *dev, bool input) struct NS16550 *const com_port = dev_get_priv(dev); if (input) - return serial_in(&com_port->lsr) & UART_LSR_DR ? 1 : 0; + return (serial_in(&com_port->lsr) & UART_LSR_DR) ? 1 : 0; else - return serial_in(&com_port->lsr) & UART_LSR_THRE ? 0 : 1; + return (serial_in(&com_port->lsr) & UART_LSR_THRE) ? 0 : 1; } static int ns16550_serial_getc(struct udevice *dev) From patchwork Fri Sep 29 12:51:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819918 X-Patchwork-Delegate: wd@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 3y3X5n6hTSz9t4g for ; Fri, 29 Sep 2017 23:12:13 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 9278AC21DCE; Fri, 29 Sep 2017 13:03:30 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 7DABDC21F0B; Fri, 29 Sep 2017 12:54:15 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0A521C21E93; Fri, 29 Sep 2017 12:53:18 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id EAEBEC21DDF for ; Fri, 29 Sep 2017 12:53:17 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxun7-00004w-Bl; Fri, 29 Sep 2017 14:53:17 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:49 +0200 Message-Id: <20170929125238.26226-31-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 031/080] serial: ns16550: Fix address translation 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 dev_read_addr function does not do any bus translations, and just returns the raw address read from the device tree, which makes the driver not work on systems that need bus translations to get the actual memory address of the device's register space. Since the dev_read_addr function is widely used, we refrain from modifying it, and instead read the raw address from the device tree, and apply the bus translations using the recently introduced dev_translate_address function. Signed-off-by: Mario Six --- drivers/serial/ns16550.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index 6f9ce689cf..15d55dfd24 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -389,12 +389,13 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev) { struct ns16550_platdata *plat = dev->platdata; const u32 port_type = dev_get_driver_data(dev); - fdt_addr_t addr; + fdt32_t addr; struct clk clk; int err; /* try Processor Local Bus device first */ - addr = dev_read_addr(dev); + addr = dev_read_u32_default(dev, "reg", 0); + addr = dev_translate_address(dev, &addr); #if defined(CONFIG_PCI) && defined(CONFIG_DM_PCI) if (addr == FDT_ADDR_T_NONE) { /* then try pci device */ From patchwork Fri Sep 29 12:51:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819959 X-Patchwork-Delegate: wd@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 3y3XcV0LTZz9t2x for ; Fri, 29 Sep 2017 23:35:21 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id B67ACC21EC3; Fri, 29 Sep 2017 13:03:06 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 3E797C21F0A; Fri, 29 Sep 2017 12:54:14 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 81633C21ED3; Fri, 29 Sep 2017 12:53:26 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id E6EC0C21E26 for ; Fri, 29 Sep 2017 12:53:22 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxunB-00004w-HM; Fri, 29 Sep 2017 14:53:21 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:50 +0200 Message-Id: <20170929125238.26226-32-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 032/080] gdsys: Post ppc4xx removal cleanup 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 ppc4xx architecture was recently removed, and with it several old gdsys 44x boards, but some "debris" from these purged boards was left over. This patch removes these remnants (mostly entries in Makefiles, some now superfluous data structures and some now obsolete config variables from the whitelist). Signed-off-by: Mario Six --- board/gdsys/common/Makefile | 4 -- board/gdsys/common/miiphybb.c | 128 ------------------------------------------ include/gdsys_fpga.h | 96 ------------------------------- scripts/config_whitelist.txt | 10 ---- 4 files changed, 238 deletions(-) delete mode 100644 board/gdsys/common/miiphybb.c diff --git a/board/gdsys/common/Makefile b/board/gdsys/common/Makefile index d4f0e70573..6f2fea207f 100644 --- a/board/gdsys/common/Makefile +++ b/board/gdsys/common/Makefile @@ -7,10 +7,6 @@ obj-$(CONFIG_SYS_FPGA_COMMON) += fpga.o obj-$(CONFIG_CMD_IOLOOP) += cmd_ioloop.o -obj-$(CONFIG_IO) += miiphybb.o -obj-$(CONFIG_IO64) += miiphybb.o -obj-$(CONFIG_IOCON) += osd.o mclink.o dp501.o phy.o ch7301.o -obj-$(CONFIG_DLVISION_10G) += osd.o dp501.o obj-$(CONFIG_CONTROLCENTERD) += dp501.o obj-$(CONFIG_HRCON) += osd.o mclink.o dp501.o phy.o ioep-fpga.o fanctrl.o obj-$(CONFIG_STRIDER) += mclink.o dp501.o phy.o ioep-fpga.o adv7611.o ch7301.o diff --git a/board/gdsys/common/miiphybb.c b/board/gdsys/common/miiphybb.c deleted file mode 100644 index 310562902b..0000000000 --- a/board/gdsys/common/miiphybb.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * (C) Copyright 2010 - * Dirk Eibach, Guntermann & Drunck GmbH, eibach@gdsys.de - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include -#include - -#include - -struct io_bb_pinset { - int mdio; - int mdc; -}; - -static int io_bb_mii_init(struct bb_miiphy_bus *bus) -{ - return 0; -} - -static int io_bb_mdio_active(struct bb_miiphy_bus *bus) -{ - struct io_bb_pinset *pins = bus->priv; - - out_be32((void *)GPIO0_TCR, - in_be32((void *)GPIO0_TCR) | pins->mdio); - - return 0; -} - -static int io_bb_mdio_tristate(struct bb_miiphy_bus *bus) -{ - struct io_bb_pinset *pins = bus->priv; - - out_be32((void *)GPIO0_TCR, - in_be32((void *)GPIO0_TCR) & ~pins->mdio); - - return 0; -} - -static int io_bb_set_mdio(struct bb_miiphy_bus *bus, int v) -{ - struct io_bb_pinset *pins = bus->priv; - - if (v) - out_be32((void *)GPIO0_OR, - in_be32((void *)GPIO0_OR) | pins->mdio); - else - out_be32((void *)GPIO0_OR, - in_be32((void *)GPIO0_OR) & ~pins->mdio); - - return 0; -} - -static int io_bb_get_mdio(struct bb_miiphy_bus *bus, int *v) -{ - struct io_bb_pinset *pins = bus->priv; - - *v = ((in_be32((void *)GPIO0_IR) & pins->mdio) != 0); - - return 0; -} - -static int io_bb_set_mdc(struct bb_miiphy_bus *bus, int v) -{ - struct io_bb_pinset *pins = bus->priv; - - if (v) - out_be32((void *)GPIO0_OR, - in_be32((void *)GPIO0_OR) | pins->mdc); - else - out_be32((void *)GPIO0_OR, - in_be32((void *)GPIO0_OR) & ~pins->mdc); - - return 0; -} - -static int io_bb_delay(struct bb_miiphy_bus *bus) -{ - udelay(1); - - return 0; -} - -struct io_bb_pinset io_bb_pinsets[] = { - { - .mdio = CONFIG_SYS_MDIO_PIN, - .mdc = CONFIG_SYS_MDC_PIN, - }, -#ifdef CONFIG_SYS_GBIT_MII1_BUSNAME - { - .mdio = CONFIG_SYS_MDIO1_PIN, - .mdc = CONFIG_SYS_MDC1_PIN, - }, -#endif -}; - -struct bb_miiphy_bus bb_miiphy_buses[] = { - { - .name = CONFIG_SYS_GBIT_MII_BUSNAME, - .init = io_bb_mii_init, - .mdio_active = io_bb_mdio_active, - .mdio_tristate = io_bb_mdio_tristate, - .set_mdio = io_bb_set_mdio, - .get_mdio = io_bb_get_mdio, - .set_mdc = io_bb_set_mdc, - .delay = io_bb_delay, - .priv = &io_bb_pinsets[0], - }, -#ifdef CONFIG_SYS_GBIT_MII1_BUSNAME - { - .name = CONFIG_SYS_GBIT_MII1_BUSNAME, - .init = io_bb_mii_init, - .mdio_active = io_bb_mdio_active, - .mdio_tristate = io_bb_mdio_tristate, - .set_mdio = io_bb_set_mdio, - .get_mdio = io_bb_get_mdio, - .set_mdc = io_bb_set_mdc, - .delay = io_bb_delay, - .priv = &io_bb_pinsets[1], - }, -#endif -}; - -int bb_miiphy_buses_num = sizeof(bb_miiphy_buses) / - sizeof(bb_miiphy_buses[0]); diff --git a/include/gdsys_fpga.h b/include/gdsys_fpga.h index bb8e144e04..34d6eeb253 100644 --- a/include/gdsys_fpga.h +++ b/include/gdsys_fpga.h @@ -87,81 +87,6 @@ struct ihs_fpga { }; #endif -#ifdef CONFIG_IO -struct ihs_fpga { - u16 reflection_low; /* 0x0000 */ - u16 versions; /* 0x0002 */ - u16 fpga_features; /* 0x0004 */ - u16 fpga_version; /* 0x0006 */ - u16 reserved_0[5]; /* 0x0008 */ - u16 quad_serdes_reset; /* 0x0012 */ - u16 reserved_1[8181]; /* 0x0014 */ - u16 reflection_high; /* 0x3ffe */ -}; -#endif - -#ifdef CONFIG_IO64 -struct ihs_fpga_channel { - u16 status_int; - u16 config_int; - u16 switch_connect_config; - u16 tx_destination; -}; - -struct ihs_fpga_hicb { - u16 status_int; - u16 config_int; -}; - -struct ihs_fpga { - u16 reflection_low; /* 0x0000 */ - u16 versions; /* 0x0002 */ - u16 fpga_features; /* 0x0004 */ - u16 fpga_version; /* 0x0006 */ - u16 reserved_0[5]; /* 0x0008 */ - u16 quad_serdes_reset; /* 0x0012 */ - u16 reserved_1[502]; /* 0x0014 */ - struct ihs_fpga_channel ch[32]; /* 0x0400 */ - struct ihs_fpga_channel hicb_ch[32]; /* 0x0500 */ - u16 reserved_2[7487]; /* 0x0580 */ - u16 reflection_high; /* 0x3ffe */ -}; -#endif - -#ifdef CONFIG_IOCON -struct ihs_fpga { - u16 reflection_low; /* 0x0000 */ - u16 versions; /* 0x0002 */ - u16 fpga_version; /* 0x0004 */ - u16 fpga_features; /* 0x0006 */ - u16 reserved_0[1]; /* 0x0008 */ - u16 top_interrupt; /* 0x000a */ - u16 reserved_1[4]; /* 0x000c */ - struct ihs_gpio gpio; /* 0x0014 */ - u16 mpc3w_control; /* 0x001a */ - u16 reserved_2[2]; /* 0x001c */ - struct ihs_io_ep ep; /* 0x0020 */ - u16 reserved_3[9]; /* 0x002e */ - struct ihs_i2c i2c0; /* 0x0040 */ - u16 reserved_4[10]; /* 0x004c */ - u16 mc_int; /* 0x0060 */ - u16 mc_int_en; /* 0x0062 */ - u16 mc_status; /* 0x0064 */ - u16 mc_control; /* 0x0066 */ - u16 mc_tx_data; /* 0x0068 */ - u16 mc_tx_address; /* 0x006a */ - u16 mc_tx_cmd; /* 0x006c */ - u16 mc_res; /* 0x006e */ - u16 mc_rx_cmd_status; /* 0x0070 */ - u16 mc_rx_data; /* 0x0072 */ - u16 reserved_5[69]; /* 0x0074 */ - u16 reflection_high; /* 0x00fe */ - struct ihs_osd osd0; /* 0x0100 */ - u16 reserved_6[889]; /* 0x010e */ - u16 videomem0[2048]; /* 0x0800 */ -}; -#endif - #if defined(CONFIG_HRCON) || defined(CONFIG_STRIDER_CON_DP) struct ihs_fpga { u16 reflection_low; /* 0x0000 */ @@ -271,25 +196,4 @@ struct ihs_fpga { }; #endif -#ifdef CONFIG_DLVISION_10G -struct ihs_fpga { - u16 reflection_low; /* 0x0000 */ - u16 versions; /* 0x0002 */ - u16 fpga_version; /* 0x0004 */ - u16 fpga_features; /* 0x0006 */ - u16 reserved_0[10]; /* 0x0008 */ - u16 extended_interrupt; /* 0x001c */ - u16 reserved_1[29]; /* 0x001e */ - u16 mpc3w_control; /* 0x0058 */ - u16 reserved_2[3]; /* 0x005a */ - struct ihs_i2c i2c0; /* 0x0060 */ - u16 reserved_3[2]; /* 0x006c */ - struct ihs_i2c i2c1; /* 0x0070 */ - u16 reserved_4[194]; /* 0x007c */ - struct ihs_osd osd0; /* 0x0200 */ - u16 reserved_5[761]; /* 0x020e */ - u16 videomem0[2048]; /* 0x0800 */ -}; -#endif - #endif diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index f8236beef5..4a5561ff41 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -452,7 +452,6 @@ CONFIG_DISCONTIGMEM CONFIG_DISCOVER_PHY CONFIG_DISPLAY_AER_xxxx CONFIG_DISPLAY_BOARDINFO_LATE -CONFIG_DLVISION_10G CONFIG_DM9000_BASE CONFIG_DM9000_BYTE_SWAPPED CONFIG_DM9000_DEBUG @@ -1103,9 +1102,6 @@ CONFIG_INI_MAX_NAME CONFIG_INI_MAX_SECTION CONFIG_INTEGRITY CONFIG_INTERRUPTS -CONFIG_IO -CONFIG_IO64 -CONFIG_IOCON CONFIG_IODELAY_RECALIBRATION CONFIG_IOMUX_LPSR CONFIG_IOMUX_SHARE_CONF_REG @@ -3313,8 +3309,6 @@ CONFIG_SYS_GAFR2_L_VAL CONFIG_SYS_GAFR2_U_VAL CONFIG_SYS_GAFR3_L_VAL CONFIG_SYS_GAFR3_U_VAL -CONFIG_SYS_GBIT_MII1_BUSNAME -CONFIG_SYS_GBIT_MII_BUSNAME CONFIG_SYS_GBL_DATA_OFFSET CONFIG_SYS_GBL_DATA_SIZE CONFIG_SYS_GENERIC_BOARD @@ -3751,13 +3745,9 @@ CONFIG_SYS_MCKR_VAL CONFIG_SYS_MCLINK_MAX CONFIG_SYS_MCMEM0_VAL CONFIG_SYS_MCMEM1_VAL -CONFIG_SYS_MDC1_PIN CONFIG_SYS_MDCNFG_VAL -CONFIG_SYS_MDC_PIN CONFIG_SYS_MDIO1_OFFSET -CONFIG_SYS_MDIO1_PIN CONFIG_SYS_MDIO_BASE_ADDR -CONFIG_SYS_MDIO_PIN CONFIG_SYS_MDMRS_VAL CONFIG_SYS_MDREFR_VAL CONFIG_SYS_MECR_VAL From patchwork Fri Sep 29 12:51:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819967 X-Patchwork-Delegate: wd@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 3y3Xl236RSz9t4k for ; Fri, 29 Sep 2017 23:41:02 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 2D965C21E0A; Fri, 29 Sep 2017 13:09:30 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 E5F5BC21F0C; Fri, 29 Sep 2017 12:56:08 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 882F1C21DC1; Fri, 29 Sep 2017 12:53:31 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 3E3C5C21E3C for ; Fri, 29 Sep 2017 12:53:26 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxunF-00004w-Lo; Fri, 29 Sep 2017 14:53:25 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:51 +0200 Message-Id: <20170929125238.26226-33-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 033/080] net: phy: marvell: Fix style violations 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" Fix some style violations (mostly wrong indentions) in the Marvell PHY driver. Signed-off-by: Mario Six --- drivers/net/phy/marvell.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index b7f300e40f..5d9f50a436 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -134,7 +134,7 @@ static int m88e1xxx_parse_status(struct phy_device *phydev) mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_88E1xxx_PHY_STATUS); if ((mii_reg & MIIM_88E1xxx_PHYSTAT_LINK) && - !(mii_reg & MIIM_88E1xxx_PHYSTAT_SPDDONE)) { + !(mii_reg & MIIM_88E1xxx_PHYSTAT_SPDDONE)) { int i = 0; puts("Waiting for PHY realtime link"); @@ -150,10 +150,10 @@ static int m88e1xxx_parse_status(struct phy_device *phydev) putc('.'); udelay(1000); mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, - MIIM_88E1xxx_PHY_STATUS); + MIIM_88E1xxx_PHY_STATUS); } puts(" done\n"); - udelay(500000); /* another 500 ms (results in faster booting) */ + mdelay(500); /* another 500 ms (results in faster booting) */ } else { if (mii_reg & MIIM_88E1xxx_PHYSTAT_LINK) phydev->link = 1; @@ -201,9 +201,9 @@ static int m88e1111s_config(struct phy_device *phydev) if (phy_interface_is_rgmii(phydev)) { reg = phy_read(phydev, - MDIO_DEVAD_NONE, MIIM_88E1111_PHY_EXT_CR); + MDIO_DEVAD_NONE, MIIM_88E1111_PHY_EXT_CR); if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) || - (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)) { + (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)) { reg |= (MIIM_88E1111_RX_DELAY | MIIM_88E1111_TX_DELAY); } else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) { reg &= ~MIIM_88E1111_TX_DELAY; @@ -214,10 +214,10 @@ static int m88e1111s_config(struct phy_device *phydev) } phy_write(phydev, - MDIO_DEVAD_NONE, MIIM_88E1111_PHY_EXT_CR, reg); + MDIO_DEVAD_NONE, MIIM_88E1111_PHY_EXT_CR, reg); reg = phy_read(phydev, - MDIO_DEVAD_NONE, MIIM_88E1111_PHY_EXT_SR); + MDIO_DEVAD_NONE, MIIM_88E1111_PHY_EXT_SR); reg &= ~(MIIM_88E1111_HWCFG_MODE_MASK); @@ -227,47 +227,47 @@ static int m88e1111s_config(struct phy_device *phydev) reg |= MIIM_88E1111_HWCFG_MODE_COPPER_RGMII; phy_write(phydev, - MDIO_DEVAD_NONE, MIIM_88E1111_PHY_EXT_SR, reg); + MDIO_DEVAD_NONE, MIIM_88E1111_PHY_EXT_SR, reg); } if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { reg = phy_read(phydev, - MDIO_DEVAD_NONE, MIIM_88E1111_PHY_EXT_SR); + MDIO_DEVAD_NONE, MIIM_88E1111_PHY_EXT_SR); reg &= ~(MIIM_88E1111_HWCFG_MODE_MASK); reg |= MIIM_88E1111_HWCFG_MODE_SGMII_NO_CLK; reg |= MIIM_88E1111_HWCFG_FIBER_COPPER_AUTO; phy_write(phydev, MDIO_DEVAD_NONE, - MIIM_88E1111_PHY_EXT_SR, reg); + MIIM_88E1111_PHY_EXT_SR, reg); } if (phydev->interface == PHY_INTERFACE_MODE_RTBI) { reg = phy_read(phydev, - MDIO_DEVAD_NONE, MIIM_88E1111_PHY_EXT_CR); + MDIO_DEVAD_NONE, MIIM_88E1111_PHY_EXT_CR); reg |= (MIIM_88E1111_RX_DELAY | MIIM_88E1111_TX_DELAY); phy_write(phydev, - MDIO_DEVAD_NONE, MIIM_88E1111_PHY_EXT_CR, reg); + MDIO_DEVAD_NONE, MIIM_88E1111_PHY_EXT_CR, reg); reg = phy_read(phydev, MDIO_DEVAD_NONE, - MIIM_88E1111_PHY_EXT_SR); + MIIM_88E1111_PHY_EXT_SR); reg &= ~(MIIM_88E1111_HWCFG_MODE_MASK | MIIM_88E1111_HWCFG_FIBER_COPPER_RES); reg |= 0x7 | MIIM_88E1111_HWCFG_FIBER_COPPER_AUTO; phy_write(phydev, MDIO_DEVAD_NONE, - MIIM_88E1111_PHY_EXT_SR, reg); + MIIM_88E1111_PHY_EXT_SR, reg); /* soft reset */ phy_reset(phydev); reg = phy_read(phydev, MDIO_DEVAD_NONE, - MIIM_88E1111_PHY_EXT_SR); + MIIM_88E1111_PHY_EXT_SR); reg &= ~(MIIM_88E1111_HWCFG_MODE_MASK | - MIIM_88E1111_HWCFG_FIBER_COPPER_RES); + MIIM_88E1111_HWCFG_FIBER_COPPER_RES); reg |= MIIM_88E1111_HWCFG_MODE_COPPER_RTBI | MIIM_88E1111_HWCFG_FIBER_COPPER_AUTO; phy_write(phydev, MDIO_DEVAD_NONE, - MIIM_88E1111_PHY_EXT_SR, reg); + MIIM_88E1111_PHY_EXT_SR, reg); } /* soft reset */ @@ -283,7 +283,7 @@ static int m88e1111s_config(struct phy_device *phydev) * m88e1518_phy_writebits - write bits to a register */ void m88e1518_phy_writebits(struct phy_device *phydev, - u8 reg_num, u16 offset, u16 len, u16 data) + u8 reg_num, u16 offset, u16 len, u16 data) { u16 reg, mask; @@ -446,10 +446,10 @@ static int m88e1121_config(struct phy_device *phydev) /* Switch the page to access the led register */ pg = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_88E1121_PHY_PAGE); phy_write(phydev, MDIO_DEVAD_NONE, MIIM_88E1121_PHY_PAGE, - MIIM_88E1121_PHY_LED_PAGE); + MIIM_88E1121_PHY_LED_PAGE); /* Configure leds */ phy_write(phydev, MDIO_DEVAD_NONE, MIIM_88E1121_PHY_LED_CTRL, - MIIM_88E1121_PHY_LED_DEF); + MIIM_88E1121_PHY_LED_DEF); /* Restore the page pointer */ phy_write(phydev, MDIO_DEVAD_NONE, MIIM_88E1121_PHY_PAGE, pg); @@ -472,7 +472,7 @@ static int m88e1145_config(struct phy_device *phydev) phy_write(phydev, MDIO_DEVAD_NONE, MIIM_88E1145_PHY_CAL_OV, 0xa2da); phy_write(phydev, MDIO_DEVAD_NONE, MIIM_88E1xxx_PHY_SCR, - MIIM_88E1xxx_PHY_MDI_X_AUTO); + MIIM_88E1xxx_PHY_MDI_X_AUTO); reg = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_88E1145_PHY_EXT_CR); if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) @@ -499,7 +499,7 @@ static int m88e1145_startup(struct phy_device *phydev) return ret; phy_write(phydev, MDIO_DEVAD_NONE, MIIM_88E1145_PHY_LED_CONTROL, - MIIM_88E1145_PHY_LED_DIRECT); + MIIM_88E1145_PHY_LED_DIRECT); return m88e1xxx_parse_status(phydev); } From patchwork Fri Sep 29 12:51:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819972 X-Patchwork-Delegate: wd@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 3y3XqL2clvz9t3f for ; Fri, 29 Sep 2017 23:44:46 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 0ECFDC21E5D; Fri, 29 Sep 2017 13:08:59 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 CC8D0C21E48; Fri, 29 Sep 2017 12:55:51 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 55708C21DC1; Fri, 29 Sep 2017 12:53:31 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 429FFC21E3E for ; Fri, 29 Sep 2017 12:53:26 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxunF-00004w-Pz; Fri, 29 Sep 2017 14:53:25 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:52 +0200 Message-Id: <20170929125238.26226-34-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 034/080] net: phy: marvell 88e151x: Fix handling of bare RGMII interface type 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" Commit 68e6eca ("net: phy: marvell 88e151x: Fix handling of RGMII interface types") fixed the initialization of 88e151x phys, but made it so that interfaces of type PHY_INTERFACE_MODE_RGMII had both RX and TX delay bits cleared. The default (like in m88e1111s_config) is to have both bits set. Hence, this patch changes the behavior in the PHY_INTERFACE_MODE_RGMII case so that both bits are set. Signed-off-by: Mario Six --- drivers/net/phy/marvell.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 5d9f50a436..8eddf70c68 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -357,7 +357,8 @@ static int m88e1518_config(struct phy_device *phydev) reg = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_88E151x_PHY_MSCR); reg &= ~MIIM_88E151x_RGMII_RXTX_DELAY; - if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) + if (phydev->interface == PHY_INTERFACE_MODE_RGMII || + phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) reg |= MIIM_88E151x_RGMII_RXTX_DELAY; else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) reg |= MIIM_88E151x_RGMII_RX_DELAY; From patchwork Fri Sep 29 12:51:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819969 X-Patchwork-Delegate: wd@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 3y3Xlv2fY7z9rvt for ; Fri, 29 Sep 2017 23:41:47 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 14840C21E0A; Fri, 29 Sep 2017 13:06:06 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 640DBC21F28; Fri, 29 Sep 2017 12:55:07 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4CA53C21DC1; Fri, 29 Sep 2017 12:53:39 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id A6487C21E6F for ; Fri, 29 Sep 2017 12:53:32 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxunK-00004w-7N; Fri, 29 Sep 2017 14:53:30 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:53 +0200 Message-Id: <20170929125238.26226-35-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 035/080] cfi_flash: Fix space between function name and parenthesis 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" Signed-off-by: Mario Six --- drivers/mtd/cfi_flash.c | 428 ++++++++++++++++++++++++------------------------ 1 file changed, 214 insertions(+), 214 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 8a5babea7b..b3dda8bd4a 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -204,7 +204,7 @@ unsigned long flash_sector_size(flash_info_t *info, flash_sect_t sect) * create an address based on the offset and the port width */ static inline void * -flash_map (flash_info_t * info, flash_sect_t sect, uint offset) +flash_map(flash_info_t * info, flash_sect_t sect, uint offset) { unsigned int byte_offset = offset * info->portwidth; @@ -247,17 +247,17 @@ static void flash_make_cmd(flash_info_t *info, u32 cmd, void *cmdbuf) /*----------------------------------------------------------------------- * Debug support */ -static void print_longlong (char *str, unsigned long long data) +static void print_longlong(char *str, unsigned long long data) { int i; char *cp; cp = (char *) &data; for (i = 0; i < 8; i++) - sprintf (&str[i * 2], "%2.2x", *cp++); + sprintf(&str[i * 2], "%2.2x", *cp++); } -static void flash_printqry (struct cfi_qry *qry) +static void flash_printqry(struct cfi_qry *qry) { u8 *p = (u8 *)qry; int x, y; @@ -283,31 +283,31 @@ static void flash_printqry (struct cfi_qry *qry) /*----------------------------------------------------------------------- * read a character at a port width address */ -static inline uchar flash_read_uchar (flash_info_t * info, uint offset) +static inline uchar flash_read_uchar(flash_info_t * info, uint offset) { uchar *cp; uchar retval; - cp = flash_map (info, 0, offset); + cp = flash_map(info, 0, offset); #if defined(__LITTLE_ENDIAN) || defined(CONFIG_SYS_WRITE_SWAPPED_DATA) retval = flash_read8(cp); #else retval = flash_read8(cp + info->portwidth - 1); #endif - flash_unmap (info, 0, offset, cp); + flash_unmap(info, 0, offset, cp); return retval; } /*----------------------------------------------------------------------- * read a word at a port width address, assume 16bit bus */ -static inline ushort flash_read_word (flash_info_t * info, uint offset) +static inline ushort flash_read_word(flash_info_t * info, uint offset) { ushort *addr, retval; - addr = flash_map (info, 0, offset); - retval = flash_read16 (addr); - flash_unmap (info, 0, offset, addr); + addr = flash_map(info, 0, offset); + retval = flash_read16(addr); + flash_unmap(info, 0, offset, addr); return retval; } @@ -325,13 +325,13 @@ static ulong flash_read_long (flash_info_t * info, flash_sect_t sect, #ifdef DEBUG int x; #endif - addr = flash_map (info, sect, offset); + addr = flash_map(info, sect, offset); #ifdef DEBUG - debug ("long addr is at %p info->portwidth = %d\n", addr, + debug("long addr is at %p info->portwidth = %d\n", addr, info->portwidth); for (x = 0; x < 4 * info->portwidth; x++) { - debug ("addr[%x] = 0x%x\n", x, flash_read8(addr + x)); + debug("addr[%x] = 0x%x\n", x, flash_read8(addr + x)); } #endif #if defined(__LITTLE_ENDIAN) || defined(CONFIG_SYS_WRITE_SWAPPED_DATA) @@ -360,22 +360,22 @@ static void flash_write_cmd(flash_info_t *info, flash_sect_t sect, void *addr; cfiword_t cword; - addr = flash_map (info, sect, offset); - flash_make_cmd (info, cmd, &cword); + addr = flash_map(info, sect, offset); + flash_make_cmd(info, cmd, &cword); switch (info->portwidth) { case FLASH_CFI_8BIT: - debug ("fwc addr %p cmd %x %x 8bit x %d bit\n", addr, cmd, + debug("fwc addr %p cmd %x %x 8bit x %d bit\n", addr, cmd, cword.w8, info->chipwidth << CFI_FLASH_SHIFT_WIDTH); flash_write8(cword.w8, addr); break; case FLASH_CFI_16BIT: - debug ("fwc addr %p cmd %x %4.4x 16bit x %d bit\n", addr, + debug("fwc addr %p cmd %x %4.4x 16bit x %d bit\n", addr, cmd, cword.w16, info->chipwidth << CFI_FLASH_SHIFT_WIDTH); flash_write16(cword.w16, addr); break; case FLASH_CFI_32BIT: - debug ("fwc addr %p cmd %x %8.8x 32bit x %d bit\n", addr, + debug("fwc addr %p cmd %x %8.8x 32bit x %d bit\n", addr, cmd, cword.w32, info->chipwidth << CFI_FLASH_SHIFT_WIDTH); flash_write32(cword.w32, addr); @@ -385,9 +385,9 @@ static void flash_write_cmd(flash_info_t *info, flash_sect_t sect, { char str[20]; - print_longlong (str, cword.w64); + print_longlong(str, cword.w64); - debug ("fwrite addr %p cmd %x %s 64 bit x %d bit\n", + debug("fwrite addr %p cmd %x %s 64 bit x %d bit\n", addr, cmd, str, info->chipwidth << CFI_FLASH_SHIFT_WIDTH); } @@ -402,36 +402,36 @@ static void flash_write_cmd(flash_info_t *info, flash_sect_t sect, flash_unmap(info, sect, offset, addr); } -static void flash_unlock_seq (flash_info_t * info, flash_sect_t sect) +static void flash_unlock_seq(flash_info_t * info, flash_sect_t sect) { - flash_write_cmd (info, sect, info->addr_unlock1, AMD_CMD_UNLOCK_START); - flash_write_cmd (info, sect, info->addr_unlock2, AMD_CMD_UNLOCK_ACK); + flash_write_cmd(info, sect, info->addr_unlock1, AMD_CMD_UNLOCK_START); + flash_write_cmd(info, sect, info->addr_unlock2, AMD_CMD_UNLOCK_ACK); } /*----------------------------------------------------------------------- */ -static int flash_isequal (flash_info_t * info, flash_sect_t sect, +static int flash_isequal(flash_info_t * info, flash_sect_t sect, uint offset, uchar cmd) { void *addr; cfiword_t cword; int retval; - addr = flash_map (info, sect, offset); - flash_make_cmd (info, cmd, &cword); + addr = flash_map(info, sect, offset); + flash_make_cmd(info, cmd, &cword); - debug ("is= cmd %x(%c) addr %p ", cmd, cmd, addr); + debug("is= cmd %x(%c) addr %p ", cmd, cmd, addr); switch (info->portwidth) { case FLASH_CFI_8BIT: - debug ("is= %x %x\n", flash_read8(addr), cword.w8); + debug("is= %x %x\n", flash_read8(addr), cword.w8); retval = (flash_read8(addr) == cword.w8); break; case FLASH_CFI_16BIT: - debug ("is= %4.4x %4.4x\n", flash_read16(addr), cword.w16); + debug("is= %4.4x %4.4x\n", flash_read16(addr), cword.w16); retval = (flash_read16(addr) == cword.w16); break; case FLASH_CFI_32BIT: - debug ("is= %8.8x %8.8x\n", flash_read32(addr), cword.w32); + debug("is= %8.8x %8.8x\n", flash_read32(addr), cword.w32); retval = (flash_read32(addr) == cword.w32); break; case FLASH_CFI_64BIT: @@ -440,9 +440,9 @@ static int flash_isequal (flash_info_t * info, flash_sect_t sect, char str1[20]; char str2[20]; - print_longlong (str1, flash_read64(addr)); - print_longlong (str2, cword.w64); - debug ("is= %s %s\n", str1, str2); + print_longlong(str1, flash_read64(addr)); + print_longlong(str2, cword.w64); + debug("is= %s %s\n", str1, str2); } #endif retval = (flash_read64(addr) == cword.w64); @@ -458,15 +458,15 @@ static int flash_isequal (flash_info_t * info, flash_sect_t sect, /*----------------------------------------------------------------------- */ -static int flash_isset (flash_info_t * info, flash_sect_t sect, +static int flash_isset(flash_info_t * info, flash_sect_t sect, uint offset, uchar cmd) { void *addr; cfiword_t cword; int retval; - addr = flash_map (info, sect, offset); - flash_make_cmd (info, cmd, &cword); + addr = flash_map(info, sect, offset); + flash_make_cmd(info, cmd, &cword); switch (info->portwidth) { case FLASH_CFI_8BIT: retval = ((flash_read8(addr) & cword.w8) == cword.w8); @@ -491,15 +491,15 @@ static int flash_isset (flash_info_t * info, flash_sect_t sect, /*----------------------------------------------------------------------- */ -static int flash_toggle (flash_info_t * info, flash_sect_t sect, +static int flash_toggle(flash_info_t * info, flash_sect_t sect, uint offset, uchar cmd) { void *addr; cfiword_t cword; int retval; - addr = flash_map (info, sect, offset); - flash_make_cmd (info, cmd, &cword); + addr = flash_map(info, sect, offset); + flash_make_cmd(info, cmd, &cword); switch (info->portwidth) { case FLASH_CFI_8BIT: retval = flash_read8(addr) != flash_read8(addr); @@ -529,7 +529,7 @@ static int flash_toggle (flash_info_t * info, flash_sect_t sect, * This routine checks the status of the chip and returns true if the * chip is busy. */ -static int flash_is_busy (flash_info_t * info, flash_sect_t sect) +static int flash_is_busy(flash_info_t * info, flash_sect_t sect) { int retval; @@ -537,7 +537,7 @@ static int flash_is_busy (flash_info_t * info, flash_sect_t sect) case CFI_CMDSET_INTEL_PROG_REGIONS: case CFI_CMDSET_INTEL_STANDARD: case CFI_CMDSET_INTEL_EXTENDED: - retval = !flash_isset (info, sect, 0, FLASH_STATUS_DONE); + retval = !flash_isset(info, sect, 0, FLASH_STATUS_DONE); break; case CFI_CMDSET_AMD_STANDARD: case CFI_CMDSET_AMD_EXTENDED: @@ -545,12 +545,12 @@ static int flash_is_busy (flash_info_t * info, flash_sect_t sect) case CFI_CMDSET_AMD_LEGACY: #endif if (info->sr_supported) { - flash_write_cmd (info, sect, info->addr_unlock1, + flash_write_cmd(info, sect, info->addr_unlock1, FLASH_CMD_READ_STATUS); - retval = !flash_isset (info, sect, 0, + retval = !flash_isset(info, sect, 0, FLASH_STATUS_DONE); } else { - retval = flash_toggle (info, sect, 0, + retval = flash_toggle(info, sect, 0, AMD_STATUS_TOGGLE); } @@ -558,7 +558,7 @@ static int flash_is_busy (flash_info_t * info, flash_sect_t sect) default: retval = 0; } - debug ("flash_is_busy: %d\n", retval); + debug("flash_is_busy: %d\n", retval); return retval; } @@ -566,7 +566,7 @@ static int flash_is_busy (flash_info_t * info, flash_sect_t sect) * wait for XSR.7 to be set. Time out with an error if it does not. * This routine does not set the flash to read-array mode. */ -static int flash_status_check (flash_info_t * info, flash_sect_t sector, +static int flash_status_check(flash_info_t * info, flash_sect_t sector, ulong tout, char *prompt) { ulong start; @@ -582,18 +582,18 @@ static int flash_status_check (flash_info_t * info, flash_sect_t sector, #ifdef CONFIG_SYS_LOW_RES_TIMER reset_timer(); #endif - start = get_timer (0); + start = get_timer(0); WATCHDOG_RESET(); - while (flash_is_busy (info, sector)) { - if (get_timer (start) > tout) { - printf ("Flash %s timeout at address %lx data %lx\n", + while (flash_is_busy(info, sector)) { + if (get_timer(start) > tout) { + printf("Flash %s timeout at address %lx data %lx\n", prompt, info->start[sector], - flash_read_long (info, sector, 0)); - flash_write_cmd (info, sector, 0, info->cmd_reset); + flash_read_long(info, sector, 0)); + flash_write_cmd(info, sector, 0, info->cmd_reset); udelay(1); return ERR_TIMOUT; } - udelay (1); /* also triggers watchdog */ + udelay(1); /* also triggers watchdog */ } return ERR_OK; } @@ -604,12 +604,12 @@ static int flash_status_check (flash_info_t * info, flash_sect_t sector, * * This routine sets the flash to read-array mode. */ -static int flash_full_status_check (flash_info_t * info, flash_sect_t sector, +static int flash_full_status_check(flash_info_t * info, flash_sect_t sector, ulong tout, char *prompt) { int retcode; - retcode = flash_status_check (info, sector, tout, prompt); + retcode = flash_status_check(info, sector, tout, prompt); switch (info->vendor) { case CFI_CMDSET_INTEL_PROG_REGIONS: case CFI_CMDSET_INTEL_EXTENDED: @@ -617,27 +617,27 @@ static int flash_full_status_check (flash_info_t * info, flash_sect_t sector, if ((retcode == ERR_OK) && !flash_isset(info, sector, 0, FLASH_STATUS_DONE)) { retcode = ERR_INVAL; - printf ("Flash %s error at address %lx\n", prompt, + printf("Flash %s error at address %lx\n", prompt, info->start[sector]); - if (flash_isset (info, sector, 0, FLASH_STATUS_ECLBS | + if (flash_isset(info, sector, 0, FLASH_STATUS_ECLBS | FLASH_STATUS_PSLBS)) { - puts ("Command Sequence Error.\n"); - } else if (flash_isset (info, sector, 0, + puts("Command Sequence Error.\n"); + } else if (flash_isset(info, sector, 0, FLASH_STATUS_ECLBS)) { - puts ("Block Erase Error.\n"); + puts("Block Erase Error.\n"); retcode = ERR_NOT_ERASED; - } else if (flash_isset (info, sector, 0, + } else if (flash_isset(info, sector, 0, FLASH_STATUS_PSLBS)) { - puts ("Locking Error\n"); + puts("Locking Error\n"); } - if (flash_isset (info, sector, 0, FLASH_STATUS_DPS)) { - puts ("Block locked.\n"); + if (flash_isset(info, sector, 0, FLASH_STATUS_DPS)) { + puts("Block locked.\n"); retcode = ERR_PROTECTED; } - if (flash_isset (info, sector, 0, FLASH_STATUS_VPENS)) - puts ("Vpp Low Error.\n"); + if (flash_isset(info, sector, 0, FLASH_STATUS_VPENS)) + puts("Vpp Low Error.\n"); } - flash_write_cmd (info, sector, 0, info->cmd_reset); + flash_write_cmd(info, sector, 0, info->cmd_reset); udelay(1); break; default: @@ -709,7 +709,7 @@ static int flash_status_poll(flash_info_t *info, void *src, void *dst, /*----------------------------------------------------------------------- */ -static void flash_add_byte (flash_info_t * info, cfiword_t * cword, uchar c) +static void flash_add_byte(flash_info_t * info, cfiword_t * cword, uchar c) { #if defined(__LITTLE_ENDIAN) && !defined(CONFIG_SYS_WRITE_SWAPPED_DATA) unsigned short w; @@ -755,7 +755,7 @@ static void flash_add_byte (flash_info_t * info, cfiword_t * cword, uchar c) * Loop through the sector table starting from the previously found sector. * Searches forwards or backwards, dependent on the passed address. */ -static flash_sect_t find_sector (flash_info_t * info, ulong addr) +static flash_sect_t find_sector(flash_info_t * info, ulong addr) { static flash_sect_t saved_sector; /* previously found sector */ static flash_info_t *saved_info; /* previously used flash bank */ @@ -781,7 +781,7 @@ static flash_sect_t find_sector (flash_info_t * info, ulong addr) /*----------------------------------------------------------------------- */ -static int flash_write_cfiword (flash_info_t * info, ulong dest, +static int flash_write_cfiword(flash_info_t * info, ulong dest, cfiword_t cword) { void *dstaddr = (void *)dest; @@ -811,27 +811,27 @@ static int flash_write_cfiword (flash_info_t * info, ulong dest, return ERR_NOT_ERASED; /* Disable interrupts which might cause a timeout here */ - flag = disable_interrupts (); + flag = disable_interrupts(); switch (info->vendor) { case CFI_CMDSET_INTEL_PROG_REGIONS: case CFI_CMDSET_INTEL_EXTENDED: case CFI_CMDSET_INTEL_STANDARD: - flash_write_cmd (info, 0, 0, FLASH_CMD_CLEAR_STATUS); - flash_write_cmd (info, 0, 0, FLASH_CMD_WRITE); + flash_write_cmd(info, 0, 0, FLASH_CMD_CLEAR_STATUS); + flash_write_cmd(info, 0, 0, FLASH_CMD_WRITE); break; case CFI_CMDSET_AMD_EXTENDED: case CFI_CMDSET_AMD_STANDARD: sect = find_sector(info, dest); - flash_unlock_seq (info, sect); - flash_write_cmd (info, sect, info->addr_unlock1, AMD_CMD_WRITE); + flash_unlock_seq(info, sect); + flash_write_cmd(info, sect, info->addr_unlock1, AMD_CMD_WRITE); sect_found = 1; break; #ifdef CONFIG_FLASH_CFI_LEGACY case CFI_CMDSET_AMD_LEGACY: sect = find_sector(info, dest); - flash_unlock_seq (info, 0); - flash_write_cmd (info, 0, info->addr_unlock1, AMD_CMD_WRITE); + flash_unlock_seq(info, 0); + flash_write_cmd(info, 0, info->addr_unlock1, AMD_CMD_WRITE); sect_found = 1; break; #endif @@ -854,10 +854,10 @@ static int flash_write_cfiword (flash_info_t * info, ulong dest, /* re-enable interrupts if necessary */ if (flag) - enable_interrupts (); + enable_interrupts(); if (!sect_found) - sect = find_sector (info, dest); + sect = find_sector(info, dest); if (use_flash_status_poll(info)) return flash_status_poll(info, &cword, dstaddr, @@ -869,7 +869,7 @@ static int flash_write_cfiword (flash_info_t * info, ulong dest, #ifdef CONFIG_SYS_FLASH_USE_BUFFER_WRITE -static int flash_write_cfibuffer (flash_info_t * info, ulong dest, uchar * cp, +static int flash_write_cfibuffer(flash_info_t * info, ulong dest, uchar * cp, int len) { flash_sect_t sector; @@ -933,7 +933,7 @@ static int flash_write_cfibuffer (flash_info_t * info, ulong dest, uchar * cp, } src = cp; - sector = find_sector (info, dest); + sector = find_sector(info, dest); switch (info->vendor) { case CFI_CMDSET_INTEL_PROG_REGIONS: @@ -941,17 +941,17 @@ static int flash_write_cfibuffer (flash_info_t * info, ulong dest, uchar * cp, case CFI_CMDSET_INTEL_EXTENDED: write_cmd = (info->vendor == CFI_CMDSET_INTEL_PROG_REGIONS) ? FLASH_CMD_WRITE_BUFFER_PROG : FLASH_CMD_WRITE_TO_BUFFER; - flash_write_cmd (info, sector, 0, FLASH_CMD_CLEAR_STATUS); - flash_write_cmd (info, sector, 0, FLASH_CMD_READ_STATUS); - flash_write_cmd (info, sector, 0, write_cmd); - retcode = flash_status_check (info, sector, + flash_write_cmd(info, sector, 0, FLASH_CMD_CLEAR_STATUS); + flash_write_cmd(info, sector, 0, FLASH_CMD_READ_STATUS); + flash_write_cmd(info, sector, 0, write_cmd); + retcode = flash_status_check(info, sector, info->buffer_write_tout, "write to buffer"); if (retcode == ERR_OK) { /* reduce the number of loops by the width of * the port */ cnt = len >> shift; - flash_write_cmd (info, sector, 0, cnt - 1); + flash_write_cmd(info, sector, 0, cnt - 1); while (cnt-- > 0) { switch (info->portwidth) { case FLASH_CFI_8BIT: @@ -975,9 +975,9 @@ static int flash_write_cfibuffer (flash_info_t * info, ulong dest, uchar * cp, goto out_unmap; } } - flash_write_cmd (info, sector, 0, + flash_write_cmd(info, sector, 0, FLASH_CMD_WRITE_BUFFER_CONFIRM); - retcode = flash_full_status_check ( + retcode = flash_full_status_check( info, sector, info->buffer_write_tout, "buffer write"); } @@ -1025,7 +1025,7 @@ static int flash_write_cfibuffer (flash_info_t * info, ulong dest, uchar * cp, goto out_unmap; } - flash_write_cmd (info, sector, 0, AMD_CMD_WRITE_BUFFER_CONFIRM); + flash_write_cmd(info, sector, 0, AMD_CMD_WRITE_BUFFER_CONFIRM); if (use_flash_status_poll(info)) retcode = flash_status_poll(info, src - (1 << shift), dst - (1 << shift), @@ -1038,7 +1038,7 @@ static int flash_write_cfibuffer (flash_info_t * info, ulong dest, uchar * cp, break; default: - debug ("Unknown Command Set\n"); + debug("Unknown Command Set\n"); retcode = ERR_INVAL; break; } @@ -1051,7 +1051,7 @@ out_unmap: /*----------------------------------------------------------------------- */ -int flash_erase (flash_info_t * info, int s_first, int s_last) +int flash_erase(flash_info_t * info, int s_first, int s_last) { int rcode = 0; int prot; @@ -1059,11 +1059,11 @@ int flash_erase (flash_info_t * info, int s_first, int s_last) int st; if (info->flash_id != FLASH_MAN_CFI) { - puts ("Can't erase unknown flash type - aborted\n"); + puts("Can't erase unknown flash type - aborted\n"); return 1; } if ((s_first < 0) || (s_first > s_last)) { - puts ("- no sectors to erase\n"); + puts("- no sectors to erase\n"); return 1; } @@ -1074,10 +1074,10 @@ int flash_erase (flash_info_t * info, int s_first, int s_last) } } if (prot) { - printf ("- Warning: %d protected sectors will not be erased!\n", + printf("- Warning: %d protected sectors will not be erased!\n", prot); } else if (flash_verbose) { - putc ('\n'); + putc('\n'); } @@ -1118,35 +1118,35 @@ int flash_erase (flash_info_t * info, int s_first, int s_last) case CFI_CMDSET_INTEL_PROG_REGIONS: case CFI_CMDSET_INTEL_STANDARD: case CFI_CMDSET_INTEL_EXTENDED: - flash_write_cmd (info, sect, 0, + flash_write_cmd(info, sect, 0, FLASH_CMD_CLEAR_STATUS); - flash_write_cmd (info, sect, 0, + flash_write_cmd(info, sect, 0, FLASH_CMD_BLOCK_ERASE); - flash_write_cmd (info, sect, 0, + flash_write_cmd(info, sect, 0, FLASH_CMD_ERASE_CONFIRM); break; case CFI_CMDSET_AMD_STANDARD: case CFI_CMDSET_AMD_EXTENDED: - flash_unlock_seq (info, sect); - flash_write_cmd (info, sect, + flash_unlock_seq(info, sect); + flash_write_cmd(info, sect, info->addr_unlock1, AMD_CMD_ERASE_START); - flash_unlock_seq (info, sect); - flash_write_cmd (info, sect, 0, + flash_unlock_seq(info, sect); + flash_write_cmd(info, sect, 0, info->cmd_erase_sector); break; #ifdef CONFIG_FLASH_CFI_LEGACY case CFI_CMDSET_AMD_LEGACY: - flash_unlock_seq (info, 0); - flash_write_cmd (info, 0, info->addr_unlock1, + flash_unlock_seq(info, 0); + flash_write_cmd(info, 0, info->addr_unlock1, AMD_CMD_ERASE_START); - flash_unlock_seq (info, 0); - flash_write_cmd (info, sect, 0, + flash_unlock_seq(info, 0); + flash_write_cmd(info, sect, 0, AMD_CMD_ERASE_SECTOR); break; #endif default: - debug ("Unkown flash vendor %d\n", + debug("Unkown flash vendor %d\n", info->vendor); break; } @@ -1166,12 +1166,12 @@ int flash_erase (flash_info_t * info, int s_first, int s_last) if (st) rcode = 1; else if (flash_verbose) - putc ('.'); + putc('.'); } } if (flash_verbose) - puts (" done\n"); + puts(" done\n"); return rcode; } @@ -1200,53 +1200,53 @@ static int sector_erased(flash_info_t *info, int i) } #endif /* CONFIG_SYS_FLASH_EMPTY_INFO */ -void flash_print_info (flash_info_t * info) +void flash_print_info(flash_info_t * info) { int i; if (info->flash_id != FLASH_MAN_CFI) { - puts ("missing or unknown FLASH type\n"); + puts("missing or unknown FLASH type\n"); return; } - printf ("%s flash (%d x %d)", + printf("%s flash (%d x %d)", info->name, (info->portwidth << 3), (info->chipwidth << 3)); if (info->size < 1024*1024) - printf (" Size: %ld kB in %d Sectors\n", + printf(" Size: %ld kB in %d Sectors\n", info->size >> 10, info->sector_count); else - printf (" Size: %ld MB in %d Sectors\n", + printf(" Size: %ld MB in %d Sectors\n", info->size >> 20, info->sector_count); - printf (" "); + printf(" "); switch (info->vendor) { case CFI_CMDSET_INTEL_PROG_REGIONS: - printf ("Intel Prog Regions"); + printf("Intel Prog Regions"); break; case CFI_CMDSET_INTEL_STANDARD: - printf ("Intel Standard"); + printf("Intel Standard"); break; case CFI_CMDSET_INTEL_EXTENDED: - printf ("Intel Extended"); + printf("Intel Extended"); break; case CFI_CMDSET_AMD_STANDARD: - printf ("AMD Standard"); + printf("AMD Standard"); break; case CFI_CMDSET_AMD_EXTENDED: - printf ("AMD Extended"); + printf("AMD Extended"); break; #ifdef CONFIG_FLASH_CFI_LEGACY case CFI_CMDSET_AMD_LEGACY: - printf ("AMD Legacy"); + printf("AMD Legacy"); break; #endif default: - printf ("Unknown (%d)", info->vendor); + printf("Unknown (%d)", info->vendor); break; } - printf (" command set, Manufacturer ID: 0x%02X, Device ID: 0x", + printf(" command set, Manufacturer ID: 0x%02X, Device ID: 0x", info->manufacturer_id); - printf (info->chipwidth == FLASH_CFI_16BIT ? "%04X" : "%02X", + printf(info->chipwidth == FLASH_CFI_16BIT ? "%04X" : "%02X", info->device_id); if ((info->device_id & 0xff) == 0x7E) { printf(info->chipwidth == FLASH_CFI_16BIT ? "%04X" : "%02X", @@ -1254,17 +1254,17 @@ void flash_print_info (flash_info_t * info) } if ((info->vendor == CFI_CMDSET_AMD_STANDARD) && (info->legacy_unlock)) printf("\n Advanced Sector Protection (PPB) enabled"); - printf ("\n Erase timeout: %ld ms, write timeout: %ld ms\n", + printf("\n Erase timeout: %ld ms, write timeout: %ld ms\n", info->erase_blk_tout, info->write_tout); if (info->buffer_size > 1) { - printf (" Buffer write timeout: %ld ms, " + printf(" Buffer write timeout: %ld ms, " "buffer size: %d bytes\n", info->buffer_write_tout, info->buffer_size); } - puts ("\n Sector Start Addresses:"); + puts("\n Sector Start Addresses:"); for (i = 0; i < info->sector_count; ++i) { if (ctrlc()) break; @@ -1272,17 +1272,17 @@ void flash_print_info (flash_info_t * info) putc('\n'); #ifdef CONFIG_SYS_FLASH_EMPTY_INFO /* print empty and read-only info */ - printf (" %08lX %c %s ", + printf(" %08lX %c %s ", info->start[i], sector_erased(info, i) ? 'E' : ' ', info->protect[i] ? "RO" : " "); #else /* ! CONFIG_SYS_FLASH_EMPTY_INFO */ - printf (" %08lX %s ", + printf(" %08lX %s ", info->start[i], info->protect[i] ? "RO" : " "); #endif } - putc ('\n'); + putc('\n'); return; } @@ -1298,9 +1298,9 @@ void flash_print_info (flash_info_t * info) dots -= dots_sub; \ if ((scale > 0) && (dots <= 0)) { \ if ((digit % 5) == 0) \ - printf ("%d", digit / 5); \ + printf("%d", digit / 5); \ else \ - putc ('.'); \ + putc('.'); \ digit--; \ dots += scale; \ } \ @@ -1315,7 +1315,7 @@ void flash_print_info (flash_info_t * info) * 1 - write timeout * 2 - Flash not erased */ -int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt) +int write_buff(flash_info_t * info, uchar * src, ulong addr, ulong cnt) { ulong wp; uchar *p; @@ -1347,16 +1347,16 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt) cword.w32 = 0; p = (uchar *)wp; for (i = 0; i < aln; ++i) - flash_add_byte (info, &cword, flash_read8(p + i)); + flash_add_byte(info, &cword, flash_read8(p + i)); for (; (i < info->portwidth) && (cnt > 0); i++) { - flash_add_byte (info, &cword, *src++); + flash_add_byte(info, &cword, *src++); cnt--; } for (; (cnt == 0) && (i < info->portwidth); ++i) - flash_add_byte (info, &cword, flash_read8(p + i)); + flash_add_byte(info, &cword, flash_read8(p + i)); - rc = flash_write_cfiword (info, wp, cword); + rc = flash_write_cfiword(info, wp, cword); if (rc != 0) return rc; @@ -1373,8 +1373,8 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt) if (info->buffer_size == 1) { cword.w32 = 0; for (i = 0; i < info->portwidth; i++) - flash_add_byte (info, &cword, *src++); - if ((rc = flash_write_cfiword (info, wp, cword)) != 0) + flash_add_byte(info, &cword, *src++); + if ((rc = flash_write_cfiword(info, wp, cword)) != 0) return rc; wp += info->portwidth; cnt -= info->portwidth; @@ -1385,7 +1385,7 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt) i = buffered_size - (wp % buffered_size); if (i > cnt) i = cnt; - if ((rc = flash_write_cfibuffer (info, wp, src, i)) != ERR_OK) + if ((rc = flash_write_cfibuffer(info, wp, src, i)) != ERR_OK) return rc; i -= i & (info->portwidth - 1); wp += i; @@ -1400,9 +1400,9 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt) while (cnt >= info->portwidth) { cword.w32 = 0; for (i = 0; i < info->portwidth; i++) { - flash_add_byte (info, &cword, *src++); + flash_add_byte(info, &cword, *src++); } - if ((rc = flash_write_cfiword (info, wp, cword)) != 0) + if ((rc = flash_write_cfiword(info, wp, cword)) != 0) return rc; wp += info->portwidth; cnt -= info->portwidth; @@ -1423,13 +1423,13 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt) cword.w32 = 0; p = (uchar *)wp; for (i = 0; (i < info->portwidth) && (cnt > 0); ++i) { - flash_add_byte (info, &cword, *src++); + flash_add_byte(info, &cword, *src++); --cnt; } for (; i < info->portwidth; ++i) - flash_add_byte (info, &cword, flash_read8(p + i)); + flash_add_byte(info, &cword, flash_read8(p + i)); - return flash_write_cfiword (info, wp, cword); + return flash_write_cfiword(info, wp, cword); } static inline int manufact_match(flash_info_t *info, u32 manu) @@ -1475,7 +1475,7 @@ static int cfi_protect_bugfix(flash_info_t *info, long sector, int prot) return 0; } -int flash_real_protect (flash_info_t * info, long sector, int prot) +int flash_real_protect(flash_info_t * info, long sector, int prot) { int retcode = 0; @@ -1502,19 +1502,19 @@ int flash_real_protect (flash_info_t * info, long sector, int prot) /* U-Boot only checks the first byte */ if (manufact_match(info, ATM_MANUFACT)) { if (prot) { - flash_unlock_seq (info, 0); - flash_write_cmd (info, 0, + flash_unlock_seq(info, 0); + flash_write_cmd(info, 0, info->addr_unlock1, ATM_CMD_SOFTLOCK_START); - flash_unlock_seq (info, 0); - flash_write_cmd (info, sector, 0, + flash_unlock_seq(info, 0); + flash_write_cmd(info, sector, 0, ATM_CMD_LOCK_SECT); } else { - flash_write_cmd (info, 0, + flash_write_cmd(info, 0, info->addr_unlock1, AMD_CMD_UNLOCK_START); if (info->device_id == ATM_ID_BV6416) - flash_write_cmd (info, sector, + flash_write_cmd(info, sector, 0, ATM_CMD_UNLOCK_SECT); } } @@ -1562,12 +1562,12 @@ int flash_real_protect (flash_info_t * info, long sector, int prot) break; #ifdef CONFIG_FLASH_CFI_LEGACY case CFI_CMDSET_AMD_LEGACY: - flash_write_cmd (info, sector, 0, FLASH_CMD_CLEAR_STATUS); - flash_write_cmd (info, sector, 0, FLASH_CMD_PROTECT); + flash_write_cmd(info, sector, 0, FLASH_CMD_CLEAR_STATUS); + flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT); if (prot) - flash_write_cmd (info, sector, 0, FLASH_CMD_PROTECT_SET); + flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT_SET); else - flash_write_cmd (info, sector, 0, FLASH_CMD_PROTECT_CLEAR); + flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT_CLEAR); #endif }; @@ -1577,7 +1577,7 @@ int flash_real_protect (flash_info_t * info, long sector, int prot) */ flash_write_cmd(info, sector, 0, FLASH_CMD_READ_STATUS); if ((retcode = - flash_full_status_check (info, sector, info->erase_blk_tout, + flash_full_status_check(info, sector, info->erase_blk_tout, prot ? "protect" : "unprotect")) == 0) { info->protect[sector] = prot; @@ -1591,7 +1591,7 @@ int flash_real_protect (flash_info_t * info, long sector, int prot) for (i = 0; i < info->sector_count; i++) { if (info->protect[i]) - flash_real_protect (info, i, 1); + flash_real_protect(info, i, 1); } } } @@ -1601,17 +1601,17 @@ int flash_real_protect (flash_info_t * info, long sector, int prot) /*----------------------------------------------------------------------- * flash_read_user_serial - read the OneTimeProgramming cells */ -void flash_read_user_serial (flash_info_t * info, void *buffer, int offset, +void flash_read_user_serial(flash_info_t * info, void *buffer, int offset, int len) { uchar *src; uchar *dst; dst = buffer; - src = flash_map (info, 0, FLASH_OFFSET_USER_PROTECTION); - flash_write_cmd (info, 0, 0, FLASH_CMD_READ_ID); - memcpy (dst, src + offset, len); - flash_write_cmd (info, 0, 0, info->cmd_reset); + src = flash_map(info, 0, FLASH_OFFSET_USER_PROTECTION); + flash_write_cmd(info, 0, 0, FLASH_CMD_READ_ID); + memcpy(dst, src + offset, len); + flash_write_cmd(info, 0, 0, info->cmd_reset); udelay(1); flash_unmap(info, 0, FLASH_OFFSET_USER_PROTECTION, src); } @@ -1619,15 +1619,15 @@ void flash_read_user_serial (flash_info_t * info, void *buffer, int offset, /* * flash_read_factory_serial - read the device Id from the protection area */ -void flash_read_factory_serial (flash_info_t * info, void *buffer, int offset, +void flash_read_factory_serial(flash_info_t * info, void *buffer, int offset, int len) { uchar *src; - src = flash_map (info, 0, FLASH_OFFSET_INTEL_PROTECTION); - flash_write_cmd (info, 0, 0, FLASH_CMD_READ_ID); - memcpy (buffer, src + offset, len); - flash_write_cmd (info, 0, 0, info->cmd_reset); + src = flash_map(info, 0, FLASH_OFFSET_INTEL_PROTECTION); + flash_write_cmd(info, 0, 0, FLASH_CMD_READ_ID); + memcpy(buffer, src + offset, len); + flash_write_cmd(info, 0, 0, info->cmd_reset); udelay(1); flash_unmap(info, 0, FLASH_OFFSET_INTEL_PROTECTION, src); } @@ -1664,11 +1664,11 @@ static void cmdset_intel_read_jedec_ids(flash_info_t *info) udelay(1); flash_write_cmd(info, 0, 0, FLASH_CMD_READ_ID); udelay(1000); /* some flash are slow to respond */ - info->manufacturer_id = flash_read_uchar (info, + info->manufacturer_id = flash_read_uchar(info, FLASH_OFFSET_MANUFACTURER_ID); info->device_id = (info->chipwidth == FLASH_CFI_16BIT) ? - flash_read_word (info, FLASH_OFFSET_DEVICE_ID) : - flash_read_uchar (info, FLASH_OFFSET_DEVICE_ID); + flash_read_word(info, FLASH_OFFSET_DEVICE_ID) : + flash_read_uchar(info, FLASH_OFFSET_DEVICE_ID); flash_write_cmd(info, 0, 0, FLASH_CMD_RESET); } @@ -1682,7 +1682,7 @@ static int cmdset_intel_init(flash_info_t *info, struct cfi_qry *qry) #ifdef CONFIG_SYS_FLASH_PROTECTION /* read legacy lock/unlock bit from intel flash */ if (info->ext_addr) { - info->legacy_unlock = flash_read_uchar (info, + info->legacy_unlock = flash_read_uchar(info, info->ext_addr + 5) & 0x08; } #endif @@ -1701,11 +1701,11 @@ static void cmdset_amd_read_jedec_ids(flash_info_t *info) flash_write_cmd(info, 0, info->addr_unlock1, FLASH_CMD_READ_ID); udelay(1000); /* some flash are slow to respond */ - manuId = flash_read_uchar (info, FLASH_OFFSET_MANUFACTURER_ID); + manuId = flash_read_uchar(info, FLASH_OFFSET_MANUFACTURER_ID); /* JEDEC JEP106Z specifies ID codes up to bank 7 */ while (manuId == FLASH_CONTINUATION_CODE && bankId < 0x800) { bankId += 0x100; - manuId = flash_read_uchar (info, + manuId = flash_read_uchar(info, bankId | FLASH_OFFSET_MANUFACTURER_ID); } info->manufacturer_id = manuId; @@ -1715,26 +1715,26 @@ static void cmdset_amd_read_jedec_ids(flash_info_t *info) switch (info->chipwidth){ case FLASH_CFI_8BIT: - info->device_id = flash_read_uchar (info, + info->device_id = flash_read_uchar(info, FLASH_OFFSET_DEVICE_ID); if (info->device_id == 0x7E) { /* AMD 3-byte (expanded) device ids */ - info->device_id2 = flash_read_uchar (info, + info->device_id2 = flash_read_uchar(info, FLASH_OFFSET_DEVICE_ID2); info->device_id2 <<= 8; - info->device_id2 |= flash_read_uchar (info, + info->device_id2 |= flash_read_uchar(info, FLASH_OFFSET_DEVICE_ID3); } break; case FLASH_CFI_16BIT: - info->device_id = flash_read_word (info, + info->device_id = flash_read_word(info, FLASH_OFFSET_DEVICE_ID); if ((info->device_id & 0xff) == 0x7E) { /* AMD 3-byte (expanded) device ids */ - info->device_id2 = flash_read_uchar (info, + info->device_id2 = flash_read_uchar(info, FLASH_OFFSET_DEVICE_ID2); info->device_id2 <<= 8; - info->device_id2 |= flash_read_uchar (info, + info->device_id2 |= flash_read_uchar(info, FLASH_OFFSET_DEVICE_ID3); } break; @@ -1765,7 +1765,7 @@ static int cmdset_amd_init(flash_info_t *info, struct cfi_qry *qry) } #ifdef CONFIG_FLASH_CFI_LEGACY -static void flash_read_jedec_ids (flash_info_t * info) +static void flash_read_jedec_ids(flash_info_t * info) { info->manufacturer_id = 0; info->device_id = 0; @@ -1860,7 +1860,7 @@ static inline int flash_detect_legacy(phys_addr_t base, int banknum) * detect if flash is compatible with the Common Flash Interface (CFI) * http://www.jedec.org/download/search/jesd68.pdf */ -static void flash_read_cfi (flash_info_t *info, void *buf, +static void flash_read_cfi(flash_info_t *info, void *buf, unsigned int start, size_t len) { u8 *p = buf; @@ -1884,7 +1884,7 @@ static void __flash_cmd_reset(flash_info_t *info) void flash_cmd_reset(flash_info_t *info) __attribute__((weak,alias("__flash_cmd_reset"))); -static int __flash_detect_cfi (flash_info_t * info, struct cfi_qry *qry) +static int __flash_detect_cfi(flash_info_t * info, struct cfi_qry *qry) { int cfi_offset; @@ -1893,21 +1893,21 @@ static int __flash_detect_cfi (flash_info_t * info, struct cfi_qry *qry) for (cfi_offset = 0; cfi_offset < ARRAY_SIZE(flash_offset_cfi); cfi_offset++) { - flash_write_cmd (info, 0, flash_offset_cfi[cfi_offset], + flash_write_cmd(info, 0, flash_offset_cfi[cfi_offset], FLASH_CMD_CFI); - if (flash_isequal (info, 0, FLASH_OFFSET_CFI_RESP, 'Q') - && flash_isequal (info, 0, FLASH_OFFSET_CFI_RESP + 1, 'R') - && flash_isequal (info, 0, FLASH_OFFSET_CFI_RESP + 2, 'Y')) { + if (flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP, 'Q') + && flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 1, 'R') + && flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 2, 'Y')) { flash_read_cfi(info, qry, FLASH_OFFSET_CFI_RESP, sizeof(struct cfi_qry)); info->interface = le16_to_cpu(qry->interface_desc); info->cfi_offset = flash_offset_cfi[cfi_offset]; - debug ("device interface is %d\n", + debug("device interface is %d\n", info->interface); - debug ("found port %d chip %d ", + debug("found port %d chip %d ", info->portwidth, info->chipwidth); - debug ("port %d bits chip %d bits\n", + debug("port %d bits chip %d bits\n", info->portwidth << CFI_FLASH_SHIFT_WIDTH, info->chipwidth << CFI_FLASH_SHIFT_WIDTH); @@ -1938,9 +1938,9 @@ static int __flash_detect_cfi (flash_info_t * info, struct cfi_qry *qry) return 0; } -static int flash_detect_cfi (flash_info_t * info, struct cfi_qry *qry) +static int flash_detect_cfi(flash_info_t * info, struct cfi_qry *qry) { - debug ("flash detect cfi\n"); + debug("flash detect cfi\n"); for (info->portwidth = CONFIG_SYS_FLASH_CFI_WIDTH; info->portwidth <= FLASH_CFI_64BIT; info->portwidth <<= 1) { @@ -1950,7 +1950,7 @@ static int flash_detect_cfi (flash_info_t * info, struct cfi_qry *qry) if (__flash_detect_cfi(info, qry)) return 1; } - debug ("not found\n"); + debug("not found\n"); return 0; } @@ -2057,7 +2057,7 @@ static void flash_fixup_num(flash_info_t *info, struct cfi_qry *qry) * The following code cannot be run from FLASH! * */ -ulong flash_get_size (phys_addr_t base, int banknum) +ulong flash_get_size(phys_addr_t base, int banknum) { flash_info_t *info = &flash_info[banknum]; int i, j; @@ -2081,20 +2081,20 @@ ulong flash_get_size (phys_addr_t base, int banknum) info->start[0] = (ulong)map_physmem(base, info->portwidth, MAP_NOCACHE); - if (flash_detect_cfi (info, &qry)) { + if (flash_detect_cfi(info, &qry)) { info->vendor = le16_to_cpu(get_unaligned(&(qry.p_id))); info->ext_addr = le16_to_cpu(get_unaligned(&(qry.p_adr))); num_erase_regions = qry.num_erase_regions; if (info->ext_addr) { - info->cfi_version = (ushort) flash_read_uchar (info, + info->cfi_version = (ushort) flash_read_uchar(info, info->ext_addr + 3) << 8; - info->cfi_version |= (ushort) flash_read_uchar (info, + info->cfi_version |= (ushort) flash_read_uchar(info, info->ext_addr + 4); } #ifdef DEBUG - flash_printqry (&qry); + flash_printqry(&qry); #endif switch (info->vendor) { @@ -2139,11 +2139,11 @@ ulong flash_get_size (phys_addr_t base, int banknum) break; } - debug ("manufacturer is %d\n", info->vendor); - debug ("manufacturer id is 0x%x\n", info->manufacturer_id); - debug ("device id is 0x%x\n", info->device_id); - debug ("device id2 is 0x%x\n", info->device_id2); - debug ("cfi version is 0x%04x\n", info->cfi_version); + debug("manufacturer is %d\n", info->vendor); + debug("manufacturer id is 0x%x\n", info->manufacturer_id); + debug("device id is 0x%x\n", info->device_id); + debug("device id2 is 0x%x\n", info->device_id2); + debug("cfi version is 0x%04x\n", info->cfi_version); size_ratio = info->portwidth / info->chipwidth; /* if the chip is x8/x16 reduce the ratio by half */ @@ -2151,7 +2151,7 @@ ulong flash_get_size (phys_addr_t base, int banknum) && (info->chipwidth == FLASH_CFI_BY8)) { size_ratio >>= 1; } - debug ("size_ratio %d port %d bits chip %d bits\n", + debug("size_ratio %d port %d bits chip %d bits\n", size_ratio, info->portwidth << CFI_FLASH_SHIFT_WIDTH, info->chipwidth << CFI_FLASH_SHIFT_WIDTH); info->size = 1 << qry.dev_size; @@ -2162,12 +2162,12 @@ ulong flash_get_size (phys_addr_t base, int banknum) debug("[truncated from %ldMiB]", info->size >> 20); info->size = max_size; } - debug ("found %d erase regions\n", num_erase_regions); + debug("found %d erase regions\n", num_erase_regions); sect_cnt = 0; sector = base; for (i = 0; i < num_erase_regions; i++) { if (i > NUM_ERASE_REGIONS) { - printf ("%d erase regions found, only %d used\n", + printf("%d erase regions found, only %d used\n", num_erase_regions, NUM_ERASE_REGIONS); break; } @@ -2180,7 +2180,7 @@ ulong flash_get_size (phys_addr_t base, int banknum) tmp >>= 16; erase_region_size = (tmp & 0xffff) ? ((tmp & 0xffff) * 256) : 128; - debug ("erase_region_count = %d erase_region_size = %d\n", + debug("erase_region_count = %d erase_region_size = %d\n", erase_region_count, erase_region_size); for (j = 0; j < erase_region_count; j++) { if (sector - base >= info->size) @@ -2211,7 +2211,7 @@ ulong flash_get_size (phys_addr_t base, int banknum) flash_write_cmd(info, sect_cnt, 0, FLASH_CMD_READ_ID); info->protect[sect_cnt] = - flash_isset (info, sect_cnt, + flash_isset(info, sect_cnt, FLASH_OFFSET_PROTECT, FLASH_STATUS_PROTECT); flash_write_cmd(info, sect_cnt, 0, @@ -2268,7 +2268,7 @@ ulong flash_get_size (phys_addr_t base, int banknum) info->portwidth >>= 1; } - flash_write_cmd (info, 0, 0, info->cmd_reset); + flash_write_cmd(info, 0, 0, info->cmd_reset); } return (info->size); @@ -2356,7 +2356,7 @@ static void flash_protect_default(void) #endif } -unsigned long flash_init (void) +unsigned long flash_init(void) { unsigned long size = 0; int i; @@ -2384,7 +2384,7 @@ unsigned long flash_init (void) size += flash_info[i].size; if (flash_info[i].flash_id == FLASH_UNKNOWN) { #ifndef CONFIG_SYS_FLASH_QUIET_TEST - printf ("## Unknown flash on Bank %d " + printf("## Unknown flash on Bank %d " "- Size = 0x%08lx = %ld MB\n", i+1, flash_info[i].size, flash_info[i].size >> 20); @@ -2416,7 +2416,7 @@ unsigned long flash_init (void) * unlock only one sector. This will * unlock all sectors. */ - flash_real_protect (&flash_info[i], 0, 0); + flash_real_protect(&flash_info[i], 0, 0); flash_info[i].legacy_unlock = 1; @@ -2430,7 +2430,7 @@ unsigned long flash_init (void) /* * No legancy unlocking -> unlock all sectors */ - flash_protect (FLAG_PROTECT_CLEAR, + flash_protect(FLAG_PROTECT_CLEAR, flash_info[i].start[0], flash_info[i].start[0] + flash_info[i].size - 1, From patchwork Fri Sep 29 12:51:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819966 X-Patchwork-Delegate: wd@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 3y3Xl154Tsz9rvt for ; Fri, 29 Sep 2017 23:41:00 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 0A6DDC21EB4; Fri, 29 Sep 2017 13:07:37 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 DA3B2C21DEF; Fri, 29 Sep 2017 12:55:27 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 513E1C21F3E; Fri, 29 Sep 2017 12:53:37 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id EFE00C21E5B for ; Fri, 29 Sep 2017 12:53:31 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxunK-00004w-T9; Fri, 29 Sep 2017 14:53:30 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:54 +0200 Message-Id: <20170929125238.26226-36-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 036/080] cfi_flash: Fix style of pointer declarations 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" Signed-off-by: Mario Six --- drivers/mtd/cfi_flash.c | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index b3dda8bd4a..1b0eb3398c 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -204,7 +204,7 @@ unsigned long flash_sector_size(flash_info_t *info, flash_sect_t sect) * create an address based on the offset and the port width */ static inline void * -flash_map(flash_info_t * info, flash_sect_t sect, uint offset) +flash_map(flash_info_t *info, flash_sect_t sect, uint offset) { unsigned int byte_offset = offset * info->portwidth; @@ -283,7 +283,7 @@ static void flash_printqry(struct cfi_qry *qry) /*----------------------------------------------------------------------- * read a character at a port width address */ -static inline uchar flash_read_uchar(flash_info_t * info, uint offset) +static inline uchar flash_read_uchar(flash_info_t *info, uint offset) { uchar *cp; uchar retval; @@ -301,7 +301,7 @@ static inline uchar flash_read_uchar(flash_info_t * info, uint offset) /*----------------------------------------------------------------------- * read a word at a port width address, assume 16bit bus */ -static inline ushort flash_read_word(flash_info_t * info, uint offset) +static inline ushort flash_read_word(flash_info_t *info, uint offset) { ushort *addr, retval; @@ -316,7 +316,7 @@ static inline ushort flash_read_word(flash_info_t * info, uint offset) * read a long word by picking the least significant byte of each maximum * port size word. Swap for ppc format. */ -static ulong flash_read_long (flash_info_t * info, flash_sect_t sect, +static ulong flash_read_long (flash_info_t *info, flash_sect_t sect, uint offset) { uchar *addr; @@ -402,7 +402,7 @@ static void flash_write_cmd(flash_info_t *info, flash_sect_t sect, flash_unmap(info, sect, offset, addr); } -static void flash_unlock_seq(flash_info_t * info, flash_sect_t sect) +static void flash_unlock_seq(flash_info_t *info, flash_sect_t sect) { flash_write_cmd(info, sect, info->addr_unlock1, AMD_CMD_UNLOCK_START); flash_write_cmd(info, sect, info->addr_unlock2, AMD_CMD_UNLOCK_ACK); @@ -410,7 +410,7 @@ static void flash_unlock_seq(flash_info_t * info, flash_sect_t sect) /*----------------------------------------------------------------------- */ -static int flash_isequal(flash_info_t * info, flash_sect_t sect, +static int flash_isequal(flash_info_t *info, flash_sect_t sect, uint offset, uchar cmd) { void *addr; @@ -458,7 +458,7 @@ static int flash_isequal(flash_info_t * info, flash_sect_t sect, /*----------------------------------------------------------------------- */ -static int flash_isset(flash_info_t * info, flash_sect_t sect, +static int flash_isset(flash_info_t *info, flash_sect_t sect, uint offset, uchar cmd) { void *addr; @@ -491,7 +491,7 @@ static int flash_isset(flash_info_t * info, flash_sect_t sect, /*----------------------------------------------------------------------- */ -static int flash_toggle(flash_info_t * info, flash_sect_t sect, +static int flash_toggle(flash_info_t *info, flash_sect_t sect, uint offset, uchar cmd) { void *addr; @@ -529,7 +529,7 @@ static int flash_toggle(flash_info_t * info, flash_sect_t sect, * This routine checks the status of the chip and returns true if the * chip is busy. */ -static int flash_is_busy(flash_info_t * info, flash_sect_t sect) +static int flash_is_busy(flash_info_t *info, flash_sect_t sect) { int retval; @@ -566,7 +566,7 @@ static int flash_is_busy(flash_info_t * info, flash_sect_t sect) * wait for XSR.7 to be set. Time out with an error if it does not. * This routine does not set the flash to read-array mode. */ -static int flash_status_check(flash_info_t * info, flash_sect_t sector, +static int flash_status_check(flash_info_t *info, flash_sect_t sector, ulong tout, char *prompt) { ulong start; @@ -604,7 +604,7 @@ static int flash_status_check(flash_info_t * info, flash_sect_t sector, * * This routine sets the flash to read-array mode. */ -static int flash_full_status_check(flash_info_t * info, flash_sect_t sector, +static int flash_full_status_check(flash_info_t *info, flash_sect_t sector, ulong tout, char *prompt) { int retcode; @@ -709,7 +709,7 @@ static int flash_status_poll(flash_info_t *info, void *src, void *dst, /*----------------------------------------------------------------------- */ -static void flash_add_byte(flash_info_t * info, cfiword_t * cword, uchar c) +static void flash_add_byte(flash_info_t *info, cfiword_t *cword, uchar c) { #if defined(__LITTLE_ENDIAN) && !defined(CONFIG_SYS_WRITE_SWAPPED_DATA) unsigned short w; @@ -755,7 +755,7 @@ static void flash_add_byte(flash_info_t * info, cfiword_t * cword, uchar c) * Loop through the sector table starting from the previously found sector. * Searches forwards or backwards, dependent on the passed address. */ -static flash_sect_t find_sector(flash_info_t * info, ulong addr) +static flash_sect_t find_sector(flash_info_t *info, ulong addr) { static flash_sect_t saved_sector; /* previously found sector */ static flash_info_t *saved_info; /* previously used flash bank */ @@ -781,7 +781,7 @@ static flash_sect_t find_sector(flash_info_t * info, ulong addr) /*----------------------------------------------------------------------- */ -static int flash_write_cfiword(flash_info_t * info, ulong dest, +static int flash_write_cfiword(flash_info_t *info, ulong dest, cfiword_t cword) { void *dstaddr = (void *)dest; @@ -869,7 +869,7 @@ static int flash_write_cfiword(flash_info_t * info, ulong dest, #ifdef CONFIG_SYS_FLASH_USE_BUFFER_WRITE -static int flash_write_cfibuffer(flash_info_t * info, ulong dest, uchar * cp, +static int flash_write_cfibuffer(flash_info_t *info, ulong dest, uchar *cp, int len) { flash_sect_t sector; @@ -1051,7 +1051,7 @@ out_unmap: /*----------------------------------------------------------------------- */ -int flash_erase(flash_info_t * info, int s_first, int s_last) +int flash_erase(flash_info_t *info, int s_first, int s_last) { int rcode = 0; int prot; @@ -1200,7 +1200,7 @@ static int sector_erased(flash_info_t *info, int i) } #endif /* CONFIG_SYS_FLASH_EMPTY_INFO */ -void flash_print_info(flash_info_t * info) +void flash_print_info(flash_info_t *info) { int i; @@ -1315,7 +1315,7 @@ void flash_print_info(flash_info_t * info) * 1 - write timeout * 2 - Flash not erased */ -int write_buff(flash_info_t * info, uchar * src, ulong addr, ulong cnt) +int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt) { ulong wp; uchar *p; @@ -1475,7 +1475,7 @@ static int cfi_protect_bugfix(flash_info_t *info, long sector, int prot) return 0; } -int flash_real_protect(flash_info_t * info, long sector, int prot) +int flash_real_protect(flash_info_t *info, long sector, int prot) { int retcode = 0; @@ -1601,7 +1601,7 @@ int flash_real_protect(flash_info_t * info, long sector, int prot) /*----------------------------------------------------------------------- * flash_read_user_serial - read the OneTimeProgramming cells */ -void flash_read_user_serial(flash_info_t * info, void *buffer, int offset, +void flash_read_user_serial(flash_info_t *info, void *buffer, int offset, int len) { uchar *src; @@ -1619,7 +1619,7 @@ void flash_read_user_serial(flash_info_t * info, void *buffer, int offset, /* * flash_read_factory_serial - read the device Id from the protection area */ -void flash_read_factory_serial(flash_info_t * info, void *buffer, int offset, +void flash_read_factory_serial(flash_info_t *info, void *buffer, int offset, int len) { uchar *src; @@ -1765,7 +1765,7 @@ static int cmdset_amd_init(flash_info_t *info, struct cfi_qry *qry) } #ifdef CONFIG_FLASH_CFI_LEGACY -static void flash_read_jedec_ids(flash_info_t * info) +static void flash_read_jedec_ids(flash_info_t *info) { info->manufacturer_id = 0; info->device_id = 0; @@ -1884,7 +1884,7 @@ static void __flash_cmd_reset(flash_info_t *info) void flash_cmd_reset(flash_info_t *info) __attribute__((weak,alias("__flash_cmd_reset"))); -static int __flash_detect_cfi(flash_info_t * info, struct cfi_qry *qry) +static int __flash_detect_cfi(flash_info_t *info, struct cfi_qry *qry) { int cfi_offset; @@ -1938,7 +1938,7 @@ static int __flash_detect_cfi(flash_info_t * info, struct cfi_qry *qry) return 0; } -static int flash_detect_cfi(flash_info_t * info, struct cfi_qry *qry) +static int flash_detect_cfi(flash_info_t *info, struct cfi_qry *qry) { debug("flash detect cfi\n"); From patchwork Fri Sep 29 12:51:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819916 X-Patchwork-Delegate: wd@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 3y3X5434kmz9t2Q for ; Fri, 29 Sep 2017 23:11:36 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 2304CC21E90; Fri, 29 Sep 2017 13:09:48 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 04691C21F3E; Fri, 29 Sep 2017 12:56:17 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 44CF4C21E64; Fri, 29 Sep 2017 12:53:40 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 2A37DC21EA2 for ; Fri, 29 Sep 2017 12:53:36 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxunP-00004w-Ia; Fri, 29 Sep 2017 14:53:35 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:55 +0200 Message-Id: <20170929125238.26226-37-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 037/080] cfi_flash: Fix Parenthesis spacing 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" Signed-off-by: Mario Six --- drivers/mtd/cfi_flash.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 1b0eb3398c..03bfb634cc 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -230,7 +230,7 @@ static void flash_make_cmd(flash_info_t *info, u32 cmd, void *cmdbuf) uchar val; uchar *cp = (uchar *) cmdbuf; - for (i = info->portwidth; i > 0; i--){ + for (i = info->portwidth; i > 0; i--) { cword_offset = (info->portwidth-i)%info->chipwidth; #if defined(__LITTLE_ENDIAN) || defined(CONFIG_SYS_WRITE_SWAPPED_DATA) cp_offset = info->portwidth - i; @@ -511,8 +511,8 @@ static int flash_toggle(flash_info_t *info, flash_sect_t sect, retval = flash_read32(addr) != flash_read32(addr); break; case FLASH_CFI_64BIT: - retval = ( (flash_read32( addr ) != flash_read32( addr )) || - (flash_read32(addr+4) != flash_read32(addr+4)) ); + retval = ((flash_read32(addr) != flash_read32(addr)) || + (flash_read32(addr+4) != flash_read32(addr+4))); break; default: retval = 0; @@ -1713,7 +1713,7 @@ static void cmdset_amd_read_jedec_ids(flash_info_t *info) lsbits = flash_read_uchar(info, FLASH_OFFSET_LOWER_SW_BITS); info->sr_supported = lsbits & BIT(0); - switch (info->chipwidth){ + switch (info->chipwidth) { case FLASH_CFI_8BIT: info->device_id = flash_read_uchar(info, FLASH_OFFSET_DEVICE_ID); @@ -1832,7 +1832,7 @@ static int flash_detect_legacy(phys_addr_t base, int banknum) } } - switch(info->vendor) { + switch (info->vendor) { case CFI_CMDSET_INTEL_PROG_REGIONS: case CFI_CMDSET_INTEL_STANDARD: case CFI_CMDSET_INTEL_EXTENDED: @@ -1919,12 +1919,12 @@ static int __flash_detect_cfi(flash_info_t *info, struct cfi_qry *qry) * modify the unlock address if we are * in compatibility mode */ - if ( /* x8/x16 in x8 mode */ - ((info->chipwidth == FLASH_CFI_BY8) && - (info->interface == FLASH_CFI_X8X16)) || - /* x16/x32 in x16 mode */ - ((info->chipwidth == FLASH_CFI_BY16) && - (info->interface == FLASH_CFI_X16X32))) + if (/* x8/x16 in x8 mode */ + ((info->chipwidth == FLASH_CFI_BY8) && + (info->interface == FLASH_CFI_X8X16)) || + /* x16/x32 in x16 mode */ + ((info->chipwidth == FLASH_CFI_BY16) && + (info->interface == FLASH_CFI_X16X32))) { info->addr_unlock1 = 0xaaa; info->addr_unlock2 = 0x555; From patchwork Fri Sep 29 12:51:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819928 X-Patchwork-Delegate: wd@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 3y3XLr6GF3z9t4g for ; Fri, 29 Sep 2017 23:23:32 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 954E3C21E3B; Fri, 29 Sep 2017 13:05:25 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 BDE92C21E35; Fri, 29 Sep 2017 12:55:02 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A7341C21E35; Fri, 29 Sep 2017 12:53:41 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id D32B0C21E76 for ; Fri, 29 Sep 2017 12:53:36 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxunQ-00004w-8i; Fri, 29 Sep 2017 14:53:36 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:56 +0200 Message-Id: <20170929125238.26226-38-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 038/080] cfi_flash: Fix whitespace with casting 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" Signed-off-by: Mario Six --- drivers/mtd/cfi_flash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 03bfb634cc..8c62648642 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -234,10 +234,10 @@ static void flash_make_cmd(flash_info_t *info, u32 cmd, void *cmdbuf) cword_offset = (info->portwidth-i)%info->chipwidth; #if defined(__LITTLE_ENDIAN) || defined(CONFIG_SYS_WRITE_SWAPPED_DATA) cp_offset = info->portwidth - i; - val = *((uchar*)&cmd_le + cword_offset); + val = *((uchar *)&cmd_le + cword_offset); #else cp_offset = i - 1; - val = *((uchar*)&cmd + sizeof(u32) - cword_offset - 1); + val = *((uchar *)&cmd + sizeof(u32) - cword_offset - 1); #endif cp[cp_offset] = (cword_offset >= sizeof(u32)) ? 0x00 : val; } From patchwork Fri Sep 29 12:51:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819954 X-Patchwork-Delegate: wd@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 3y3XZL5fnlz9rxj for ; Fri, 29 Sep 2017 23:33:30 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 7A94FC21E1E; Fri, 29 Sep 2017 13:07: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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 ACC14C21F38; Fri, 29 Sep 2017 12:55:08 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 20AEAC21F32; Fri, 29 Sep 2017 12:53:46 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id B6B29C21D8D for ; Fri, 29 Sep 2017 12:53:41 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxunU-00004w-U5; Fri, 29 Sep 2017 14:53:41 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:57 +0200 Message-Id: <20170929125238.26226-39-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 039/080] cfi_flash: Fix indent of case statements 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" Signed-off-by: Mario Six --- drivers/mtd/cfi_flash.c | 200 ++++++++++++++++++++++++------------------------ 1 file changed, 100 insertions(+), 100 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 8c62648642..a766facb2a 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1220,29 +1220,29 @@ void flash_print_info(flash_info_t *info) info->size >> 20, info->sector_count); printf(" "); switch (info->vendor) { - case CFI_CMDSET_INTEL_PROG_REGIONS: - printf("Intel Prog Regions"); - break; - case CFI_CMDSET_INTEL_STANDARD: - printf("Intel Standard"); - break; - case CFI_CMDSET_INTEL_EXTENDED: - printf("Intel Extended"); - break; - case CFI_CMDSET_AMD_STANDARD: - printf("AMD Standard"); - break; - case CFI_CMDSET_AMD_EXTENDED: - printf("AMD Extended"); - break; + case CFI_CMDSET_INTEL_PROG_REGIONS: + printf("Intel Prog Regions"); + break; + case CFI_CMDSET_INTEL_STANDARD: + printf("Intel Standard"); + break; + case CFI_CMDSET_INTEL_EXTENDED: + printf("Intel Extended"); + break; + case CFI_CMDSET_AMD_STANDARD: + printf("AMD Standard"); + break; + case CFI_CMDSET_AMD_EXTENDED: + printf("AMD Extended"); + break; #ifdef CONFIG_FLASH_CFI_LEGACY - case CFI_CMDSET_AMD_LEGACY: - printf("AMD Legacy"); - break; + case CFI_CMDSET_AMD_LEGACY: + printf("AMD Legacy"); + break; #endif - default: - printf("Unknown (%d)", info->vendor); - break; + default: + printf("Unknown (%d)", info->vendor); + break; } printf(" command set, Manufacturer ID: 0x%02X, Device ID: 0x", info->manufacturer_id); @@ -1480,94 +1480,94 @@ int flash_real_protect(flash_info_t *info, long sector, int prot) int retcode = 0; switch (info->vendor) { - case CFI_CMDSET_INTEL_PROG_REGIONS: - case CFI_CMDSET_INTEL_STANDARD: - case CFI_CMDSET_INTEL_EXTENDED: - if (!cfi_protect_bugfix(info, sector, prot)) { + case CFI_CMDSET_INTEL_PROG_REGIONS: + case CFI_CMDSET_INTEL_STANDARD: + case CFI_CMDSET_INTEL_EXTENDED: + if (!cfi_protect_bugfix(info, sector, prot)) { + flash_write_cmd(info, sector, 0, + FLASH_CMD_CLEAR_STATUS); + flash_write_cmd(info, sector, 0, + FLASH_CMD_PROTECT); + if (prot) flash_write_cmd(info, sector, 0, - FLASH_CMD_CLEAR_STATUS); + FLASH_CMD_PROTECT_SET); + else flash_write_cmd(info, sector, 0, - FLASH_CMD_PROTECT); - if (prot) - flash_write_cmd(info, sector, 0, - FLASH_CMD_PROTECT_SET); - else - flash_write_cmd(info, sector, 0, - FLASH_CMD_PROTECT_CLEAR); + FLASH_CMD_PROTECT_CLEAR); + } + break; + case CFI_CMDSET_AMD_EXTENDED: + case CFI_CMDSET_AMD_STANDARD: + /* U-Boot only checks the first byte */ + if (manufact_match(info, ATM_MANUFACT)) { + if (prot) { + flash_unlock_seq(info, 0); + flash_write_cmd(info, 0, + info->addr_unlock1, + ATM_CMD_SOFTLOCK_START); + flash_unlock_seq(info, 0); + flash_write_cmd(info, sector, 0, + ATM_CMD_LOCK_SECT); + } else { + flash_write_cmd(info, 0, + info->addr_unlock1, + AMD_CMD_UNLOCK_START); + if (info->device_id == ATM_ID_BV6416) + flash_write_cmd(info, sector, + 0, ATM_CMD_UNLOCK_SECT); } - break; - case CFI_CMDSET_AMD_EXTENDED: - case CFI_CMDSET_AMD_STANDARD: - /* U-Boot only checks the first byte */ - if (manufact_match(info, ATM_MANUFACT)) { - if (prot) { - flash_unlock_seq(info, 0); - flash_write_cmd(info, 0, - info->addr_unlock1, - ATM_CMD_SOFTLOCK_START); - flash_unlock_seq(info, 0); + } + if (info->legacy_unlock) { + int flag = disable_interrupts(); + int lock_flag; + + flash_unlock_seq(info, 0); + flash_write_cmd(info, 0, info->addr_unlock1, + AMD_CMD_SET_PPB_ENTRY); + lock_flag = flash_isset(info, sector, 0, 0x01); + if (prot) { + if (lock_flag) { flash_write_cmd(info, sector, 0, - ATM_CMD_LOCK_SECT); - } else { - flash_write_cmd(info, 0, - info->addr_unlock1, - AMD_CMD_UNLOCK_START); - if (info->device_id == ATM_ID_BV6416) - flash_write_cmd(info, sector, - 0, ATM_CMD_UNLOCK_SECT); + AMD_CMD_PPB_LOCK_BC1); + flash_write_cmd(info, sector, 0, + AMD_CMD_PPB_LOCK_BC2); } - } - if (info->legacy_unlock) { - int flag = disable_interrupts(); - int lock_flag; - - flash_unlock_seq(info, 0); - flash_write_cmd(info, 0, info->addr_unlock1, - AMD_CMD_SET_PPB_ENTRY); - lock_flag = flash_isset(info, sector, 0, 0x01); - if (prot) { - if (lock_flag) { - flash_write_cmd(info, sector, 0, - AMD_CMD_PPB_LOCK_BC1); - flash_write_cmd(info, sector, 0, - AMD_CMD_PPB_LOCK_BC2); - } - debug("sector %ld %slocked\n", sector, - lock_flag ? "" : "already "); - } else { - if (!lock_flag) { - debug("unlock %ld\n", sector); - flash_write_cmd(info, 0, 0, - AMD_CMD_PPB_UNLOCK_BC1); - flash_write_cmd(info, 0, 0, - AMD_CMD_PPB_UNLOCK_BC2); - } - debug("sector %ld %sunlocked\n", sector, - !lock_flag ? "" : "already "); + debug("sector %ld %slocked\n", sector, + lock_flag ? "" : "already "); + } else { + if (!lock_flag) { + debug("unlock %ld\n", sector); + flash_write_cmd(info, 0, 0, + AMD_CMD_PPB_UNLOCK_BC1); + flash_write_cmd(info, 0, 0, + AMD_CMD_PPB_UNLOCK_BC2); } - if (flag) - enable_interrupts(); - - if (flash_status_check(info, sector, - info->erase_blk_tout, - prot ? "protect" : "unprotect")) - printf("status check error\n"); - - flash_write_cmd(info, 0, 0, - AMD_CMD_SET_PPB_EXIT_BC1); - flash_write_cmd(info, 0, 0, - AMD_CMD_SET_PPB_EXIT_BC2); + debug("sector %ld %sunlocked\n", sector, + !lock_flag ? "" : "already "); } - break; + if (flag) + enable_interrupts(); + + if (flash_status_check(info, sector, + info->erase_blk_tout, + prot ? "protect" : "unprotect")) + printf("status check error\n"); + + flash_write_cmd(info, 0, 0, + AMD_CMD_SET_PPB_EXIT_BC1); + flash_write_cmd(info, 0, 0, + AMD_CMD_SET_PPB_EXIT_BC2); + } + break; #ifdef CONFIG_FLASH_CFI_LEGACY - case CFI_CMDSET_AMD_LEGACY: - flash_write_cmd(info, sector, 0, FLASH_CMD_CLEAR_STATUS); - flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT); - if (prot) - flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT_SET); - else - flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT_CLEAR); + case CFI_CMDSET_AMD_LEGACY: + flash_write_cmd(info, sector, 0, FLASH_CMD_CLEAR_STATUS); + flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT); + if (prot) + flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT_SET); + else + flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT_CLEAR); #endif }; From patchwork Fri Sep 29 12:51:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819973 X-Patchwork-Delegate: wd@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 3y3Xrs1LBnz9t3f for ; Fri, 29 Sep 2017 23:46:05 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id DAE65C21E8E; Fri, 29 Sep 2017 13:08:23 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 7D79EC21F43; Fri, 29 Sep 2017 12:55:35 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A34D1C21DA0; Fri, 29 Sep 2017 12:53:46 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 2D76DC21E26 for ; Fri, 29 Sep 2017 12:53:42 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxunV-00004w-HE; Fri, 29 Sep 2017 14:53:41 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:58 +0200 Message-Id: <20170929125238.26226-40-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 040/080] cfi_flash: Fix spacing around casts/operators 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" Signed-off-by: Mario Six --- drivers/mtd/cfi_flash.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index a766facb2a..a28f5eaea9 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -231,7 +231,7 @@ static void flash_make_cmd(flash_info_t *info, u32 cmd, void *cmdbuf) uchar *cp = (uchar *) cmdbuf; for (i = info->portwidth; i > 0; i--) { - cword_offset = (info->portwidth-i)%info->chipwidth; + cword_offset = (info->portwidth - i) % info->chipwidth; #if defined(__LITTLE_ENDIAN) || defined(CONFIG_SYS_WRITE_SWAPPED_DATA) cp_offset = info->portwidth - i; val = *((uchar *)&cmd_le + cword_offset); @@ -252,7 +252,7 @@ static void print_longlong(char *str, unsigned long long data) int i; char *cp; - cp = (char *) &data; + cp = (char *)&data; for (i = 0; i < 8; i++) sprintf(&str[i * 2], "%2.2x", *cp++); } @@ -512,7 +512,7 @@ static int flash_toggle(flash_info_t *info, flash_sect_t sect, break; case FLASH_CFI_64BIT: retval = ((flash_read32(addr) != flash_read32(addr)) || - (flash_read32(addr+4) != flash_read32(addr+4))); + (flash_read32(addr + 4) != flash_read32(addr + 4))); break; default: retval = 0; @@ -1212,7 +1212,7 @@ void flash_print_info(flash_info_t *info) printf("%s flash (%d x %d)", info->name, (info->portwidth << 3), (info->chipwidth << 3)); - if (info->size < 1024*1024) + if (info->size < 1024 * 1024) printf(" Size: %ld kB in %d Sectors\n", info->size >> 10, info->sector_count); else @@ -1882,7 +1882,7 @@ static void __flash_cmd_reset(flash_info_t *info) flash_write_cmd(info, 0, 0, FLASH_CMD_RESET); } void flash_cmd_reset(flash_info_t *info) - __attribute__((weak,alias("__flash_cmd_reset"))); + __attribute__((weak, alias("__flash_cmd_reset"))); static int __flash_detect_cfi(flash_info_t *info, struct cfi_qry *qry) { @@ -2029,7 +2029,7 @@ static void flash_fixup_sst(flash_info_t *info, struct cfi_qry *qry) if (info->device_id == 0x5D23 || /* SST39VF3201B */ info->device_id == 0x5C23) { /* SST39VF3202B */ /* set sector granularity to 4KB */ - info->cmd_erase_sector=0x50; + info->cmd_erase_sector = 0x50; } } @@ -2087,9 +2087,9 @@ ulong flash_get_size(phys_addr_t base, int banknum) num_erase_regions = qry.num_erase_regions; if (info->ext_addr) { - info->cfi_version = (ushort) flash_read_uchar(info, + info->cfi_version = (ushort)flash_read_uchar(info, info->ext_addr + 3) << 8; - info->cfi_version |= (ushort) flash_read_uchar(info, + info->cfi_version |= (ushort)flash_read_uchar(info, info->ext_addr + 4); } @@ -2386,7 +2386,7 @@ unsigned long flash_init(void) #ifndef CONFIG_SYS_FLASH_QUIET_TEST printf("## Unknown flash on Bank %d " "- Size = 0x%08lx = %ld MB\n", - i+1, flash_info[i].size, + i + 1, flash_info[i].size, flash_info[i].size >> 20); #endif /* CONFIG_SYS_FLASH_QUIET_TEST */ } From patchwork Fri Sep 29 12:51:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819971 X-Patchwork-Delegate: wd@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 3y3XnC2vSNz9rvt for ; Fri, 29 Sep 2017 23:42:55 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 1FE17C21DB2; Fri, 29 Sep 2017 13:09: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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 DD017C21EFC; Fri, 29 Sep 2017 12:55:55 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BAF85C21F3E; Fri, 29 Sep 2017 12:53:51 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 98B16C21EA7 for ; Fri, 29 Sep 2017 12:53:46 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxunZ-00004w-Tj; Fri, 29 Sep 2017 14:53:46 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:51:59 +0200 Message-Id: <20170929125238.26226-41-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 041/080] cfi_flash: Fix missing/superfluous lines 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" Signed-off-by: Mario Six --- drivers/mtd/cfi_flash.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index a28f5eaea9..1ccb05091d 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -269,6 +269,7 @@ static void flash_printqry(struct cfi_qry *qry) debug(" "); for (y = 0; y < 16; y++) { unsigned char c = p[x + y]; + if (c >= 0x20 && c <= 0x7e) debug("%c", c); else @@ -279,7 +280,6 @@ static void flash_printqry(struct cfi_qry *qry) } #endif - /*----------------------------------------------------------------------- * read a character at a port width address */ @@ -311,7 +311,6 @@ static inline ushort flash_read_word(flash_info_t *info, uint offset) return retval; } - /*----------------------------------------------------------------------- * read a long word by picking the least significant byte of each maximum * port size word. Swap for ppc format. @@ -356,7 +355,6 @@ static ulong flash_read_long (flash_info_t *info, flash_sect_t sect, static void flash_write_cmd(flash_info_t *info, flash_sect_t sect, uint offset, u32 cmd) { - void *addr; cfiword_t cword; @@ -1048,7 +1046,6 @@ out_unmap: } #endif /* CONFIG_SYS_FLASH_USE_BUFFER_WRITE */ - /*----------------------------------------------------------------------- */ int flash_erase(flash_info_t *info, int s_first, int s_last) @@ -1080,7 +1077,6 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) putc('\n'); } - for (sect = s_first; sect <= s_last; sect++) { if (ctrlc()) { printf("\n"); @@ -1154,6 +1150,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) if (use_flash_status_poll(info)) { cfiword_t cword; void *dest; + cword.w64 = 0xffffffffffffffffULL; dest = flash_map(info, sect, 0); st = flash_status_poll(info, &cword, dest, @@ -1494,7 +1491,6 @@ int flash_real_protect(flash_info_t *info, long sector, int prot) else flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT_CLEAR); - } break; case CFI_CMDSET_AMD_EXTENDED: @@ -1579,7 +1575,6 @@ int flash_real_protect(flash_info_t *info, long sector, int prot) if ((retcode = flash_full_status_check(info, sector, info->erase_blk_tout, prot ? "protect" : "unprotect")) == 0) { - info->protect[sector] = prot; /* @@ -1881,6 +1876,7 @@ static void __flash_cmd_reset(flash_info_t *info) udelay(1); flash_write_cmd(info, 0, 0, FLASH_CMD_RESET); } + void flash_cmd_reset(flash_info_t *info) __attribute__((weak, alias("__flash_cmd_reset"))); @@ -2364,6 +2360,7 @@ unsigned long flash_init(void) #ifdef CONFIG_SYS_FLASH_PROTECTION /* read environment from EEPROM */ char s[64]; + env_get_f("unlock", s, sizeof(s)); #endif From patchwork Fri Sep 29 12:52:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819926 X-Patchwork-Delegate: wd@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 3y3XHw1jhrz9t32 for ; Fri, 29 Sep 2017 23:21:00 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 9E07AC21DC5; Fri, 29 Sep 2017 13:05:40 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 1FD7EC21E1D; Fri, 29 Sep 2017 12:55:04 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 65182C21E2C; Fri, 29 Sep 2017 12:53:51 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 5EAFCC21E65 for ; Fri, 29 Sep 2017 12:53:47 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxuna-00004w-OG; Fri, 29 Sep 2017 14:53:46 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:00 +0200 Message-Id: <20170929125238.26226-42-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 042/080] cfi_flash: Remove braces for single-statement blocks 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" Signed-off-by: Mario Six --- drivers/mtd/cfi_flash.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 1ccb05091d..06795fe754 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -329,9 +329,8 @@ static ulong flash_read_long (flash_info_t *info, flash_sect_t sect, #ifdef DEBUG debug("long addr is at %p info->portwidth = %d\n", addr, info->portwidth); - for (x = 0; x < 4 * info->portwidth; x++) { + for (x = 0; x < 4 * info->portwidth; x++) debug("addr[%x] = 0x%x\n", x, flash_read8(addr + x)); - } #endif #if defined(__LITTLE_ENDIAN) || defined(CONFIG_SYS_WRITE_SWAPPED_DATA) retval = ((flash_read8(addr) << 16) | @@ -1065,11 +1064,9 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) } prot = 0; - for (sect = s_first; sect <= s_last; ++sect) { - if (info->protect[sect]) { + for (sect = s_first; sect <= s_last; ++sect) + if (info->protect[sect]) prot++; - } - } if (prot) { printf("- Warning: %d protected sectors will not be erased!\n", prot); @@ -1396,9 +1393,8 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt) #else while (cnt >= info->portwidth) { cword.w32 = 0; - for (i = 0; i < info->portwidth; i++) { + for (i = 0; i < info->portwidth; i++) flash_add_byte(info, &cword, *src++); - } if ((rc = flash_write_cfiword(info, wp, cword)) != 0) return rc; wp += info->portwidth; @@ -1410,9 +1406,8 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt) } #endif /* CONFIG_SYS_FLASH_USE_BUFFER_WRITE */ - if (cnt == 0) { + if (cnt == 0) return (0); - } /* * handle unaligned tail bytes From patchwork Fri Sep 29 12:52:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819963 X-Patchwork-Delegate: wd@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 3y3XgR3mWQz9t2x for ; Fri, 29 Sep 2017 23:37:55 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 48AF2C21E84; Fri, 29 Sep 2017 13:04:21 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 73FE5C21E54; Fri, 29 Sep 2017 12:54:40 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 64C75C21E21; Fri, 29 Sep 2017 12:53:52 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 49D9FC21E6C for ; Fri, 29 Sep 2017 12:53:48 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxunb-00004w-Mq; Fri, 29 Sep 2017 14:53:47 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:01 +0200 Message-Id: <20170929125238.26226-43-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 043/080] cfi_flash: Fix logical continuations 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" Signed-off-by: Mario Six --- drivers/mtd/cfi_flash.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 06795fe754..b73b72bcee 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -611,8 +611,8 @@ static int flash_full_status_check(flash_info_t *info, flash_sect_t sector, case CFI_CMDSET_INTEL_PROG_REGIONS: case CFI_CMDSET_INTEL_EXTENDED: case CFI_CMDSET_INTEL_STANDARD: - if ((retcode == ERR_OK) - && !flash_isset(info, sector, 0, FLASH_STATUS_DONE)) { + if ((retcode == ERR_OK) && + !flash_isset(info, sector, 0, FLASH_STATUS_DONE)) { retcode = ERR_INVAL; printf("Flash %s error at address %lx\n", prompt, info->start[sector]); @@ -761,8 +761,8 @@ static flash_sect_t find_sector(flash_info_t *info, ulong addr) if ((info != saved_info) || (sector >= info->sector_count)) sector = 0; - while ((info->start[sector] < addr) - && (sector < info->sector_count - 1)) + while ((info->start[sector] < addr) && + (sector < info->sector_count - 1)) sector++; while ((info->start[sector] > addr) && (sector > 0)) /* @@ -1435,8 +1435,8 @@ static inline int manufact_match(flash_info_t *info, u32 manu) static int cfi_protect_bugfix(flash_info_t *info, long sector, int prot) { - if (manufact_match(info, INTEL_MANUFACT) - && info->device_id == NUMONYX_256MBIT) { + if (manufact_match(info, INTEL_MANUFACT) && + info->device_id == NUMONYX_256MBIT) { /* * see errata called * "Numonyx Axcell P33/P30 Specification Update" :) @@ -1801,8 +1801,8 @@ static int flash_detect_legacy(phys_addr_t base, int banknum) (ulong)map_physmem(base, info->portwidth, MAP_NOCACHE); - if (info->portwidth == FLASH_CFI_8BIT - && info->interface == FLASH_CFI_X8X16) { + if (info->portwidth == FLASH_CFI_8BIT && + info->interface == FLASH_CFI_X8X16) { info->addr_unlock1 = 0x2AAA; info->addr_unlock2 = 0x5555; } else { @@ -1886,9 +1886,9 @@ static int __flash_detect_cfi(flash_info_t *info, struct cfi_qry *qry) cfi_offset++) { flash_write_cmd(info, 0, flash_offset_cfi[cfi_offset], FLASH_CMD_CFI); - if (flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP, 'Q') - && flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 1, 'R') - && flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 2, 'Y')) { + if (flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP, 'Q') && + flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 1, 'R') && + flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 2, 'Y')) { flash_read_cfi(info, qry, FLASH_OFFSET_CFI_RESP, sizeof(struct cfi_qry)); info->interface = le16_to_cpu(qry->interface_desc); @@ -2138,8 +2138,8 @@ ulong flash_get_size(phys_addr_t base, int banknum) size_ratio = info->portwidth / info->chipwidth; /* if the chip is x8/x16 reduce the ratio by half */ - if ((info->interface == FLASH_CFI_X8X16) - && (info->chipwidth == FLASH_CFI_BY8)) { + if ((info->interface == FLASH_CFI_X8X16) && + (info->chipwidth == FLASH_CFI_BY8)) { size_ratio >>= 1; } debug("size_ratio %d port %d bits chip %d bits\n", From patchwork Fri Sep 29 12:52:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819929 X-Patchwork-Delegate: wd@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 3y3XM04nscz9t32 for ; Fri, 29 Sep 2017 23:23:40 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 58A06C21E18; Fri, 29 Sep 2017 13:03:48 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 CC958C21E8B; Fri, 29 Sep 2017 12:54:21 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0371BC21E0A; Fri, 29 Sep 2017 12:53:57 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id E579AC21E65 for ; Fri, 29 Sep 2017 12:53:52 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxung-00004w-DA; Fri, 29 Sep 2017 14:53:52 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:02 +0200 Message-Id: <20170929125238.26226-44-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 044/080] cfi_flash: Use __func__ macro instead of function name 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" Signed-off-by: Mario Six --- drivers/mtd/cfi_flash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index b73b72bcee..2ec8f5a27b 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -555,7 +555,7 @@ static int flash_is_busy(flash_info_t *info, flash_sect_t sect) default: retval = 0; } - debug("flash_is_busy: %d\n", retval); + debug("%s: %d\n", __func__, retval); return retval; } From patchwork Fri Sep 29 12:52:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819964 X-Patchwork-Delegate: wd@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 3y3XhJ0FFgz9t2x for ; Fri, 29 Sep 2017 23:38:39 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id DB3C1C21E39; Fri, 29 Sep 2017 13:04:37 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 11495C21EB4; Fri, 29 Sep 2017 12:54:43 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 16F2AC21E3B; Fri, 29 Sep 2017 12:53:58 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 00F6FC21E8B for ; Fri, 29 Sep 2017 12:53:53 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxung-00004w-It; Fri, 29 Sep 2017 14:53:52 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:03 +0200 Message-Id: <20170929125238.26226-45-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 045/080] cfi_flash: Fix comment style 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" Signed-off-by: Mario Six --- drivers/mtd/cfi_flash.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 2ec8f5a27b..5576092d8f 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -946,7 +946,8 @@ static int flash_write_cfibuffer(flash_info_t *info, ulong dest, uchar *cp, "write to buffer"); if (retcode == ERR_OK) { /* reduce the number of loops by the width of - * the port */ + * the port + */ cnt = len >> shift; flash_write_cmd(info, sector, 0, cnt - 1); while (cnt-- > 0) { @@ -1787,7 +1788,8 @@ static int flash_detect_legacy(phys_addr_t base, int banknum) if (board_flash_get_legacy(base, banknum, info)) { /* board code may have filled info completely. If not, we - use JEDEC ID probing. */ + * use JEDEC ID probing. + */ if (!info->vendor) { int modes[] = { CFI_CMDSET_AMD_STANDARD, From patchwork Fri Sep 29 12:52:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819939 X-Patchwork-Delegate: wd@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 3y3XRr5gqjz9t3s for ; Fri, 29 Sep 2017 23:27:52 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 6B1C0C21E65; Fri, 29 Sep 2017 13:08:39 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 869A4C21F2A; Fri, 29 Sep 2017 12:55:47 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 297EBC21E6C; Fri, 29 Sep 2017 12:54:01 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 59AE6C21EF0 for ; Fri, 29 Sep 2017 12:53:57 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxunk-00004w-Od; Fri, 29 Sep 2017 14:53:56 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:04 +0200 Message-Id: <20170929125238.26226-46-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 046/080] cfi_flash: Remove unnecessary braces 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" Signed-off-by: Mario Six --- drivers/mtd/cfi_flash.c | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 5576092d8f..229e0a8177 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -611,7 +611,7 @@ static int flash_full_status_check(flash_info_t *info, flash_sect_t sector, case CFI_CMDSET_INTEL_PROG_REGIONS: case CFI_CMDSET_INTEL_EXTENDED: case CFI_CMDSET_INTEL_STANDARD: - if ((retcode == ERR_OK) && + if (retcode == ERR_OK && !flash_isset(info, sector, 0, FLASH_STATUS_DONE)) { retcode = ERR_INVAL; printf("Flash %s error at address %lx\n", prompt, @@ -758,7 +758,7 @@ static flash_sect_t find_sector(flash_info_t *info, ulong addr) static flash_info_t *saved_info; /* previously used flash bank */ flash_sect_t sector = saved_sector; - if ((info != saved_info) || (sector >= info->sector_count)) + if (info != saved_info || sector >= info->sector_count) sector = 0; while ((info->start[sector] < addr) && @@ -1059,7 +1059,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) puts("Can't erase unknown flash type - aborted\n"); return 1; } - if ((s_first < 0) || (s_first > s_last)) { + if (s_first < 0 || s_first > s_last) { puts("- no sectors to erase\n"); return 1; } @@ -1247,7 +1247,7 @@ void flash_print_info(flash_info_t *info) printf(info->chipwidth == FLASH_CFI_16BIT ? "%04X" : "%02X", info->device_id2); } - if ((info->vendor == CFI_CMDSET_AMD_STANDARD) && (info->legacy_unlock)) + if (info->vendor == CFI_CMDSET_AMD_STANDARD && info->legacy_unlock) printf("\n Advanced Sector Protection (PPB) enabled"); printf("\n Erase timeout: %ld ms, write timeout: %ld ms\n", info->erase_blk_tout, @@ -1291,7 +1291,7 @@ void flash_print_info(flash_info_t *info) #define FLASH_SHOW_PROGRESS(scale, dots, digit, dots_sub) \ if (flash_verbose) { \ dots -= dots_sub; \ - if ((scale > 0) && (dots <= 0)) { \ + if (scale > 0 && dots <= 0) { \ if ((digit % 5) == 0) \ printf("%d", digit / 5); \ else \ @@ -1577,7 +1577,7 @@ int flash_real_protect(flash_info_t *info, long sector, int prot) * On some of Intel's flash chips (marked via legacy_unlock) * unprotect unprotects all locking. */ - if ((prot == 0) && (info->legacy_unlock)) { + if (prot == 0 && info->legacy_unlock) { flash_sect_t i; for (i = 0; i < info->sector_count; i++) { @@ -1636,10 +1636,10 @@ static void cfi_reverse_geometry(struct cfi_qry *qry) u32 tmp; for (i = 0, j = qry->num_erase_regions - 1; i < j; i++, j--) { - tmp = get_unaligned(&(qry->erase_region_info[i])); - put_unaligned(get_unaligned(&(qry->erase_region_info[j])), - &(qry->erase_region_info[i])); - put_unaligned(tmp, &(qry->erase_region_info[j])); + tmp = get_unaligned(&qry->erase_region_info[i]); + put_unaligned(get_unaligned(&qry->erase_region_info[j]), + &qry->erase_region_info[i]); + put_unaligned(tmp, &qry->erase_region_info[j]); } } @@ -1913,11 +1913,11 @@ static int __flash_detect_cfi(flash_info_t *info, struct cfi_qry *qry) * in compatibility mode */ if (/* x8/x16 in x8 mode */ - ((info->chipwidth == FLASH_CFI_BY8) && - (info->interface == FLASH_CFI_X8X16)) || + (info->chipwidth == FLASH_CFI_BY8 && + info->interface == FLASH_CFI_X8X16) || /* x16/x32 in x16 mode */ - ((info->chipwidth == FLASH_CFI_BY16) && - (info->interface == FLASH_CFI_X16X32))) + (info->chipwidth == FLASH_CFI_BY16 && + info->interface == FLASH_CFI_X16X32)) { info->addr_unlock1 = 0xaaa; info->addr_unlock2 = 0x555; @@ -2034,8 +2034,8 @@ static void flash_fixup_num(flash_info_t *info, struct cfi_qry *qry) * There's an app note from Numonyx on this issue. * So adjust the buffer size for M29EW while operating in 8-bit mode */ - if (((qry->max_buf_write_size) > 0x8) && - (info->device_id == 0x7E) && + if (qry->max_buf_write_size > 0x8 && + info->device_id == 0x7E && (info->device_id2 == 0x2201 || info->device_id2 == 0x2301 || info->device_id2 == 0x2801 || @@ -2075,8 +2075,8 @@ ulong flash_get_size(phys_addr_t base, int banknum) info->start[0] = (ulong)map_physmem(base, info->portwidth, MAP_NOCACHE); if (flash_detect_cfi(info, &qry)) { - info->vendor = le16_to_cpu(get_unaligned(&(qry.p_id))); - info->ext_addr = le16_to_cpu(get_unaligned(&(qry.p_adr))); + info->vendor = le16_to_cpu(get_unaligned(&qry.p_id)); + info->ext_addr = le16_to_cpu(get_unaligned(&qry.p_adr)); num_erase_regions = qry.num_erase_regions; if (info->ext_addr) { @@ -2140,8 +2140,8 @@ ulong flash_get_size(phys_addr_t base, int banknum) size_ratio = info->portwidth / info->chipwidth; /* if the chip is x8/x16 reduce the ratio by half */ - if ((info->interface == FLASH_CFI_X8X16) && - (info->chipwidth == FLASH_CFI_BY8)) { + if (info->interface == FLASH_CFI_X8X16 && + info->chipwidth == FLASH_CFI_BY8) { size_ratio >>= 1; } debug("size_ratio %d port %d bits chip %d bits\n", @@ -2151,7 +2151,7 @@ ulong flash_get_size(phys_addr_t base, int banknum) /* multiply the size by the number of chips */ info->size *= size_ratio; max_size = cfi_flash_bank_size(banknum); - if (max_size && (info->size > max_size)) { + if (max_size && info->size > max_size) { debug("[truncated from %ldMiB]", info->size >> 20); info->size = max_size; } @@ -2166,7 +2166,7 @@ ulong flash_get_size(phys_addr_t base, int banknum) } tmp = le32_to_cpu(get_unaligned( - &(qry.erase_region_info[i]))); + &qry.erase_region_info[i])); debug("erase region %u: 0x%08lx\n", i, tmp); erase_region_count = (tmp & 0xffff) + 1; @@ -2255,8 +2255,8 @@ ulong flash_get_size(phys_addr_t base, int banknum) /* round up when converting to ms */ info->write_tout = (tmp + 999) / 1000; info->flash_id = FLASH_MAN_CFI; - if ((info->interface == FLASH_CFI_X8X16) && - (info->chipwidth == FLASH_CFI_BY8)) { + if (info->interface == FLASH_CFI_X8X16 && + info->chipwidth == FLASH_CFI_BY8) { /* XXX - Need to test on x8/x16 in parallel. */ info->portwidth >>= 1; } From patchwork Fri Sep 29 12:52:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819968 X-Patchwork-Delegate: wd@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 3y3Xl92ffcz9rvt for ; Fri, 29 Sep 2017 23:41:09 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 1FBF4C21EE4; Fri, 29 Sep 2017 13:04:53 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 04D58C21F1C; Fri, 29 Sep 2017 12:54:47 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D0445C21F1B; Fri, 29 Sep 2017 12:54:01 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 4FB55C21DCE for ; Fri, 29 Sep 2017 12:53:57 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxunk-00004w-Ss; Fri, 29 Sep 2017 14:53:56 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:05 +0200 Message-Id: <20170929125238.26226-47-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 047/080] cfi_flash: Add missing braces in blocks 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" Signed-off-by: Mario Six --- drivers/mtd/cfi_flash.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 229e0a8177..2a165cb328 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1154,10 +1154,12 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) st = flash_status_poll(info, &cword, dest, info->erase_blk_tout, "erase"); flash_unmap(info, sect, 0, dest); - } else + } else { st = flash_full_status_check(info, sect, info->erase_blk_tout, "erase"); + } + if (st) rcode = 1; else if (flash_verbose) From patchwork Fri Sep 29 12:52:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819953 X-Patchwork-Delegate: wd@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 3y3XZ71nfRz9rxj for ; Fri, 29 Sep 2017 23:33:19 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id E0A42C21EA5; Fri, 29 Sep 2017 13:08:05 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 E116CC21DC6; Fri, 29 Sep 2017 12:55:31 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 736F8C21DC6; Fri, 29 Sep 2017 12:54:06 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 04EEBC21D6A for ; Fri, 29 Sep 2017 12:54:02 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxunp-00004w-2A; Fri, 29 Sep 2017 14:54:01 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:06 +0200 Message-Id: <20170929125238.26226-48-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 048/080] cfi_flash: Fix spelling of "Unknown" 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" Signed-off-by: Mario Six --- drivers/mtd/cfi_flash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 2a165cb328..0d015a3863 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1140,7 +1140,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) break; #endif default: - debug("Unkown flash vendor %d\n", + debug("Unknown flash vendor %d\n", info->vendor); break; } From patchwork Fri Sep 29 12:52:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819923 X-Patchwork-Delegate: wd@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 3y3XH06Kd3z9t32 for ; Fri, 29 Sep 2017 23:20:12 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 3AEC9C21DF4; Fri, 29 Sep 2017 13:10:16 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 2781CC21F3F; Fri, 29 Sep 2017 12:56:37 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 791D0C21E90; Fri, 29 Sep 2017 12:54:12 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 8F52CC21EDE for ; Fri, 29 Sep 2017 12:54:05 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxunt-00004w-7i; Fri, 29 Sep 2017 14:54:05 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:07 +0200 Message-Id: <20170929125238.26226-49-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 049/080] cfi_flash: Fix else after break 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" Signed-off-by: Mario Six --- drivers/mtd/cfi_flash.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 0d015a3863..a82f5272c1 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1820,9 +1820,9 @@ static int flash_detect_legacy(phys_addr_t base, int banknum) info->device_id2); if (jedec_flash_match(info, info->start[0])) break; - else - unmap_physmem((void *)info->start[0], - info->portwidth); + + unmap_physmem((void *)info->start[0], + info->portwidth); } } From patchwork Fri Sep 29 12:52:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819946 X-Patchwork-Delegate: wd@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 3y3XWV5zGWz9t4g for ; Fri, 29 Sep 2017 23:31:02 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 76E57C21E4D; Fri, 29 Sep 2017 13:11:10 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 1C23AC21E3C; Fri, 29 Sep 2017 12:57:15 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 1AD23C21F40; Fri, 29 Sep 2017 12:54:12 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id BF804C21D9E for ; Fri, 29 Sep 2017 12:54:05 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxunt-00004w-D9; Fri, 29 Sep 2017 14:54:05 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:08 +0200 Message-Id: <20170929125238.26226-50-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 050/080] cfi_flash: Fix placement of brace 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" Signed-off-by: Mario Six --- drivers/mtd/cfi_flash.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index a82f5272c1..cd89c666d6 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1919,8 +1919,7 @@ static int __flash_detect_cfi(flash_info_t *info, struct cfi_qry *qry) info->interface == FLASH_CFI_X8X16) || /* x16/x32 in x16 mode */ (info->chipwidth == FLASH_CFI_BY16 && - info->interface == FLASH_CFI_X16X32)) - { + info->interface == FLASH_CFI_X16X32)) { info->addr_unlock1 = 0xaaa; info->addr_unlock2 = 0x555; } From patchwork Fri Sep 29 12:52:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819987 X-Patchwork-Delegate: wd@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 3y3Xx86mFLz9s7c for ; Fri, 29 Sep 2017 23:49:48 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id E40B4C21E37; Fri, 29 Sep 2017 13:19:16 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 E75D4C21E33; Fri, 29 Sep 2017 13:10:14 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 9BBE9C21DE7; Fri, 29 Sep 2017 12:54:12 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 883EEC21EF4 for ; Fri, 29 Sep 2017 12:54:07 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxunv-00004w-3w; Fri, 29 Sep 2017 14:54:07 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:09 +0200 Message-Id: <20170929125238.26226-51-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 051/080] cfi_flash: Remove return from void function 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" Signed-off-by: Mario Six --- drivers/mtd/cfi_flash.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index cd89c666d6..c47ba416b9 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1280,7 +1280,6 @@ void flash_print_info(flash_info_t *info) #endif } putc('\n'); - return; } /*----------------------------------------------------------------------- From patchwork Fri Sep 29 12:52:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819943 X-Patchwork-Delegate: wd@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 3y3XTD1M4kz9rxj for ; Fri, 29 Sep 2017 23:29:04 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id E1649C21E26; Fri, 29 Sep 2017 13:18:46 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 75AE5C21EB4; Fri, 29 Sep 2017 13:07:55 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B22F2C21E3B; Fri, 29 Sep 2017 12:54:16 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id CCDB9C21EFC for ; Fri, 29 Sep 2017 12:54:11 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxunz-00004w-9T; Fri, 29 Sep 2017 14:54:11 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:10 +0200 Message-Id: <20170929125238.26226-52-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 052/080] cfi_flash: Reduce the scope of some variables 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" Signed-off-by: Mario Six --- drivers/mtd/cfi_flash.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index c47ba416b9..c597c621ca 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -179,10 +179,10 @@ __maybe_weak u64 flash_read64(void *addr) static flash_info_t *flash_get_info(ulong base) { int i; - flash_info_t *info; for (i = 0; i < CONFIG_SYS_MAX_FLASH_BANKS; i++) { - info = &flash_info[i]; + flash_info_t *info = &flash_info[i]; + if (info->size && info->start[0] <= base && base <= info->start[0] + info->size - 1) return info; @@ -222,8 +222,6 @@ static inline void flash_unmap(flash_info_t *info, flash_sect_t sect, static void flash_make_cmd(flash_info_t *info, u32 cmd, void *cmdbuf) { int i; - int cword_offset; - int cp_offset; #if defined(__LITTLE_ENDIAN) || defined(CONFIG_SYS_WRITE_SWAPPED_DATA) u32 cmd_le = cpu_to_le32(cmd); #endif @@ -231,9 +229,10 @@ static void flash_make_cmd(flash_info_t *info, u32 cmd, void *cmdbuf) uchar *cp = (uchar *) cmdbuf; for (i = info->portwidth; i > 0; i--) { - cword_offset = (info->portwidth - i) % info->chipwidth; + int cword_offset = (info->portwidth - i) % info->chipwidth; + int cp_offset = info->portwidth - i; #if defined(__LITTLE_ENDIAN) || defined(CONFIG_SYS_WRITE_SWAPPED_DATA) - cp_offset = info->portwidth - i; + val = *((uchar *)&cmd_le + cword_offset); #else cp_offset = i - 1; @@ -2053,16 +2052,10 @@ static void flash_fixup_num(flash_info_t *info, struct cfi_qry *qry) ulong flash_get_size(phys_addr_t base, int banknum) { flash_info_t *info = &flash_info[banknum]; - int i, j; flash_sect_t sect_cnt; phys_addr_t sector; - unsigned long tmp; - int size_ratio; uchar num_erase_regions; - int erase_region_size; - int erase_region_count; struct cfi_qry qry; - unsigned long max_size; memset(&qry, 0, sizeof(qry)); @@ -2075,6 +2068,11 @@ ulong flash_get_size(phys_addr_t base, int banknum) info->start[0] = (ulong)map_physmem(base, info->portwidth, MAP_NOCACHE); if (flash_detect_cfi(info, &qry)) { + int i; + int size_ratio; + unsigned long max_size; + unsigned long tmp; + info->vendor = le16_to_cpu(get_unaligned(&qry.p_id)); info->ext_addr = le16_to_cpu(get_unaligned(&qry.p_adr)); num_erase_regions = qry.num_erase_regions; @@ -2159,6 +2157,10 @@ ulong flash_get_size(phys_addr_t base, int banknum) sect_cnt = 0; sector = base; for (i = 0; i < num_erase_regions; i++) { + int j; + int erase_region_size; + int erase_region_count; + if (i > NUM_ERASE_REGIONS) { printf("%d erase regions found, only %d used\n", num_erase_regions, NUM_ERASE_REGIONS); From patchwork Fri Sep 29 12:52:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819945 X-Patchwork-Delegate: wd@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 3y3XTn3M2Gz9rxj for ; Fri, 29 Sep 2017 23:29:33 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 29E0EC21E7C; Fri, 29 Sep 2017 13:10: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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 1ACA6C21F52; Fri, 29 Sep 2017 12:56:33 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2AF76C21E4A; Fri, 29 Sep 2017 12:54:23 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 0781EC21EC8 for ; Fri, 29 Sep 2017 12:54:16 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxuo3-00004w-EA; Fri, 29 Sep 2017 14:54:15 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:11 +0200 Message-Id: <20170929125238.26226-53-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 053/080] cfi_flash: Remove assignments from if conditions 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" Signed-off-by: Mario Six --- drivers/mtd/cfi_flash.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index c597c621ca..bc7bd3036e 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1338,7 +1338,8 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt) wp = (addr & ~(info->portwidth - 1)); /* handle unaligned start */ - if ((aln = addr - wp) != 0) { + aln = addr - wp; + if (aln != 0) { cword.w32 = 0; p = (uchar *)wp; for (i = 0; i < aln; ++i) @@ -1369,7 +1370,8 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt) cword.w32 = 0; for (i = 0; i < info->portwidth; i++) flash_add_byte(info, &cword, *src++); - if ((rc = flash_write_cfiword(info, wp, cword)) != 0) + rc = flash_write_cfiword(info, wp, cword); + if (rc != 0) return rc; wp += info->portwidth; cnt -= info->portwidth; @@ -1380,7 +1382,8 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt) i = buffered_size - (wp % buffered_size); if (i > cnt) i = cnt; - if ((rc = flash_write_cfibuffer(info, wp, src, i)) != ERR_OK) + rc = flash_write_cfibuffer(info, wp, src, i); + if (rc != ERR_OK) return rc; i -= i & (info->portwidth - 1); wp += i; @@ -1396,7 +1399,8 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt) cword.w32 = 0; for (i = 0; i < info->portwidth; i++) flash_add_byte(info, &cword, *src++); - if ((rc = flash_write_cfiword(info, wp, cword)) != 0) + rc = flash_write_cfiword(info, wp, cword); + if (rc != 0) return rc; wp += info->portwidth; cnt -= info->portwidth; @@ -1568,9 +1572,9 @@ int flash_real_protect(flash_info_t *info, long sector, int prot) * flash_full_status_check() to work correctly */ flash_write_cmd(info, sector, 0, FLASH_CMD_READ_STATUS); - if ((retcode = - flash_full_status_check(info, sector, info->erase_blk_tout, - prot ? "protect" : "unprotect")) == 0) { + retcode = flash_full_status_check(info, sector, info->erase_blk_tout, + prot ? "protect" : "unprotect"); + if (retcode == 0) { info->protect[sector] = prot; /* From patchwork Fri Sep 29 12:52:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819941 X-Patchwork-Delegate: wd@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 3y3XSk3wmvz9t3s for ; Fri, 29 Sep 2017 23:28:38 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 4BC46C21DE6; Fri, 29 Sep 2017 13:19:00 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 AF7CDC21E5A; Fri, 29 Sep 2017 13:08:52 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C2AA3C21EEB; Fri, 29 Sep 2017 12:54:24 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 1752CC21EE9 for ; Fri, 29 Sep 2017 12:54:16 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxuo3-00004w-IP; Fri, 29 Sep 2017 14:54:15 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:12 +0200 Message-Id: <20170929125238.26226-54-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 054/080] cfi_flash: Use u8 pointers instead of void pointers 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" Signed-off-by: Mario Six --- drivers/mtd/cfi_flash.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index bc7bd3036e..2ff1a97658 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -490,7 +490,7 @@ static int flash_isset(flash_info_t *info, flash_sect_t sect, static int flash_toggle(flash_info_t *info, flash_sect_t sect, uint offset, uchar cmd) { - void *addr; + u8 *addr; cfiword_t cword; int retval; @@ -871,9 +871,9 @@ static int flash_write_cfibuffer(flash_info_t *info, ulong dest, uchar *cp, flash_sect_t sector; int cnt; int retcode; - void *src = cp; - void *dst = (void *)dest; - void *dst2 = dst; + u8 *src = cp; + u8 *dst = (u8 *)dest; + u8 *dst2 = dst; int flag = 1; uint offset = 0; unsigned int shift; From patchwork Fri Sep 29 12:52:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819931 X-Patchwork-Delegate: wd@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 3y3XNJ36Zmz9t3s for ; Fri, 29 Sep 2017 23:24:48 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 289E2C21E5D; Fri, 29 Sep 2017 13:16:21 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 82397C21EC2; Fri, 29 Sep 2017 13:03:29 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id F1623C21E31; Fri, 29 Sep 2017 12:54:25 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 334B8C21EEB for ; Fri, 29 Sep 2017 12:54:20 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxuo7-00004w-Nw; Fri, 29 Sep 2017 14:54:19 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:13 +0200 Message-Id: <20170929125238.26226-55-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 055/080] cfi_flash: Fix strings split across lines 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" Signed-off-by: Mario Six --- drivers/mtd/cfi_flash.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 2ff1a97658..b2857f372d 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1254,10 +1254,9 @@ void flash_print_info(flash_info_t *info) info->erase_blk_tout, info->write_tout); if (info->buffer_size > 1) { - printf(" Buffer write timeout: %ld ms, " - "buffer size: %d bytes\n", - info->buffer_write_tout, - info->buffer_size); + printf(" Buffer write timeout: %ld ms, ", + info->buffer_write_tout); + printf("buffer size: %d bytes\n", info->buffer_size); } puts("\n Sector Start Addresses:"); @@ -2043,8 +2042,8 @@ static void flash_fixup_num(flash_info_t *info, struct cfi_qry *qry) info->device_id2 == 0x2301 || info->device_id2 == 0x2801 || info->device_id2 == 0x4801)) { - debug("Adjusted buffer size on Numonyx flash" - " M29EW family in 8 bit mode\n"); + debug("Adjusted buffer size on Numonyx flash"); + debug(" M29EW family in 8 bit mode\n"); qry->max_buf_write_size = 0x8; } } @@ -2384,9 +2383,9 @@ unsigned long flash_init(void) size += flash_info[i].size; if (flash_info[i].flash_id == FLASH_UNKNOWN) { #ifndef CONFIG_SYS_FLASH_QUIET_TEST - printf("## Unknown flash on Bank %d " - "- Size = 0x%08lx = %ld MB\n", - i + 1, flash_info[i].size, + printf("## Unknown flash on Bank %d ", i + 1); + printf("- Size = 0x%08lx = %ld MB\n", + flash_info[i].size, flash_info[i].size >> 20); #endif /* CONFIG_SYS_FLASH_QUIET_TEST */ } From patchwork Fri Sep 29 12:52:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819936 X-Patchwork-Delegate: wd@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 3y3XQ70mJQz9t3s for ; Fri, 29 Sep 2017 23:26:22 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id B1A24C21E68; Fri, 29 Sep 2017 13:13:24 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 8661BC21E73; Fri, 29 Sep 2017 12:59:24 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 60656C21E9B; Fri, 29 Sep 2017 12:54:25 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 3C542C21F1D for ; Fri, 29 Sep 2017 12:54:20 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxuo7-00004w-SA; Fri, 29 Sep 2017 14:54:19 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:14 +0200 Message-Id: <20170929125238.26226-56-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 056/080] cfi_flash: Rename camel-case variables 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" Signed-off-by: Mario Six --- drivers/mtd/cfi_flash.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index b2857f372d..dff8b73055 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1686,8 +1686,8 @@ static int cmdset_intel_init(flash_info_t *info, struct cfi_qry *qry) static void cmdset_amd_read_jedec_ids(flash_info_t *info) { - ushort bankId = 0; - uchar manuId; + ushort bank_id = 0; + uchar manu_id; uchar lsbits; flash_write_cmd(info, 0, 0, AMD_CMD_RESET); @@ -1695,14 +1695,14 @@ static void cmdset_amd_read_jedec_ids(flash_info_t *info) flash_write_cmd(info, 0, info->addr_unlock1, FLASH_CMD_READ_ID); udelay(1000); /* some flash are slow to respond */ - manuId = flash_read_uchar(info, FLASH_OFFSET_MANUFACTURER_ID); + manu_id = flash_read_uchar(info, FLASH_OFFSET_MANUFACTURER_ID); /* JEDEC JEP106Z specifies ID codes up to bank 7 */ - while (manuId == FLASH_CONTINUATION_CODE && bankId < 0x800) { - bankId += 0x100; - manuId = flash_read_uchar(info, - bankId | FLASH_OFFSET_MANUFACTURER_ID); + while (manu_id == FLASH_CONTINUATION_CODE && bank_id < 0x800) { + bank_id += 0x100; + manu_id = flash_read_uchar(info, + bank_id | FLASH_OFFSET_MANUFACTURER_ID); } - info->manufacturer_id = manuId; + info->manufacturer_id = manu_id; lsbits = flash_read_uchar(info, FLASH_OFFSET_LOWER_SW_BITS); info->sr_supported = lsbits & BIT(0); From patchwork Fri Sep 29 12:52:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819976 X-Patchwork-Delegate: wd@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 3y3XtF4VZHz9t3f for ; Fri, 29 Sep 2017 23:47:17 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 68CC5C21ED3; Fri, 29 Sep 2017 13:15:17 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 8C23DC21DE6; Fri, 29 Sep 2017 13:02:22 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D26E4C21E7F; Fri, 29 Sep 2017 12:54:32 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id A1195C21F0E for ; Fri, 29 Sep 2017 12:54:24 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxuoC-00004w-0F; Fri, 29 Sep 2017 14:54:24 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:15 +0200 Message-Id: <20170929125238.26226-57-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 057/080] flash: Fix spelling of "ERR_TIMOUT" 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" checkpatch.pl complains about the spelling of ERR_TIMOUT. Since the error is only used in a handful of files, we rename the error to ERR_TIMEOUT. Signed-off-by: Mario Six --- board/cobra5272/flash.c | 2 +- common/flash.c | 4 ++-- drivers/mtd/cfi_flash.c | 4 ++-- drivers/mtd/dataflash.c | 2 +- drivers/mtd/pic32_flash.c | 6 +++--- include/dataflash.h | 2 +- include/flash.h | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/board/cobra5272/flash.c b/board/cobra5272/flash.c index 4fac6880f1..ca27b49a3b 100644 --- a/board/cobra5272/flash.c +++ b/board/cobra5272/flash.c @@ -216,7 +216,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last) goto outahere; } if (chip1 == TMO) { - rc = ERR_TIMOUT; + rc = ERR_TIMEOUT; goto outahere; } diff --git a/common/flash.c b/common/flash.c index 587ef60158..876677493f 100644 --- a/common/flash.c +++ b/common/flash.c @@ -112,7 +112,7 @@ addr2info (ulong addr) * and no protected sectors are hit. * Returns: * ERR_OK 0 - OK - * ERR_TIMOUT 1 - write timeout + * ERR_TIMEOUT 1 - write timeout * ERR_NOT_ERASED 2 - Flash not erased * ERR_PROTECTED 4 - target range includes protected sectors * ERR_INVAL 8 - target address not in Flash memory @@ -185,7 +185,7 @@ void flash_perror (int err) switch (err) { case ERR_OK: break; - case ERR_TIMOUT: + case ERR_TIMEOUT: puts ("Timeout writing to Flash\n"); break; case ERR_NOT_ERASED: diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index dff8b73055..93bf9ed539 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -587,7 +587,7 @@ static int flash_status_check(flash_info_t *info, flash_sect_t sector, flash_read_long(info, sector, 0)); flash_write_cmd(info, sector, 0, info->cmd_reset); udelay(1); - return ERR_TIMOUT; + return ERR_TIMEOUT; } udelay(1); /* also triggers watchdog */ } @@ -695,7 +695,7 @@ static int flash_status_poll(flash_info_t *info, void *src, void *dst, if (get_timer(start) > tout) { printf("Flash %s timeout at address %lx data %lx\n", prompt, (ulong)dst, (ulong)flash_read8(dst)); - return ERR_TIMOUT; + return ERR_TIMEOUT; } udelay(1); /* also triggers watchdog */ } diff --git a/drivers/mtd/dataflash.c b/drivers/mtd/dataflash.c index e961f518b0..09199ebeba 100644 --- a/drivers/mtd/dataflash.c +++ b/drivers/mtd/dataflash.c @@ -426,7 +426,7 @@ void dataflash_perror (int err) switch (err) { case ERR_OK: break; - case ERR_TIMOUT: + case ERR_TIMEOUT: printf("Timeout writing to DataFlash\n"); break; case ERR_PROTECTED: diff --git a/drivers/mtd/pic32_flash.c b/drivers/mtd/pic32_flash.c index e1a8d3bc4b..a6a5d1cc2e 100644 --- a/drivers/mtd/pic32_flash.c +++ b/drivers/mtd/pic32_flash.c @@ -69,7 +69,7 @@ static int flash_wait_till_busy(const char *func, ulong timeout) int ret = wait_for_bit(__func__, &nvm_regs_p->ctrl.raw, NVM_WR, false, timeout, false); - return ret ? ERR_TIMOUT : ERR_OK; + return ret ? ERR_TIMEOUT : ERR_OK; } static inline int flash_complete_operation(void) @@ -99,7 +99,7 @@ static inline int flash_complete_operation(void) * Erase flash sectors, returns: * ERR_OK - OK * ERR_INVAL - invalid sector arguments - * ERR_TIMOUT - write timeout + * ERR_TIMEOUT - write timeout * ERR_NOT_ERASED - Flash not erased * ERR_UNKNOWN_FLASH_VENDOR - incorrect flash */ @@ -217,7 +217,7 @@ static int write_word(flash_info_t *info, ulong dest, ulong word) /* * Copy memory to flash, returns: * ERR_OK - OK - * ERR_TIMOUT - write timeout + * ERR_TIMEOUT - write timeout * ERR_NOT_ERASED - Flash not erased */ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt) diff --git a/include/dataflash.h b/include/dataflash.h index c9f22200cf..68907251d1 100644 --- a/include/dataflash.h +++ b/include/dataflash.h @@ -29,7 +29,7 @@ * return codes from flash_write(): */ # define ERR_OK 0 -# define ERR_TIMOUT 1 +# define ERR_TIMEOUT 1 # define ERR_NOT_ERASED 2 # define ERR_PROTECTED 4 # define ERR_INVAL 8 diff --git a/include/flash.h b/include/flash.h index dc67cb2df6..1a4e879009 100644 --- a/include/flash.h +++ b/include/flash.h @@ -122,7 +122,7 @@ extern int jedec_flash_match(flash_info_t *info, ulong base); * return codes from flash_write(): */ #define ERR_OK 0 -#define ERR_TIMOUT 1 +#define ERR_TIMEOUT 1 #define ERR_NOT_ERASED 2 #define ERR_PROTECTED 4 #define ERR_INVAL 8 From patchwork Fri Sep 29 12:52:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819984 X-Patchwork-Delegate: wd@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 3y3XwZ5Vydz9ryv for ; Fri, 29 Sep 2017 23:49:18 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 7DB5FC21E73; Fri, 29 Sep 2017 13:18:25 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 56C03C21E24; Fri, 29 Sep 2017 13:07:35 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2D619C21E0A; Fri, 29 Sep 2017 12:54:30 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id C864BC21DEF for ; Fri, 29 Sep 2017 12:54:24 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxuoC-00004w-4M; Fri, 29 Sep 2017 14:54:24 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:16 +0200 Message-Id: <20170929125238.26226-58-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 058/080] cfi_flash: Bound-check index before array access 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 a while loop in cfi_flash.c the array "start" is accessed at the index "sector" before the index variable "sector" is bounds-checked, which might lead to accesses beyond the bounds of the array. Swap the order of the checks in the "&&" expression, so that the short-circuit evaluation prevents out-of-bounds array accesses. Signed-off-by: Mario Six --- drivers/mtd/cfi_flash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 93bf9ed539..40a3544e5b 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -760,8 +760,8 @@ static flash_sect_t find_sector(flash_info_t *info, ulong addr) if (info != saved_info || sector >= info->sector_count) sector = 0; - while ((info->start[sector] < addr) && - (sector < info->sector_count - 1)) + while ((sector < info->sector_count - 1) && + (info->start[sector] < addr)) sector++; while ((info->start[sector] > addr) && (sector > 0)) /* From patchwork Fri Sep 29 12:52:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819974 X-Patchwork-Delegate: wd@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 3y3Xsm4vfHz9t3f for ; Fri, 29 Sep 2017 23:46:52 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 6A7D1C21EB9; Fri, 29 Sep 2017 13:16:46 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 53A04C21DE8; Fri, 29 Sep 2017 13:03:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D93F3C21DB5; Fri, 29 Sep 2017 12:54:34 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id E9401C21EB4 for ; Fri, 29 Sep 2017 12:54:28 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxuoG-00004w-9v; Fri, 29 Sep 2017 14:54:28 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:17 +0200 Message-Id: <20170929125238.26226-59-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 059/080] cfi_flash: Fix long lines 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" Signed-off-by: Mario Six --- drivers/mtd/cfi_flash.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 40a3544e5b..e640a70d0f 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -175,7 +175,8 @@ __maybe_weak u64 flash_read64(void *addr) /*----------------------------------------------------------------------- */ -#if defined(CONFIG_ENV_IS_IN_FLASH) || defined(CONFIG_ENV_ADDR_REDUND) || (CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE) +#if defined(CONFIG_ENV_IS_IN_FLASH) || defined(CONFIG_ENV_ADDR_REDUND) || \ + (CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE) static flash_info_t *flash_get_info(ulong base) { int i; @@ -568,8 +569,9 @@ static int flash_status_check(flash_info_t *info, flash_sect_t sector, ulong start; #if CONFIG_SYS_HZ != 1000 + /* Avoid overflow for large HZ */ if ((ulong)CONFIG_SYS_HZ > 100000) - tout *= (ulong)CONFIG_SYS_HZ / 1000; /* for a big HZ, avoid overflow */ + tout *= (ulong)CONFIG_SYS_HZ / 1000; else tout = DIV_ROUND_UP(tout * (ulong)CONFIG_SYS_HZ, 1000); #endif @@ -660,8 +662,9 @@ static int flash_status_poll(flash_info_t *info, void *src, void *dst, int ready; #if CONFIG_SYS_HZ != 1000 + /* Avoid overflow for large HZ */ if ((ulong)CONFIG_SYS_HZ > 100000) - tout *= (ulong)CONFIG_SYS_HZ / 1000; /* for a big HZ, avoid overflow */ + tout *= (ulong)CONFIG_SYS_HZ / 1000; else tout = DIV_ROUND_UP(tout * (ulong)CONFIG_SYS_HZ, 1000); #endif @@ -936,7 +939,8 @@ static int flash_write_cfibuffer(flash_info_t *info, ulong dest, uchar *cp, case CFI_CMDSET_INTEL_STANDARD: case CFI_CMDSET_INTEL_EXTENDED: write_cmd = (info->vendor == CFI_CMDSET_INTEL_PROG_REGIONS) ? - FLASH_CMD_WRITE_BUFFER_PROG : FLASH_CMD_WRITE_TO_BUFFER; + FLASH_CMD_WRITE_BUFFER_PROG : + FLASH_CMD_WRITE_TO_BUFFER; flash_write_cmd(info, sector, 0, FLASH_CMD_CLEAR_STATUS); flash_write_cmd(info, sector, 0, FLASH_CMD_READ_STATUS); flash_write_cmd(info, sector, 0, write_cmd); @@ -1151,7 +1155,8 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) cword.w64 = 0xffffffffffffffffULL; dest = flash_map(info, sect, 0); st = flash_status_poll(info, &cword, dest, - info->erase_blk_tout, "erase"); + info->erase_blk_tout, + "erase"); flash_unmap(info, sect, 0, dest); } else { st = flash_full_status_check(info, sect, @@ -1560,9 +1565,11 @@ int flash_real_protect(flash_info_t *info, long sector, int prot) flash_write_cmd(info, sector, 0, FLASH_CMD_CLEAR_STATUS); flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT); if (prot) - flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT_SET); + flash_write_cmd(info, sector, 0, + FLASH_CMD_PROTECT_SET); else - flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT_CLEAR); + flash_write_cmd(info, sector, 0, + FLASH_CMD_PROTECT_CLEAR); #endif }; @@ -1892,9 +1899,9 @@ static int __flash_detect_cfi(flash_info_t *info, struct cfi_qry *qry) flash_write_cmd(info, 0, flash_offset_cfi[cfi_offset], FLASH_CMD_CFI); if (flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP, 'Q') && - flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 1, 'R') && - flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 2, 'Y')) { - flash_read_cfi(info, qry, FLASH_OFFSET_CFI_RESP, + flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 1, 'R') && + flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 2, 'Y')) { + flash_read_cfi(info, qry, FLASH_OFFSET_CFI_RESP, sizeof(struct cfi_qry)); info->interface = le16_to_cpu(qry->interface_desc); @@ -2178,8 +2185,8 @@ ulong flash_get_size(phys_addr_t base, int banknum) tmp >>= 16; erase_region_size = (tmp & 0xffff) ? ((tmp & 0xffff) * 256) : 128; - debug("erase_region_count = %d erase_region_size = %d\n", - erase_region_count, erase_region_size); + debug("erase_region_count = %d ", erase_region_count); + debug("erase_region_size = %d\n", erase_region_size); for (j = 0; j < erase_region_count; j++) { if (sector - base >= info->size) break; From patchwork Fri Sep 29 12:52:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819962 X-Patchwork-Delegate: wd@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 3y3Xfh0XTmz9t2x for ; Fri, 29 Sep 2017 23:37:16 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id C9CA9C21E28; Fri, 29 Sep 2017 13:17: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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 0A581C21EE6; Fri, 29 Sep 2017 13:07:18 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E2C4CC21DC8; Fri, 29 Sep 2017 12:54:39 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 2DCEFC21E24 for ; Fri, 29 Sep 2017 12:54:34 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxuoK-00004w-EJ; Fri, 29 Sep 2017 14:54:32 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:18 +0200 Message-Id: <20170929125238.26226-60-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 060/080] cfi_flash: Fix indention 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" Signed-off-by: Mario Six --- drivers/mtd/cfi_flash.c | 238 ++++++++++++++++++++++++------------------------ 1 file changed, 118 insertions(+), 120 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index e640a70d0f..7795d25825 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -213,7 +213,7 @@ flash_map(flash_info_t *info, flash_sect_t sect, uint offset) } static inline void flash_unmap(flash_info_t *info, flash_sect_t sect, - unsigned int offset, void *addr) + unsigned int offset, void *addr) { } @@ -328,7 +328,7 @@ static ulong flash_read_long (flash_info_t *info, flash_sect_t sect, #ifdef DEBUG debug("long addr is at %p info->portwidth = %d\n", addr, - info->portwidth); + info->portwidth); for (x = 0; x < 4 * info->portwidth; x++) debug("addr[%x] = 0x%x\n", x, flash_read8(addr + x)); #endif @@ -362,19 +362,19 @@ static void flash_write_cmd(flash_info_t *info, flash_sect_t sect, switch (info->portwidth) { case FLASH_CFI_8BIT: debug("fwc addr %p cmd %x %x 8bit x %d bit\n", addr, cmd, - cword.w8, info->chipwidth << CFI_FLASH_SHIFT_WIDTH); + cword.w8, info->chipwidth << CFI_FLASH_SHIFT_WIDTH); flash_write8(cword.w8, addr); break; case FLASH_CFI_16BIT: debug("fwc addr %p cmd %x %4.4x 16bit x %d bit\n", addr, - cmd, cword.w16, - info->chipwidth << CFI_FLASH_SHIFT_WIDTH); + cmd, cword.w16, + info->chipwidth << CFI_FLASH_SHIFT_WIDTH); flash_write16(cword.w16, addr); break; case FLASH_CFI_32BIT: debug("fwc addr %p cmd %x %8.8x 32bit x %d bit\n", addr, - cmd, cword.w32, - info->chipwidth << CFI_FLASH_SHIFT_WIDTH); + cmd, cword.w32, + info->chipwidth << CFI_FLASH_SHIFT_WIDTH); flash_write32(cword.w32, addr); break; case FLASH_CFI_64BIT: @@ -385,8 +385,8 @@ static void flash_write_cmd(flash_info_t *info, flash_sect_t sect, print_longlong(str, cword.w64); debug("fwrite addr %p cmd %x %s 64 bit x %d bit\n", - addr, cmd, str, - info->chipwidth << CFI_FLASH_SHIFT_WIDTH); + addr, cmd, str, + info->chipwidth << CFI_FLASH_SHIFT_WIDTH); } #endif flash_write64(cword.w64, addr); @@ -407,8 +407,8 @@ static void flash_unlock_seq(flash_info_t *info, flash_sect_t sect) /*----------------------------------------------------------------------- */ -static int flash_isequal(flash_info_t *info, flash_sect_t sect, - uint offset, uchar cmd) +static int flash_isequal(flash_info_t *info, flash_sect_t sect, uint offset, + uchar cmd) { void *addr; cfiword_t cword; @@ -455,8 +455,8 @@ static int flash_isequal(flash_info_t *info, flash_sect_t sect, /*----------------------------------------------------------------------- */ -static int flash_isset(flash_info_t *info, flash_sect_t sect, - uint offset, uchar cmd) +static int flash_isset(flash_info_t *info, flash_sect_t sect, uint offset, + uchar cmd) { void *addr; cfiword_t cword; @@ -488,8 +488,8 @@ static int flash_isset(flash_info_t *info, flash_sect_t sect, /*----------------------------------------------------------------------- */ -static int flash_toggle(flash_info_t *info, flash_sect_t sect, - uint offset, uchar cmd) +static int flash_toggle(flash_info_t *info, flash_sect_t sect, uint offset, + uchar cmd) { u8 *addr; cfiword_t cword; @@ -543,12 +543,12 @@ static int flash_is_busy(flash_info_t *info, flash_sect_t sect) #endif if (info->sr_supported) { flash_write_cmd(info, sect, info->addr_unlock1, - FLASH_CMD_READ_STATUS); + FLASH_CMD_READ_STATUS); retval = !flash_isset(info, sect, 0, - FLASH_STATUS_DONE); + FLASH_STATUS_DONE); } else { retval = flash_toggle(info, sect, 0, - AMD_STATUS_TOGGLE); + AMD_STATUS_TOGGLE); } break; @@ -564,7 +564,7 @@ static int flash_is_busy(flash_info_t *info, flash_sect_t sect) * This routine does not set the flash to read-array mode. */ static int flash_status_check(flash_info_t *info, flash_sect_t sector, - ulong tout, char *prompt) + ulong tout, char *prompt) { ulong start; @@ -585,8 +585,8 @@ static int flash_status_check(flash_info_t *info, flash_sect_t sector, while (flash_is_busy(info, sector)) { if (get_timer(start) > tout) { printf("Flash %s timeout at address %lx data %lx\n", - prompt, info->start[sector], - flash_read_long(info, sector, 0)); + prompt, info->start[sector], + flash_read_long(info, sector, 0)); flash_write_cmd(info, sector, 0, info->cmd_reset); udelay(1); return ERR_TIMEOUT; @@ -603,7 +603,7 @@ static int flash_status_check(flash_info_t *info, flash_sect_t sector, * This routine sets the flash to read-array mode. */ static int flash_full_status_check(flash_info_t *info, flash_sect_t sector, - ulong tout, char *prompt) + ulong tout, char *prompt) { int retcode; @@ -613,10 +613,10 @@ static int flash_full_status_check(flash_info_t *info, flash_sect_t sector, case CFI_CMDSET_INTEL_EXTENDED: case CFI_CMDSET_INTEL_STANDARD: if (retcode == ERR_OK && - !flash_isset(info, sector, 0, FLASH_STATUS_DONE)) { + !flash_isset(info, sector, 0, FLASH_STATUS_DONE)) { retcode = ERR_INVAL; printf("Flash %s error at address %lx\n", prompt, - info->start[sector]); + info->start[sector]); if (flash_isset(info, sector, 0, FLASH_STATUS_ECLBS | FLASH_STATUS_PSLBS)) { puts("Command Sequence Error.\n"); @@ -764,7 +764,7 @@ static flash_sect_t find_sector(flash_info_t *info, ulong addr) sector = 0; while ((sector < info->sector_count - 1) && - (info->start[sector] < addr)) + (info->start[sector] < addr)) sector++; while ((info->start[sector] > addr) && (sector > 0)) /* @@ -780,8 +780,7 @@ static flash_sect_t find_sector(flash_info_t *info, ulong addr) /*----------------------------------------------------------------------- */ -static int flash_write_cfiword(flash_info_t *info, ulong dest, - cfiword_t cword) +static int flash_write_cfiword(flash_info_t *info, ulong dest, cfiword_t cword) { void *dstaddr = (void *)dest; int flag; @@ -869,7 +868,7 @@ static int flash_write_cfiword(flash_info_t *info, ulong dest, #ifdef CONFIG_SYS_FLASH_USE_BUFFER_WRITE static int flash_write_cfibuffer(flash_info_t *info, ulong dest, uchar *cp, - int len) + int len) { flash_sect_t sector; int cnt; @@ -945,8 +944,8 @@ static int flash_write_cfibuffer(flash_info_t *info, ulong dest, uchar *cp, flash_write_cmd(info, sector, 0, FLASH_CMD_READ_STATUS); flash_write_cmd(info, sector, 0, write_cmd); retcode = flash_status_check(info, sector, - info->buffer_write_tout, - "write to buffer"); + info->buffer_write_tout, + "write to buffer"); if (retcode == ERR_OK) { /* reduce the number of loops by the width of * the port @@ -977,7 +976,7 @@ static int flash_write_cfibuffer(flash_info_t *info, ulong dest, uchar *cp, } } flash_write_cmd(info, sector, 0, - FLASH_CMD_WRITE_BUFFER_CONFIRM); + FLASH_CMD_WRITE_BUFFER_CONFIRM); retcode = flash_full_status_check( info, sector, info->buffer_write_tout, "buffer write"); @@ -1073,7 +1072,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) prot++; if (prot) { printf("- Warning: %d protected sectors will not be erased!\n", - prot); + prot); } else if (flash_verbose) { putc('\n'); } @@ -1116,11 +1115,11 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) case CFI_CMDSET_INTEL_STANDARD: case CFI_CMDSET_INTEL_EXTENDED: flash_write_cmd(info, sect, 0, - FLASH_CMD_CLEAR_STATUS); + FLASH_CMD_CLEAR_STATUS); flash_write_cmd(info, sect, 0, - FLASH_CMD_BLOCK_ERASE); + FLASH_CMD_BLOCK_ERASE); flash_write_cmd(info, sect, 0, - FLASH_CMD_ERASE_CONFIRM); + FLASH_CMD_ERASE_CONFIRM); break; case CFI_CMDSET_AMD_STANDARD: case CFI_CMDSET_AMD_EXTENDED: @@ -1130,7 +1129,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) AMD_CMD_ERASE_START); flash_unlock_seq(info, sect); flash_write_cmd(info, sect, 0, - info->cmd_erase_sector); + info->cmd_erase_sector); break; #ifdef CONFIG_FLASH_CFI_LEGACY case CFI_CMDSET_AMD_LEGACY: @@ -1144,7 +1143,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) #endif default: debug("Unknown flash vendor %d\n", - info->vendor); + info->vendor); break; } @@ -1211,14 +1210,14 @@ void flash_print_info(flash_info_t *info) } printf("%s flash (%d x %d)", - info->name, - (info->portwidth << 3), (info->chipwidth << 3)); + info->name, + (info->portwidth << 3), (info->chipwidth << 3)); if (info->size < 1024 * 1024) printf(" Size: %ld kB in %d Sectors\n", - info->size >> 10, info->sector_count); + info->size >> 10, info->sector_count); else printf(" Size: %ld MB in %d Sectors\n", - info->size >> 20, info->sector_count); + info->size >> 20, info->sector_count); printf(" "); switch (info->vendor) { case CFI_CMDSET_INTEL_PROG_REGIONS: @@ -1246,21 +1245,20 @@ void flash_print_info(flash_info_t *info) break; } printf(" command set, Manufacturer ID: 0x%02X, Device ID: 0x", - info->manufacturer_id); + info->manufacturer_id); printf(info->chipwidth == FLASH_CFI_16BIT ? "%04X" : "%02X", - info->device_id); + info->device_id); if ((info->device_id & 0xff) == 0x7E) { printf(info->chipwidth == FLASH_CFI_16BIT ? "%04X" : "%02X", - info->device_id2); + info->device_id2); } if (info->vendor == CFI_CMDSET_AMD_STANDARD && info->legacy_unlock) printf("\n Advanced Sector Protection (PPB) enabled"); printf("\n Erase timeout: %ld ms, write timeout: %ld ms\n", - info->erase_blk_tout, - info->write_tout); + info->erase_blk_tout, info->write_tout); if (info->buffer_size > 1) { printf(" Buffer write timeout: %ld ms, ", - info->buffer_write_tout); + info->buffer_write_tout); printf("buffer size: %d bytes\n", info->buffer_size); } @@ -1273,13 +1271,13 @@ void flash_print_info(flash_info_t *info) #ifdef CONFIG_SYS_FLASH_EMPTY_INFO /* print empty and read-only info */ printf(" %08lX %c %s ", - info->start[i], - sector_erased(info, i) ? 'E' : ' ', - info->protect[i] ? "RO" : " "); + info->start[i], + sector_erased(info, i) ? 'E' : ' ', + info->protect[i] ? "RO" : " "); #else /* ! CONFIG_SYS_FLASH_EMPTY_INFO */ printf(" %08lX %s ", - info->start[i], - info->protect[i] ? "RO" : " "); + info->start[i], + info->protect[i] ? "RO" : " "); #endif } putc('\n'); @@ -1445,7 +1443,7 @@ static inline int manufact_match(flash_info_t *info, u32 manu) static int cfi_protect_bugfix(flash_info_t *info, long sector, int prot) { if (manufact_match(info, INTEL_MANUFACT) && - info->device_id == NUMONYX_256MBIT) { + info->device_id == NUMONYX_256MBIT) { /* * see errata called * "Numonyx Axcell P33/P30 Specification Update" :) @@ -1486,15 +1484,15 @@ int flash_real_protect(flash_info_t *info, long sector, int prot) case CFI_CMDSET_INTEL_EXTENDED: if (!cfi_protect_bugfix(info, sector, prot)) { flash_write_cmd(info, sector, 0, - FLASH_CMD_CLEAR_STATUS); + FLASH_CMD_CLEAR_STATUS); flash_write_cmd(info, sector, 0, - FLASH_CMD_PROTECT); + FLASH_CMD_PROTECT); if (prot) flash_write_cmd(info, sector, 0, - FLASH_CMD_PROTECT_SET); + FLASH_CMD_PROTECT_SET); else flash_write_cmd(info, sector, 0, - FLASH_CMD_PROTECT_CLEAR); + FLASH_CMD_PROTECT_CLEAR); } break; case CFI_CMDSET_AMD_EXTENDED: @@ -1515,7 +1513,7 @@ int flash_real_protect(flash_info_t *info, long sector, int prot) AMD_CMD_UNLOCK_START); if (info->device_id == ATM_ID_BV6416) flash_write_cmd(info, sector, - 0, ATM_CMD_UNLOCK_SECT); + 0, ATM_CMD_UNLOCK_SECT); } } if (info->legacy_unlock) { @@ -1529,29 +1527,29 @@ int flash_real_protect(flash_info_t *info, long sector, int prot) if (prot) { if (lock_flag) { flash_write_cmd(info, sector, 0, - AMD_CMD_PPB_LOCK_BC1); + AMD_CMD_PPB_LOCK_BC1); flash_write_cmd(info, sector, 0, - AMD_CMD_PPB_LOCK_BC2); + AMD_CMD_PPB_LOCK_BC2); } debug("sector %ld %slocked\n", sector, - lock_flag ? "" : "already "); + lock_flag ? "" : "already "); } else { if (!lock_flag) { debug("unlock %ld\n", sector); flash_write_cmd(info, 0, 0, - AMD_CMD_PPB_UNLOCK_BC1); + AMD_CMD_PPB_UNLOCK_BC1); flash_write_cmd(info, 0, 0, - AMD_CMD_PPB_UNLOCK_BC2); + AMD_CMD_PPB_UNLOCK_BC2); } debug("sector %ld %sunlocked\n", sector, - !lock_flag ? "" : "already "); + !lock_flag ? "" : "already "); } if (flag) enable_interrupts(); if (flash_status_check(info, sector, - info->erase_blk_tout, - prot ? "protect" : "unprotect")) + info->erase_blk_tout, + prot ? "protect" : "unprotect")) printf("status check error\n"); flash_write_cmd(info, 0, 0, @@ -1579,7 +1577,7 @@ int flash_real_protect(flash_info_t *info, long sector, int prot) */ flash_write_cmd(info, sector, 0, FLASH_CMD_READ_STATUS); retcode = flash_full_status_check(info, sector, info->erase_blk_tout, - prot ? "protect" : "unprotect"); + prot ? "protect" : "unprotect"); if (retcode == 0) { info->protect[sector] = prot; @@ -1603,7 +1601,7 @@ int flash_real_protect(flash_info_t *info, long sector, int prot) * flash_read_user_serial - read the OneTimeProgramming cells */ void flash_read_user_serial(flash_info_t *info, void *buffer, int offset, - int len) + int len) { uchar *src; uchar *dst; @@ -1621,7 +1619,7 @@ void flash_read_user_serial(flash_info_t *info, void *buffer, int offset, * flash_read_factory_serial - read the device Id from the protection area */ void flash_read_factory_serial(flash_info_t *info, void *buffer, int offset, - int len) + int len) { uchar *src; @@ -1666,7 +1664,7 @@ static void cmdset_intel_read_jedec_ids(flash_info_t *info) flash_write_cmd(info, 0, 0, FLASH_CMD_READ_ID); udelay(1000); /* some flash are slow to respond */ info->manufacturer_id = flash_read_uchar(info, - FLASH_OFFSET_MANUFACTURER_ID); + FLASH_OFFSET_MANUFACTURER_ID); info->device_id = (info->chipwidth == FLASH_CFI_16BIT) ? flash_read_word(info, FLASH_OFFSET_DEVICE_ID) : flash_read_uchar(info, FLASH_OFFSET_DEVICE_ID); @@ -1683,8 +1681,8 @@ static int cmdset_intel_init(flash_info_t *info, struct cfi_qry *qry) #ifdef CONFIG_SYS_FLASH_PROTECTION /* read legacy lock/unlock bit from intel flash */ if (info->ext_addr) { - info->legacy_unlock = flash_read_uchar(info, - info->ext_addr + 5) & 0x08; + info->legacy_unlock = + flash_read_uchar(info, info->ext_addr + 5) & 0x08; } #endif @@ -1707,7 +1705,7 @@ static void cmdset_amd_read_jedec_ids(flash_info_t *info) while (manu_id == FLASH_CONTINUATION_CODE && bank_id < 0x800) { bank_id += 0x100; manu_id = flash_read_uchar(info, - bank_id | FLASH_OFFSET_MANUFACTURER_ID); + bank_id | FLASH_OFFSET_MANUFACTURER_ID); } info->manufacturer_id = manu_id; @@ -1717,11 +1715,11 @@ static void cmdset_amd_read_jedec_ids(flash_info_t *info) switch (info->chipwidth) { case FLASH_CFI_8BIT: info->device_id = flash_read_uchar(info, - FLASH_OFFSET_DEVICE_ID); + FLASH_OFFSET_DEVICE_ID); if (info->device_id == 0x7E) { /* AMD 3-byte (expanded) device ids */ info->device_id2 = flash_read_uchar(info, - FLASH_OFFSET_DEVICE_ID2); + FLASH_OFFSET_DEVICE_ID2); info->device_id2 <<= 8; info->device_id2 |= flash_read_uchar(info, FLASH_OFFSET_DEVICE_ID3); @@ -1729,11 +1727,11 @@ static void cmdset_amd_read_jedec_ids(flash_info_t *info) break; case FLASH_CFI_16BIT: info->device_id = flash_read_word(info, - FLASH_OFFSET_DEVICE_ID); + FLASH_OFFSET_DEVICE_ID); if ((info->device_id & 0xff) == 0x7E) { /* AMD 3-byte (expanded) device ids */ info->device_id2 = flash_read_uchar(info, - FLASH_OFFSET_DEVICE_ID2); + FLASH_OFFSET_DEVICE_ID2); info->device_id2 <<= 8; info->device_id2 |= flash_read_uchar(info, FLASH_OFFSET_DEVICE_ID3); @@ -1814,7 +1812,7 @@ static int flash_detect_legacy(phys_addr_t base, int banknum) info->portwidth, MAP_NOCACHE); if (info->portwidth == FLASH_CFI_8BIT && - info->interface == FLASH_CFI_X8X16) { + info->interface == FLASH_CFI_X8X16) { info->addr_unlock1 = 0x2AAA; info->addr_unlock2 = 0x5555; } else { @@ -1823,9 +1821,9 @@ static int flash_detect_legacy(phys_addr_t base, int banknum) } flash_read_jedec_ids(info); debug("JEDEC PROBE: ID %x %x %x\n", - info->manufacturer_id, - info->device_id, - info->device_id2); + info->manufacturer_id, + info->device_id, + info->device_id2); if (jedec_flash_match(info, info->start[0])) break; @@ -1862,8 +1860,8 @@ static inline int flash_detect_legacy(phys_addr_t base, int banknum) * detect if flash is compatible with the Common Flash Interface (CFI) * http://www.jedec.org/download/search/jesd68.pdf */ -static void flash_read_cfi(flash_info_t *info, void *buf, - unsigned int start, size_t len) +static void flash_read_cfi(flash_info_t *info, void *buf, unsigned int start, + size_t len) { u8 *p = buf; unsigned int i; @@ -1897,22 +1895,22 @@ static int __flash_detect_cfi(flash_info_t *info, struct cfi_qry *qry) for (cfi_offset = 0; cfi_offset < ARRAY_SIZE(flash_offset_cfi); cfi_offset++) { flash_write_cmd(info, 0, flash_offset_cfi[cfi_offset], - FLASH_CMD_CFI); + FLASH_CMD_CFI); if (flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP, 'Q') && flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 1, 'R') && flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 2, 'Y')) { - flash_read_cfi(info, qry, FLASH_OFFSET_CFI_RESP, - sizeof(struct cfi_qry)); + flash_read_cfi(info, qry, FLASH_OFFSET_CFI_RESP, + sizeof(struct cfi_qry)); info->interface = le16_to_cpu(qry->interface_desc); info->cfi_offset = flash_offset_cfi[cfi_offset]; debug("device interface is %d\n", - info->interface); + info->interface); debug("found port %d chip %d ", - info->portwidth, info->chipwidth); + info->portwidth, info->chipwidth); debug("port %d bits chip %d bits\n", - info->portwidth << CFI_FLASH_SHIFT_WIDTH, - info->chipwidth << CFI_FLASH_SHIFT_WIDTH); + info->portwidth << CFI_FLASH_SHIFT_WIDTH, + info->chipwidth << CFI_FLASH_SHIFT_WIDTH); /* calculate command offsets as in the Linux driver */ info->addr_unlock1 = 0x555; @@ -2044,11 +2042,11 @@ static void flash_fixup_num(flash_info_t *info, struct cfi_qry *qry) * So adjust the buffer size for M29EW while operating in 8-bit mode */ if (qry->max_buf_write_size > 0x8 && - info->device_id == 0x7E && - (info->device_id2 == 0x2201 || - info->device_id2 == 0x2301 || - info->device_id2 == 0x2801 || - info->device_id2 == 0x4801)) { + info->device_id == 0x7E && + (info->device_id2 == 0x2201 || + info->device_id2 == 0x2301 || + info->device_id2 == 0x2801 || + info->device_id2 == 0x4801)) { debug("Adjusted buffer size on Numonyx flash"); debug(" M29EW family in 8 bit mode\n"); qry->max_buf_write_size = 0x8; @@ -2110,7 +2108,7 @@ ulong flash_get_size(phys_addr_t base, int banknum) break; default: printf("CFI: Unknown command set 0x%x\n", - info->vendor); + info->vendor); /* * Unfortunately, this means we don't know how * to get the chip back to Read mode. Might @@ -2149,12 +2147,12 @@ ulong flash_get_size(phys_addr_t base, int banknum) size_ratio = info->portwidth / info->chipwidth; /* if the chip is x8/x16 reduce the ratio by half */ if (info->interface == FLASH_CFI_X8X16 && - info->chipwidth == FLASH_CFI_BY8) { + info->chipwidth == FLASH_CFI_BY8) { size_ratio >>= 1; } debug("size_ratio %d port %d bits chip %d bits\n", - size_ratio, info->portwidth << CFI_FLASH_SHIFT_WIDTH, - info->chipwidth << CFI_FLASH_SHIFT_WIDTH); + size_ratio, info->portwidth << CFI_FLASH_SHIFT_WIDTH, + info->chipwidth << CFI_FLASH_SHIFT_WIDTH); info->size = 1 << qry.dev_size; /* multiply the size by the number of chips */ info->size *= size_ratio; @@ -2173,7 +2171,7 @@ ulong flash_get_size(phys_addr_t base, int banknum) if (i > NUM_ERASE_REGIONS) { printf("%d erase regions found, only %d used\n", - num_erase_regions, NUM_ERASE_REGIONS); + num_erase_regions, NUM_ERASE_REGIONS); break; } @@ -2217,8 +2215,8 @@ ulong flash_get_size(phys_addr_t base, int banknum) FLASH_CMD_READ_ID); info->protect[sect_cnt] = flash_isset(info, sect_cnt, - FLASH_OFFSET_PROTECT, - FLASH_STATUS_PROTECT); + FLASH_OFFSET_PROTECT, + FLASH_STATUS_PROTECT); flash_write_cmd(info, sect_cnt, 0, FLASH_CMD_RESET); break; @@ -2328,25 +2326,25 @@ static void flash_protect_default(void) #if (CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE) && \ (!defined(CONFIG_MONITOR_IS_IN_RAM)) flash_protect(FLAG_PROTECT_SET, - CONFIG_SYS_MONITOR_BASE, - CONFIG_SYS_MONITOR_BASE + monitor_flash_len - 1, - flash_get_info(CONFIG_SYS_MONITOR_BASE)); + CONFIG_SYS_MONITOR_BASE, + CONFIG_SYS_MONITOR_BASE + monitor_flash_len - 1, + flash_get_info(CONFIG_SYS_MONITOR_BASE)); #endif /* Environment protection ON by default */ #ifdef CONFIG_ENV_IS_IN_FLASH flash_protect(FLAG_PROTECT_SET, - CONFIG_ENV_ADDR, - CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE - 1, - flash_get_info(CONFIG_ENV_ADDR)); + CONFIG_ENV_ADDR, + CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE - 1, + flash_get_info(CONFIG_ENV_ADDR)); #endif /* Redundant environment protection ON by default */ #ifdef CONFIG_ENV_ADDR_REDUND flash_protect(FLAG_PROTECT_SET, - CONFIG_ENV_ADDR_REDUND, - CONFIG_ENV_ADDR_REDUND + CONFIG_ENV_SECT_SIZE - 1, - flash_get_info(CONFIG_ENV_ADDR_REDUND)); + CONFIG_ENV_ADDR_REDUND, + CONFIG_ENV_ADDR_REDUND + CONFIG_ENV_SECT_SIZE - 1, + flash_get_info(CONFIG_ENV_ADDR_REDUND)); #endif #if defined(CONFIG_SYS_FLASH_AUTOPROTECT_LIST) @@ -2354,9 +2352,9 @@ static void flash_protect_default(void) debug("autoprotecting from %08lx to %08lx\n", apl[i].start, apl[i].start + apl[i].size - 1); flash_protect(FLAG_PROTECT_SET, - apl[i].start, - apl[i].start + apl[i].size - 1, - flash_get_info(apl[i].start)); + apl[i].start, + apl[i].start + apl[i].size - 1, + flash_get_info(apl[i].start)); } #endif } @@ -2392,8 +2390,8 @@ unsigned long flash_init(void) #ifndef CONFIG_SYS_FLASH_QUIET_TEST printf("## Unknown flash on Bank %d ", i + 1); printf("- Size = 0x%08lx = %ld MB\n", - flash_info[i].size, - flash_info[i].size >> 20); + flash_info[i].size, + flash_info[i].size >> 20); #endif /* CONFIG_SYS_FLASH_QUIET_TEST */ } #ifdef CONFIG_SYS_FLASH_PROTECTION @@ -2437,10 +2435,10 @@ unsigned long flash_init(void) * No legancy unlocking -> unlock all sectors */ flash_protect(FLAG_PROTECT_CLEAR, - flash_info[i].start[0], - flash_info[i].start[0] - + flash_info[i].size - 1, - &flash_info[i]); + flash_info[i].start[0], + flash_info[i].start[0] + + flash_info[i].size - 1, + &flash_info[i]); } } #endif /* CONFIG_SYS_FLASH_PROTECTION */ From patchwork Fri Sep 29 12:52:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819938 X-Patchwork-Delegate: wd@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 3y3XRT3J5Rz9t4k for ; Fri, 29 Sep 2017 23:27:33 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 36745C21E55; Fri, 29 Sep 2017 13:10:34 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 4AD21C21E72; Fri, 29 Sep 2017 12:56:40 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D6565C21F33; Fri, 29 Sep 2017 12:54:37 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 0FBFFC21EE9 for ; Fri, 29 Sep 2017 12:54:33 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxuoK-00004w-JY; Fri, 29 Sep 2017 14:54:32 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:19 +0200 Message-Id: <20170929125238.26226-61-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 061/080] cfi_flash: Always define cfi_flash_num_flash_banks 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 variable cfi_flash_num_flash_banks is defined iff CONFIG_SYS_MAX_FLASH_BANKS_DETECT is defined, but it is used unconditionally in the function cfi_flash_init_dm. This leads to a undefined variable compile error when CONFIG_SYS_MAX_FLASH_BANKS_DETECT is not defined, but DM is enabled. Fix this by always defining the cfi_flash_num_flash_banks variable. Signed-off-by: Mario Six --- drivers/mtd/cfi_flash.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 7795d25825..4415bcca24 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -91,6 +91,8 @@ static u16 cfi_flash_config_reg(int i) #if defined(CONFIG_SYS_MAX_FLASH_BANKS_DETECT) int cfi_flash_num_flash_banks = CONFIG_SYS_MAX_FLASH_BANKS_DETECT; +#else +int cfi_flash_num_flash_banks; #endif #ifdef CONFIG_CFI_FLASH /* for driver model */ From patchwork Fri Sep 29 12:52:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819981 X-Patchwork-Delegate: wd@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 3y3XwJ45HBz9ryv for ; Fri, 29 Sep 2017 23:49:04 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 4F56AC21E9C; Fri, 29 Sep 2017 13:12:50 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 2E4AFC21E4D; Fri, 29 Sep 2017 12:58:33 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3D38EC21F33; Fri, 29 Sep 2017 12:54:41 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 2E2D2C21F14 for ; Fri, 29 Sep 2017 12:54:37 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxuoO-00004w-PB; Fri, 29 Sep 2017 14:54:36 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:20 +0200 Message-Id: <20170929125238.26226-62-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 062/080] mtd: cfi_flash: Make live-tree compatible 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" Make the cfi_flash driver compatible with a live device tree. Signed-off-by: Mario Six --- drivers/mtd/cfi_flash.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 4415bcca24..accbd432e7 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -2457,27 +2457,28 @@ unsigned long flash_init(void) #ifdef CONFIG_CFI_FLASH /* for driver model */ static int cfi_flash_probe(struct udevice *dev) { - void *blob = (void *)gd->fdt_blob; - int node = dev_of_offset(dev); const fdt32_t *cell; - phys_addr_t addr; - int parent, addrc, sizec; + int addrc, sizec; int len, idx; - parent = fdt_parent_offset(blob, node); - fdt_support_default_count_cells(blob, parent, &addrc, &sizec); - /* decode regs, there may be multiple reg tuples. */ - cell = fdt_getprop(blob, node, "reg", &len); + addrc = dev_read_addr_cells(dev); + sizec = dev_read_size_cells(dev); + + /* decode regs; there may be multiple reg tuples. */ + cell = dev_read_prop(dev, "reg", &len); if (!cell) return -ENOENT; idx = 0; len /= sizeof(fdt32_t); while (idx < len) { - addr = fdt_translate_address((void *)blob, - node, cell + idx); + phys_addr_t addr; + + addr = dev_translate_address(dev, cell + idx); + flash_info[cfi_flash_num_flash_banks].dev = dev; flash_info[cfi_flash_num_flash_banks].base = addr; cfi_flash_num_flash_banks++; + idx += addrc + sizec; } gd->bd->bi_flashstart = flash_info[0].base; From patchwork Fri Sep 29 12:52:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819942 X-Patchwork-Delegate: wd@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 3y3XSr0s4mz9rxj for ; Fri, 29 Sep 2017 23:28:44 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id D4EA2C21DB2; Fri, 29 Sep 2017 13:16:03 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 7871DC21E7F; Fri, 29 Sep 2017 13:03:12 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0B4F1C21EE4; Fri, 29 Sep 2017 12:54:43 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id A0B34C21E64 for ; Fri, 29 Sep 2017 12:54:37 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxuoO-00004w-TP; Fri, 29 Sep 2017 14:54:36 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:21 +0200 Message-Id: <20170929125238.26226-63-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 063/080] gpio: mpc85xx_gpio: Fix style violations 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" Fix some style violations in the MPC85XX GPIO driver. Signed-off-by: Mario Six --- drivers/gpio/mpc85xx_gpio.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/drivers/gpio/mpc85xx_gpio.c b/drivers/gpio/mpc85xx_gpio.c index cfeb6e7632..4566c091b7 100644 --- a/drivers/gpio/mpc85xx_gpio.c +++ b/drivers/gpio/mpc85xx_gpio.c @@ -34,11 +34,13 @@ struct mpc85xx_gpio_data { uint gpio_count; /* The GPDAT register cannot be used to determine the value of output * pins on MPC8572/MPC8536, so we shadow it and use the shadowed value - * for output pins */ + * for output pins + */ u32 dat_shadow; }; -inline u32 gpio_mask(unsigned gpio) { +inline u32 gpio_mask(uint gpio) +{ return (1U << (31 - (gpio))); } @@ -92,7 +94,7 @@ static inline void mpc85xx_gpio_open_drain_off(struct ccsr_gpio *base, clrbits_be32(&base->gpodr, gpios); } -static int mpc85xx_gpio_direction_input(struct udevice *dev, unsigned gpio) +static int mpc85xx_gpio_direction_input(struct udevice *dev, uint gpio) { struct mpc85xx_gpio_data *data = dev_get_priv(dev); @@ -100,8 +102,7 @@ static int mpc85xx_gpio_direction_input(struct udevice *dev, unsigned gpio) return 0; } -static int mpc85xx_gpio_set_value(struct udevice *dev, unsigned gpio, - int value) +static int mpc85xx_gpio_set_value(struct udevice *dev, uint gpio, int value) { struct mpc85xx_gpio_data *data = dev_get_priv(dev); @@ -115,46 +116,46 @@ static int mpc85xx_gpio_set_value(struct udevice *dev, unsigned gpio, return 0; } -static int mpc85xx_gpio_direction_output(struct udevice *dev, unsigned gpio, +static int mpc85xx_gpio_direction_output(struct udevice *dev, uint gpio, int value) { return mpc85xx_gpio_set_value(dev, gpio, value); } -static int mpc85xx_gpio_get_value(struct udevice *dev, unsigned gpio) +static int mpc85xx_gpio_get_value(struct udevice *dev, uint gpio) { struct mpc85xx_gpio_data *data = dev_get_priv(dev); if (!!mpc85xx_gpio_get_dir(data->base, gpio_mask(gpio))) { /* Output -> use shadowed value */ return !!(data->dat_shadow & gpio_mask(gpio)); - } else { - /* Input -> read value from GPDAT register */ - return !!mpc85xx_gpio_get_val(data->base, gpio_mask(gpio)); } + + /* Input -> read value from GPDAT register */ + return !!mpc85xx_gpio_get_val(data->base, gpio_mask(gpio)); } -static int mpc85xx_gpio_get_open_drain(struct udevice *dev, unsigned gpio) +static int mpc85xx_gpio_get_open_drain(struct udevice *dev, uint gpio) { struct mpc85xx_gpio_data *data = dev_get_priv(dev); return !!mpc85xx_gpio_open_drain_val(data->base, gpio_mask(gpio)); } -static int mpc85xx_gpio_set_open_drain(struct udevice *dev, unsigned gpio, +static int mpc85xx_gpio_set_open_drain(struct udevice *dev, uint gpio, int value) { struct mpc85xx_gpio_data *data = dev_get_priv(dev); - if (value) { + if (value) mpc85xx_gpio_open_drain_on(data->base, gpio_mask(gpio)); - } else { + else mpc85xx_gpio_open_drain_off(data->base, gpio_mask(gpio)); - } + return 0; } -static int mpc85xx_gpio_get_function(struct udevice *dev, unsigned gpio) +static int mpc85xx_gpio_get_function(struct udevice *dev, uint gpio) { struct mpc85xx_gpio_data *data = dev_get_priv(dev); int dir; @@ -164,14 +165,15 @@ static int mpc85xx_gpio_get_function(struct udevice *dev, unsigned gpio) } #if CONFIG_IS_ENABLED(OF_CONTROL) -static int mpc85xx_gpio_ofdata_to_platdata(struct udevice *dev) { +static int mpc85xx_gpio_ofdata_to_platdata(struct udevice *dev) +{ struct mpc85xx_gpio_plat *plat = dev_get_platdata(dev); fdt_addr_t addr; fdt_size_t size; addr = fdtdec_get_addr_size_auto_noparent(gd->fdt_blob, - dev_of_offset(dev), "reg", 0, &size, false); - + dev_of_offset(dev), + "reg", 0, &size, false); plat->addr = addr; plat->size = size; plat->ngpios = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), @@ -229,7 +231,7 @@ static const struct dm_gpio_ops gpio_mpc85xx_ops = { .set_value = mpc85xx_gpio_set_value, .get_open_drain = mpc85xx_gpio_get_open_drain, .set_open_drain = mpc85xx_gpio_set_open_drain, - .get_function = mpc85xx_gpio_get_function, + .get_function = mpc85xx_gpio_get_function, }; static const struct udevice_id mpc85xx_gpio_ids[] = { From patchwork Fri Sep 29 12:52:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819925 X-Patchwork-Delegate: wd@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 3y3XHk4yRZz9t4g for ; Fri, 29 Sep 2017 23:20:50 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 2F5F8C21DC3; Fri, 29 Sep 2017 13:15:00 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 799ABC21EBD; Fri, 29 Sep 2017 13:02:08 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 1BDF1C21DA0; Fri, 29 Sep 2017 12:54:46 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 97D68C21F0E for ; Fri, 29 Sep 2017 12:54:41 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxuoT-00004w-1U; Fri, 29 Sep 2017 14:54:41 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:22 +0200 Message-Id: <20170929125238.26226-64-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 064/080] gpio: mpc85xx: Rename driver file to mpc8xxx 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 preparation to making the MPC85xx GPIO driver useable for a broader range of SoCs, rename the driver file. Signed-off-by: Mario Six --- drivers/gpio/Makefile | 2 +- drivers/gpio/{mpc85xx_gpio.c => mpc8xxx_gpio.c} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename drivers/gpio/{mpc85xx_gpio.c => mpc8xxx_gpio.c} (100%) diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index 1396467ab6..38ff3773a1 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -37,7 +37,7 @@ obj-$(CONFIG_DA8XX_GPIO) += da8xx_gpio.o obj-$(CONFIG_DM644X_GPIO) += da8xx_gpio.o obj-$(CONFIG_ALTERA_PIO) += altera_pio.o obj-$(CONFIG_MPC83XX_GPIO) += mpc83xx_gpio.o -obj-$(CONFIG_MPC85XX_GPIO) += mpc85xx_gpio.o +obj-$(CONFIG_MPC85XX_GPIO) += mpc8xxx_gpio.o obj-$(CONFIG_SH_GPIO_PFC) += sh_pfc.o obj-$(CONFIG_OMAP_GPIO) += omap_gpio.o obj-$(CONFIG_DB8500_GPIO) += db8500_gpio.o diff --git a/drivers/gpio/mpc85xx_gpio.c b/drivers/gpio/mpc8xxx_gpio.c similarity index 100% rename from drivers/gpio/mpc85xx_gpio.c rename to drivers/gpio/mpc8xxx_gpio.c From patchwork Fri Sep 29 12:52:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819922 X-Patchwork-Delegate: wd@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 3y3XFd1yDCz9t32 for ; Fri, 29 Sep 2017 23:19:01 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 00E71C21E09; Fri, 29 Sep 2017 13:14:32 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 844E1C21E93; Fri, 29 Sep 2017 13:02:04 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 8267BC21DDF; Fri, 29 Sep 2017 12:54:50 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 17E48C21F0C for ; Fri, 29 Sep 2017 12:54:46 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxuoX-00004w-76; Fri, 29 Sep 2017 14:54:45 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:23 +0200 Message-Id: <20170929125238.26226-65-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 065/080] gpio: mpc8xxx: Rename Kconfig option, structures, and functions 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" Rename the Kconfig option, structures (and their members), as well as functions of the mpc85xx driver to include mpc8xxx to reflect the more generic usage. Signed-off-by: Mario Six --- arch/powerpc/include/asm/arch-mpc85xx/gpio.h | 2 +- drivers/gpio/Kconfig | 9 +-- drivers/gpio/Makefile | 2 +- drivers/gpio/mpc8xxx_gpio.c | 116 ++++++++++++++------------- 4 files changed, 64 insertions(+), 65 deletions(-) diff --git a/arch/powerpc/include/asm/arch-mpc85xx/gpio.h b/arch/powerpc/include/asm/arch-mpc85xx/gpio.h index 76faa22c8b..b2ba31e623 100644 --- a/arch/powerpc/include/asm/arch-mpc85xx/gpio.h +++ b/arch/powerpc/include/asm/arch-mpc85xx/gpio.h @@ -18,7 +18,7 @@ #include #endif -struct mpc85xx_gpio_plat { +struct mpc8xxx_gpio_plat { ulong addr; unsigned long size; uint ngpios; diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index ffeda9425a..19d862f608 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -263,11 +263,11 @@ config DM_PCA953X Now, max 24 bits chips and PCA953X compatible chips are supported -config MPC85XX_GPIO - bool "Freescale MPC85XX GPIO driver" +config MPC8XXX_GPIO + bool "Freescale MPC8XXX GPIO driver" depends on DM_GPIO help - This driver supports the built-in GPIO controller of MPC85XX CPUs. + This driver supports the built-in GPIO controller of MPC8XXX CPUs. Each GPIO bank is identified by its own entry in the device tree, i.e. @@ -285,7 +285,4 @@ config MPC85XX_GPIO Aside from the standard functions of input/output mode, and output value setting, the open-drain feature, which can configure individual GPIOs to work as open-drain outputs, is supported. - - The driver has been tested on MPC85XX, but it is likely that other - PowerQUICC III devices will work as well. endmenu diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index 38ff3773a1..81c39187de 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -37,7 +37,7 @@ obj-$(CONFIG_DA8XX_GPIO) += da8xx_gpio.o obj-$(CONFIG_DM644X_GPIO) += da8xx_gpio.o obj-$(CONFIG_ALTERA_PIO) += altera_pio.o obj-$(CONFIG_MPC83XX_GPIO) += mpc83xx_gpio.o -obj-$(CONFIG_MPC85XX_GPIO) += mpc8xxx_gpio.o +obj-$(CONFIG_MPC8XXX_GPIO) += mpc8xxx_gpio.o obj-$(CONFIG_SH_GPIO_PFC) += sh_pfc.o obj-$(CONFIG_OMAP_GPIO) += omap_gpio.o obj-$(CONFIG_DB8500_GPIO) += db8500_gpio.o diff --git a/drivers/gpio/mpc8xxx_gpio.c b/drivers/gpio/mpc8xxx_gpio.c index 4566c091b7..e4ebbc117c 100644 --- a/drivers/gpio/mpc8xxx_gpio.c +++ b/drivers/gpio/mpc8xxx_gpio.c @@ -25,7 +25,7 @@ struct ccsr_gpio { u32 gpicr; }; -struct mpc85xx_gpio_data { +struct mpc8xxx_gpio_data { /* The bank's register base in memory */ struct ccsr_gpio __iomem *base; /* The address of the registers; used to identify the bank */ @@ -44,130 +44,130 @@ inline u32 gpio_mask(uint gpio) return (1U << (31 - (gpio))); } -static inline u32 mpc85xx_gpio_get_val(struct ccsr_gpio *base, u32 mask) +static inline u32 mpc8xxx_gpio_get_val(struct ccsr_gpio *base, u32 mask) { return in_be32(&base->gpdat) & mask; } -static inline u32 mpc85xx_gpio_get_dir(struct ccsr_gpio *base, u32 mask) +static inline u32 mpc8xxx_gpio_get_dir(struct ccsr_gpio *base, u32 mask) { return in_be32(&base->gpdir) & mask; } -static inline void mpc85xx_gpio_set_in(struct ccsr_gpio *base, u32 gpios) +static inline void mpc8xxx_gpio_set_in(struct ccsr_gpio *base, u32 gpios) { clrbits_be32(&base->gpdat, gpios); /* GPDIR register 0 -> input */ clrbits_be32(&base->gpdir, gpios); } -static inline void mpc85xx_gpio_set_low(struct ccsr_gpio *base, u32 gpios) +static inline void mpc8xxx_gpio_set_low(struct ccsr_gpio *base, u32 gpios) { clrbits_be32(&base->gpdat, gpios); /* GPDIR register 1 -> output */ setbits_be32(&base->gpdir, gpios); } -static inline void mpc85xx_gpio_set_high(struct ccsr_gpio *base, u32 gpios) +static inline void mpc8xxx_gpio_set_high(struct ccsr_gpio *base, u32 gpios) { setbits_be32(&base->gpdat, gpios); /* GPDIR register 1 -> output */ setbits_be32(&base->gpdir, gpios); } -static inline int mpc85xx_gpio_open_drain_val(struct ccsr_gpio *base, u32 mask) +static inline int mpc8xxx_gpio_open_drain_val(struct ccsr_gpio *base, u32 mask) { return in_be32(&base->gpodr) & mask; } -static inline void mpc85xx_gpio_open_drain_on(struct ccsr_gpio *base, u32 +static inline void mpc8xxx_gpio_open_drain_on(struct ccsr_gpio *base, u32 gpios) { /* GPODR register 1 -> open drain on */ setbits_be32(&base->gpodr, gpios); } -static inline void mpc85xx_gpio_open_drain_off(struct ccsr_gpio *base, +static inline void mpc8xxx_gpio_open_drain_off(struct ccsr_gpio *base, u32 gpios) { /* GPODR register 0 -> open drain off (actively driven) */ clrbits_be32(&base->gpodr, gpios); } -static int mpc85xx_gpio_direction_input(struct udevice *dev, uint gpio) +static int mpc8xxx_gpio_direction_input(struct udevice *dev, uint gpio) { - struct mpc85xx_gpio_data *data = dev_get_priv(dev); + struct mpc8xxx_gpio_data *data = dev_get_priv(dev); - mpc85xx_gpio_set_in(data->base, gpio_mask(gpio)); + mpc8xxx_gpio_set_in(data->base, gpio_mask(gpio)); return 0; } -static int mpc85xx_gpio_set_value(struct udevice *dev, uint gpio, int value) +static int mpc8xxx_gpio_set_value(struct udevice *dev, uint gpio, int value) { - struct mpc85xx_gpio_data *data = dev_get_priv(dev); + struct mpc8xxx_gpio_data *data = dev_get_priv(dev); if (value) { data->dat_shadow |= gpio_mask(gpio); - mpc85xx_gpio_set_high(data->base, gpio_mask(gpio)); + mpc8xxx_gpio_set_high(data->base, gpio_mask(gpio)); } else { data->dat_shadow &= ~gpio_mask(gpio); - mpc85xx_gpio_set_low(data->base, gpio_mask(gpio)); + mpc8xxx_gpio_set_low(data->base, gpio_mask(gpio)); } return 0; } -static int mpc85xx_gpio_direction_output(struct udevice *dev, uint gpio, +static int mpc8xxx_gpio_direction_output(struct udevice *dev, uint gpio, int value) { - return mpc85xx_gpio_set_value(dev, gpio, value); + return mpc8xxx_gpio_set_value(dev, gpio, value); } -static int mpc85xx_gpio_get_value(struct udevice *dev, uint gpio) +static int mpc8xxx_gpio_get_value(struct udevice *dev, uint gpio) { - struct mpc85xx_gpio_data *data = dev_get_priv(dev); + struct mpc8xxx_gpio_data *data = dev_get_priv(dev); - if (!!mpc85xx_gpio_get_dir(data->base, gpio_mask(gpio))) { + if (!!mpc8xxx_gpio_get_dir(data->base, gpio_mask(gpio))) { /* Output -> use shadowed value */ return !!(data->dat_shadow & gpio_mask(gpio)); } /* Input -> read value from GPDAT register */ - return !!mpc85xx_gpio_get_val(data->base, gpio_mask(gpio)); + return !!mpc8xxx_gpio_get_val(data->base, gpio_mask(gpio)); } -static int mpc85xx_gpio_get_open_drain(struct udevice *dev, uint gpio) +static int mpc8xxx_gpio_get_open_drain(struct udevice *dev, uint gpio) { - struct mpc85xx_gpio_data *data = dev_get_priv(dev); + struct mpc8xxx_gpio_data *data = dev_get_priv(dev); - return !!mpc85xx_gpio_open_drain_val(data->base, gpio_mask(gpio)); + return !!mpc8xxx_gpio_open_drain_val(data->base, gpio_mask(gpio)); } -static int mpc85xx_gpio_set_open_drain(struct udevice *dev, uint gpio, +static int mpc8xxx_gpio_set_open_drain(struct udevice *dev, uint gpio, int value) { - struct mpc85xx_gpio_data *data = dev_get_priv(dev); + struct mpc8xxx_gpio_data *data = dev_get_priv(dev); if (value) - mpc85xx_gpio_open_drain_on(data->base, gpio_mask(gpio)); + mpc8xxx_gpio_open_drain_on(data->base, gpio_mask(gpio)); else - mpc85xx_gpio_open_drain_off(data->base, gpio_mask(gpio)); + mpc8xxx_gpio_open_drain_off(data->base, gpio_mask(gpio)); return 0; } -static int mpc85xx_gpio_get_function(struct udevice *dev, uint gpio) +static int mpc8xxx_gpio_get_function(struct udevice *dev, uint gpio) { - struct mpc85xx_gpio_data *data = dev_get_priv(dev); + struct mpc8xxx_gpio_data *data = dev_get_priv(dev); int dir; - dir = !!mpc85xx_gpio_get_dir(data->base, gpio_mask(gpio)); + dir = !!mpc8xxx_gpio_get_dir(data->base, gpio_mask(gpio)); return dir ? GPIOF_OUTPUT : GPIOF_INPUT; } #if CONFIG_IS_ENABLED(OF_CONTROL) -static int mpc85xx_gpio_ofdata_to_platdata(struct udevice *dev) +static int mpc8xxx_gpio_ofdata_to_platdata(struct udevice *dev) { - struct mpc85xx_gpio_plat *plat = dev_get_platdata(dev); + struct mpc8xxx_gpio_plat *plat = dev_get_platdata(dev); fdt_addr_t addr; fdt_size_t size; @@ -183,10 +183,10 @@ static int mpc85xx_gpio_ofdata_to_platdata(struct udevice *dev) } #endif -static int mpc85xx_gpio_platdata_to_priv(struct udevice *dev) +static int mpc8xxx_gpio_platdata_to_priv(struct udevice *dev) { - struct mpc85xx_gpio_data *priv = dev_get_priv(dev); - struct mpc85xx_gpio_plat *plat = dev_get_platdata(dev); + struct mpc8xxx_gpio_data *priv = dev_get_priv(dev); + struct mpc8xxx_gpio_plat *plat = dev_get_platdata(dev); unsigned long size = plat->size; if (size == 0) @@ -201,16 +201,18 @@ static int mpc85xx_gpio_platdata_to_priv(struct udevice *dev) priv->gpio_count = plat->ngpios; priv->dat_shadow = 0; + priv->type = driver_data; + return 0; } -static int mpc85xx_gpio_probe(struct udevice *dev) +static int mpc8xxx_gpio_probe(struct udevice *dev) { struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); - struct mpc85xx_gpio_data *data = dev_get_priv(dev); + struct mpc8xxx_gpio_data *data = dev_get_priv(dev); char name[32], *str; - mpc85xx_gpio_platdata_to_priv(dev); + mpc8xxx_gpio_platdata_to_priv(dev); snprintf(name, sizeof(name), "MPC@%lx_", data->addr); str = strdup(name); @@ -224,30 +226,30 @@ static int mpc85xx_gpio_probe(struct udevice *dev) return 0; } -static const struct dm_gpio_ops gpio_mpc85xx_ops = { - .direction_input = mpc85xx_gpio_direction_input, - .direction_output = mpc85xx_gpio_direction_output, - .get_value = mpc85xx_gpio_get_value, - .set_value = mpc85xx_gpio_set_value, - .get_open_drain = mpc85xx_gpio_get_open_drain, - .set_open_drain = mpc85xx_gpio_set_open_drain, - .get_function = mpc85xx_gpio_get_function, +static const struct dm_gpio_ops gpio_mpc8xxx_ops = { + .direction_input = mpc8xxx_gpio_direction_input, + .direction_output = mpc8xxx_gpio_direction_output, + .get_value = mpc8xxx_gpio_get_value, + .set_value = mpc8xxx_gpio_set_value, + .get_open_drain = mpc8xxx_gpio_get_open_drain, + .set_open_drain = mpc8xxx_gpio_set_open_drain, + .get_function = mpc8xxx_gpio_get_function, }; -static const struct udevice_id mpc85xx_gpio_ids[] = { +static const struct udevice_id mpc8xxx_gpio_ids[] = { { .compatible = "fsl,pq3-gpio" }, { /* sentinel */ } }; -U_BOOT_DRIVER(gpio_mpc85xx) = { - .name = "gpio_mpc85xx", +U_BOOT_DRIVER(gpio_mpc8xxx) = { + .name = "gpio_mpc8xxx", .id = UCLASS_GPIO, - .ops = &gpio_mpc85xx_ops, + .ops = &gpio_mpc8xxx_ops, #if CONFIG_IS_ENABLED(OF_CONTROL) - .ofdata_to_platdata = mpc85xx_gpio_ofdata_to_platdata, - .platdata_auto_alloc_size = sizeof(struct mpc85xx_gpio_plat), - .of_match = mpc85xx_gpio_ids, + .ofdata_to_platdata = mpc8xxx_gpio_ofdata_to_platdata, + .platdata_auto_alloc_size = sizeof(struct mpc8xxx_gpio_plat), + .of_match = mpc8xxx_gpio_ids, #endif - .probe = mpc85xx_gpio_probe, - .priv_auto_alloc_size = sizeof(struct mpc85xx_gpio_data), + .probe = mpc8xxx_gpio_probe, + .priv_auto_alloc_size = sizeof(struct mpc8xxx_gpio_data), }; From patchwork Fri Sep 29 12:52:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819982 X-Patchwork-Delegate: wd@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 3y3XwR6DnMz9t4g for ; Fri, 29 Sep 2017 23:49:11 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 9ABADC21EA8; Fri, 29 Sep 2017 13:17:05 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 79870C21E9B; Fri, 29 Sep 2017 13:04:09 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 31497C21DF3; Fri, 29 Sep 2017 12:54:50 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id C4192C21E72 for ; Fri, 29 Sep 2017 12:54:45 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxuoX-00004w-BZ; Fri, 29 Sep 2017 14:54:45 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:24 +0200 Message-Id: <20170929125238.26226-66-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 066/080] gpio: mpc8xxx: Make compatible with more SoCs 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" Finally, make the mpc8xxx driver capable of handling more GPIO devices; this entails adding a special case for the MPC5121 SoC, and adding a set of new compatible strings. Signed-off-by: Mario Six --- drivers/gpio/mpc8xxx_gpio.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/mpc8xxx_gpio.c b/drivers/gpio/mpc8xxx_gpio.c index e4ebbc117c..0aa72ecd9f 100644 --- a/drivers/gpio/mpc8xxx_gpio.c +++ b/drivers/gpio/mpc8xxx_gpio.c @@ -11,8 +11,8 @@ #include #include -#include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -37,6 +37,12 @@ struct mpc8xxx_gpio_data { * for output pins */ u32 dat_shadow; + ulong type; +}; + +enum { + MPC8XXX_GPIO_TYPE, + MPC5121_GPIO_TYPE, }; inline u32 gpio_mask(uint gpio) @@ -119,6 +125,12 @@ static int mpc8xxx_gpio_set_value(struct udevice *dev, uint gpio, int value) static int mpc8xxx_gpio_direction_output(struct udevice *dev, uint gpio, int value) { + struct mpc8xxx_gpio_data *data = dev_get_priv(dev); + + /* GPIO 28..31 are input only on MPC5121 */ + if (data->type == MPC5121_GPIO_TYPE && gpio >= 28) + return -EINVAL; + return mpc8xxx_gpio_set_value(dev, gpio, value); } @@ -188,6 +200,7 @@ static int mpc8xxx_gpio_platdata_to_priv(struct udevice *dev) struct mpc8xxx_gpio_data *priv = dev_get_priv(dev); struct mpc8xxx_gpio_plat *plat = dev_get_platdata(dev); unsigned long size = plat->size; + ulong driver_data = dev_get_driver_data(dev); if (size == 0) size = 0x100; @@ -237,7 +250,13 @@ static const struct dm_gpio_ops gpio_mpc8xxx_ops = { }; static const struct udevice_id mpc8xxx_gpio_ids[] = { - { .compatible = "fsl,pq3-gpio" }, + { .compatible = "fsl,pq3-gpio", .data = MPC8XXX_GPIO_TYPE }, + { .compatible = "fsl,mpc8308-gpio", .data = MPC8XXX_GPIO_TYPE }, + { .compatible = "fsl,mpc8349-gpio", .data = MPC8XXX_GPIO_TYPE }, + { .compatible = "fsl,mpc8572-gpio", .data = MPC8XXX_GPIO_TYPE}, + { .compatible = "fsl,mpc8610-gpio", .data = MPC8XXX_GPIO_TYPE}, + { .compatible = "fsl,mpc5121-gpio", .data = MPC5121_GPIO_TYPE, }, + { .compatible = "fsl,qoriq-gpio", .data = MPC8XXX_GPIO_TYPE }, { /* sentinel */ } }; From patchwork Fri Sep 29 12:52:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819970 X-Patchwork-Delegate: wd@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 3y3Xmn2MY5z9rvt for ; Fri, 29 Sep 2017 23:42:33 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 1226DC21E76; Fri, 29 Sep 2017 13:12: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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 6A931C21E74; Fri, 29 Sep 2017 12:58:19 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 784DCC21DA3; Fri, 29 Sep 2017 12:54:53 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id E8DF8C21EF0 for ; Fri, 29 Sep 2017 12:54:49 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxuob-00004w-Fr; Fri, 29 Sep 2017 14:54:49 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:25 +0200 Message-Id: <20170929125238.26226-67-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 067/080] mpc83xx: Prepare usage of DM gpio 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" The MPC85xx GPIO driver was converted to handle a broader range of SoCs. Prepare the MPC83xx code for usage of this driver. Signed-off-by: Mario Six --- arch/powerpc/include/asm/arch-mpc83xx/gpio.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/powerpc/include/asm/arch-mpc83xx/gpio.h b/arch/powerpc/include/asm/arch-mpc83xx/gpio.h index 40ef2151b8..6ec4f00022 100644 --- a/arch/powerpc/include/asm/arch-mpc83xx/gpio.h +++ b/arch/powerpc/include/asm/arch-mpc83xx/gpio.h @@ -19,7 +19,15 @@ #define MAX_NUM_GPIOS (32 * MPC83XX_GPIO_CTRLRS) +struct mpc8xxx_gpio_plat { + ulong addr; + unsigned long size; + uint ngpios; +}; + +#ifndef DM_GPIO void mpc83xx_gpio_init_f(void); void mpc83xx_gpio_init_r(void); +#endif /* DM_GPIO */ #endif /* MPC83XX_GPIO_H_ */ From patchwork Fri Sep 29 12:52:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819952 X-Patchwork-Delegate: wd@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 3y3XYV0rsCz9rxj for ; Fri, 29 Sep 2017 23:32:46 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id B140AC21E78; Fri, 29 Sep 2017 13:14:11 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 316ABC21E91; Fri, 29 Sep 2017 13:01:42 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E5FABC21DDA; Fri, 29 Sep 2017 12:54:53 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 1869DC21F0E for ; Fri, 29 Sep 2017 12:54:50 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxuob-00004w-LI; Fri, 29 Sep 2017 14:54:49 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:26 +0200 Message-Id: <20170929125238.26226-68-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 068/080] gpio: mpc8xxx: Make live-tree compatible 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" Make the MPC8xxx GPIO driver compatible with a live device tree. Signed-off-by: Mario Six --- drivers/gpio/mpc8xxx_gpio.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/gpio/mpc8xxx_gpio.c b/drivers/gpio/mpc8xxx_gpio.c index 0aa72ecd9f..326fd1672d 100644 --- a/drivers/gpio/mpc8xxx_gpio.c +++ b/drivers/gpio/mpc8xxx_gpio.c @@ -14,8 +14,6 @@ #include #include -DECLARE_GLOBAL_DATA_PTR; - struct ccsr_gpio { u32 gpdir; u32 gpodr; @@ -181,15 +179,14 @@ static int mpc8xxx_gpio_ofdata_to_platdata(struct udevice *dev) { struct mpc8xxx_gpio_plat *plat = dev_get_platdata(dev); fdt_addr_t addr; - fdt_size_t size; + u32 reg[2]; + + dev_read_u32_array(dev, "reg", reg, 2); + addr = dev_translate_address(dev, reg); - addr = fdtdec_get_addr_size_auto_noparent(gd->fdt_blob, - dev_of_offset(dev), - "reg", 0, &size, false); plat->addr = addr; - plat->size = size; - plat->ngpios = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), - "ngpios", 32); + plat->size = reg[1]; + plat->ngpios = dev_read_u32_default(dev, "ngpios", 32); return 0; } @@ -206,7 +203,7 @@ static int mpc8xxx_gpio_platdata_to_priv(struct udevice *dev) size = 0x100; priv->addr = plat->addr; - priv->base = map_sysmem(CONFIG_SYS_IMMR + plat->addr, size); + priv->base = map_sysmem(plat->addr, size); if (!priv->base) return -ENOMEM; From patchwork Fri Sep 29 12:52:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819957 X-Patchwork-Delegate: wd@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 3y3Xb20nlpz9t2x for ; Fri, 29 Sep 2017 23:34:06 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id B6397C21E84; Fri, 29 Sep 2017 13:21:53 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 50A12C21E3A; Fri, 29 Sep 2017 13:15:27 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 575ADC21E3C; Fri, 29 Sep 2017 12:55:00 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 2B98EC21E3B for ; Fri, 29 Sep 2017 12:54:54 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxuof-00004w-Pe; Fri, 29 Sep 2017 14:54:53 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:27 +0200 Message-Id: <20170929125238.26226-69-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 069/080] cmd: mdio: Fix style violations 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" Fix some style violations in the MDIO command. Signed-off-by: Mario Six --- cmd/mdio.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cmd/mdio.c b/cmd/mdio.c index 21dc103736..3f11963006 100644 --- a/cmd/mdio.c +++ b/cmd/mdio.c @@ -14,7 +14,6 @@ #include #include - static char last_op[2]; static uint last_data; static uint last_addr_lo; @@ -243,13 +242,13 @@ static int do_mdio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) case 'r': if (pos > 1) if (extract_reg_range(argv[pos--], &devadlo, &devadhi, - ®lo, ®hi)) + ®lo, ®hi)) return -1; default: if (pos > 1) - if (extract_phy_range(&(argv[2]), pos - 1, &bus, - &phydev, &addrlo, &addrhi)) + if (extract_phy_range(&argv[2], pos - 1, &bus, + &phydev, &addrlo, &addrhi)) return -1; break; From patchwork Fri Sep 29 12:52:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819927 X-Patchwork-Delegate: wd@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 3y3XK44b5pz9t32 for ; Fri, 29 Sep 2017 23:22:00 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 577C3C21E39; Fri, 29 Sep 2017 13:11:47 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 E87EDC21E40; Fri, 29 Sep 2017 12:57:43 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id DF754C21DD9; Fri, 29 Sep 2017 12:55:00 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 8A38FC21E1D for ; Fri, 29 Sep 2017 12:54:54 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxuof-00004w-VJ; Fri, 29 Sep 2017 14:54:53 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:28 +0200 Message-Id: <20170929125238.26226-70-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 070/080] common: board_f: Fix style violations 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" Fix some style violations in the board_f file. Signed-off-by: Mario Six Reviewed-by: Simon Glass --- common/board_f.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/common/board_f.c b/common/board_f.c index 9220815441..953b8fb3e7 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -50,7 +50,7 @@ #ifdef XTRN_DECLARE_GLOBAL_DATA_PTR #undef XTRN_DECLARE_GLOBAL_DATA_PTR #define XTRN_DECLARE_GLOBAL_DATA_PTR /* empty = allocate here */ -DECLARE_GLOBAL_DATA_PTR = (gd_t *) (CONFIG_SYS_INIT_GD_ADDR); +DECLARE_GLOBAL_DATA_PTR = (gd_t *)(CONFIG_SYS_INIT_GD_ADDR); #else DECLARE_GLOBAL_DATA_PTR; #endif @@ -137,7 +137,7 @@ static int display_text_info(void) #endif debug("U-Boot code: %08lX -> %08lX BSS: -> %08lX\n", - text_base, bss_start, bss_end); + text_base, bss_start, bss_end); #endif return 0; @@ -303,7 +303,7 @@ static int reserve_logbuffer(void) /* reserve kernel log buffer */ gd->relocaddr -= LOGBUFF_RESERVE; debug("Reserving %dk for kernel logbuffer at %08lx\n", LOGBUFF_LEN, - gd->relocaddr); + gd->relocaddr); #endif return 0; @@ -428,7 +428,7 @@ static int reserve_malloc(void) { gd->start_addr_sp = gd->start_addr_sp - TOTAL_MALLOC_LEN; debug("Reserving %dk for malloc() at: %08lx\n", - TOTAL_MALLOC_LEN >> 10, gd->start_addr_sp); + TOTAL_MALLOC_LEN >> 10, gd->start_addr_sp); return 0; } @@ -458,7 +458,7 @@ static int reserve_global_data(void) gd->start_addr_sp -= sizeof(gd_t); gd->new_gd = (gd_t *)map_sysmem(gd->start_addr_sp, sizeof(gd_t)); debug("Reserving %zu Bytes for Global Data at: %08lx\n", - sizeof(gd_t), gd->start_addr_sp); + sizeof(gd_t), gd->start_addr_sp); return 0; } From patchwork Fri Sep 29 12:52:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819979 X-Patchwork-Delegate: wd@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 3y3XvH19Gmz9t3f for ; Fri, 29 Sep 2017 23:48:11 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id DDB9EC21EA5; Fri, 29 Sep 2017 13:13:56 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 D68F9C21DAA; Fri, 29 Sep 2017 13:00:14 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E400FC21EA6; Fri, 29 Sep 2017 12:55:04 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id C20B9C21EF0 for ; Fri, 29 Sep 2017 12:54:58 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxuok-00004w-3R; Fri, 29 Sep 2017 14:54:58 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:29 +0200 Message-Id: <20170929125238.26226-71-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 071/080] common: board_r: Fix style violations 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" Fix some style violations in the board_r file. Signed-off-by: Mario Six Reviewed-by: Simon Glass --- common/board_r.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/common/board_r.c b/common/board_r.c index 94697e7bc1..a81addc005 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -161,9 +161,9 @@ static int initr_reloc_global_data(void) #endif #ifdef CONFIG_OF_EMBED /* - * The fdt_blob needs to be moved to new relocation address - * incase of FDT blob is embedded with in image - */ + * The fdt_blob needs to be moved to new relocation address + * incase of FDT blob is embedded with in image + */ gd->fdt_blob += gd->reloc_off; #endif #ifdef CONFIG_EFI_LOADER @@ -368,14 +368,16 @@ static int initr_flash(void) print_size(flash_size, ""); #ifdef CONFIG_SYS_FLASH_CHECKSUM /* - * Compute and print flash CRC if flashchecksum is set to 'y' - * - * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX - */ + * Compute and print flash CRC if flashchecksum is set to 'y' + * + * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX + */ if (env_get_yesno("flashchecksum") == 1) { + const uchar *flash_base = (const uchar *)CONFIG_SYS_FLASH_BASE; + printf(" CRC: %08X", crc32(0, - (const unsigned char *) CONFIG_SYS_FLASH_BASE, - flash_size)); + flash_base, + flash_size)); } #endif /* CONFIG_SYS_FLASH_CHECKSUM */ putc('\n'); @@ -392,7 +394,6 @@ static int initr_flash(void) update_flash_size(flash_size); #endif - #if defined(CONFIG_OXC) || defined(CONFIG_RMU) /* flash mapped at end of memory map */ bd->bi_flashoffset = CONFIG_SYS_TEXT_BASE + flash_size; @@ -657,7 +658,7 @@ int initr_mem(void) /* Also take the logbuffer into account (pram is in kB) */ pram += (LOGBUFF_LEN + LOGBUFF_OVERHEAD) / 1024; # endif - sprintf(memsz, "%ldk", (long int) ((gd->ram_size / 1024) - pram)); + sprintf(memsz, "%ldk", (long int)((gd->ram_size / 1024) - pram)); env_set("mem", memsz); return 0; @@ -710,7 +711,7 @@ static init_fnc_t init_sequence_r[] = { initr_caches, /* Note: For Freescale LS2 SoCs, new MMU table is created in DDR. * A temporary mapping of IFC high region is since removed, - * so environmental variables in NOR flash is not availble + * so environmental variables in NOR flash is not available * until board_init() is called below to remap IFC to high * region. */ @@ -775,7 +776,7 @@ static init_fnc_t init_sequence_r[] = { #if defined(CONFIG_PCI) && defined(CONFIG_SYS_EARLY_PCI_INIT) /* * Do early PCI configuration _before_ the flash gets initialised, - * because PCU ressources are crucial for flash access on some boards. + * because PCU resources are crucial for flash access on some boards. */ initr_pci, #endif From patchwork Fri Sep 29 12:52:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819948 X-Patchwork-Delegate: wd@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 3y3XWn6Pzmz9rxj for ; Fri, 29 Sep 2017 23:31:17 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 82CCCC21E84; Fri, 29 Sep 2017 13:12: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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 4D999C21E8A; Fri, 29 Sep 2017 12:58:00 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id F0AFFC21E52; Fri, 29 Sep 2017 12:55:09 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 3F307C21EF7 for ; Fri, 29 Sep 2017 12:55:04 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxuoo-00004w-7n; Fri, 29 Sep 2017 14:55:02 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:30 +0200 Message-Id: <20170929125238.26226-72-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 072/080] gdsys: mpc8308: Fix style violations 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" Fix some style violations in the gdsys MPC8308 board files, and make the code more readable. Signed-off-by: Mario Six --- board/gdsys/mpc8308/hrcon.c | 55 ++++++++++++++++++++++--------------------- board/gdsys/mpc8308/mpc8308.c | 12 +++++----- board/gdsys/mpc8308/strider.c | 49 +++++++++++++++++++------------------- 3 files changed, 59 insertions(+), 57 deletions(-) diff --git a/board/gdsys/mpc8308/hrcon.c b/board/gdsys/mpc8308/hrcon.c index 7e485074ce..55422b0a7f 100644 --- a/board/gdsys/mpc8308/hrcon.c +++ b/board/gdsys/mpc8308/hrcon.c @@ -38,11 +38,11 @@ DECLARE_GLOBAL_DATA_PTR; #define MAX_MUX_CHANNELS 2 enum { - MCFPGA_DONE = 1 << 0, - MCFPGA_INIT_N = 1 << 1, - MCFPGA_PROGRAM_N = 1 << 2, - MCFPGA_UPDATE_ENABLE_N = 1 << 3, - MCFPGA_RESET_N = 1 << 4, + MCFPGA_DONE = BIT(0), + MCFPGA_INIT_N = BIT(1), + MCFPGA_PROGRAM_N = BIT(2), + MCFPGA_UPDATE_ENABLE_N = BIT(3), + MCFPGA_RESET_N = BIT(4), }; enum { @@ -50,7 +50,7 @@ enum { GPIO_MDIO = 1 << 15, }; -unsigned int mclink_fpgacount; +uint mclink_fpgacount; struct ihs_fpga *fpga_ptr[] = CONFIG_SYS_FPGA_PTR; struct { @@ -110,7 +110,7 @@ int checkboard(void) printf("HRCon %s", hw_type_cat ? "CAT" : "Fiber"); - if (s != NULL) { + if (s) { puts(", serial# "); puts(s); } @@ -123,12 +123,11 @@ int checkboard(void) int last_stage_init(void) { int slaves; - unsigned int k; - unsigned int mux_ch; - unsigned char mclink_controllers[] = { 0x3c, 0x3d, 0x3e }; + uint k; + uchar mclink_controllers[] = { 0x3c, 0x3d, 0x3e }; u16 fpga_features; bool hw_type_cat = pca9698_get_value(0x20, 20); - bool ch0_rgmii2_present = false; + bool ch0_rgmii2_present; FPGA_GET_REG(0, fpga_features, &fpga_features); @@ -140,16 +139,16 @@ int last_stage_init(void) /* wait for FPGA done, then reset FPGA */ for (k = 0; k < ARRAY_SIZE(mclink_controllers); ++k) { - unsigned int ctr = 0; + uint ctr = 0; if (i2c_probe(mclink_controllers[k])) continue; while (!(pca953x_get_val(mclink_controllers[k]) & MCFPGA_DONE)) { - udelay(100000); + mdelay(100); if (ctr++ > 5) { - printf("no done for mclink_controller %d\n", k); + printf("no done for mclink_controller %u\n", k); break; } } @@ -162,8 +161,10 @@ int last_stage_init(void) } if (hw_type_cat) { + uint mux_ch; int retval; struct mii_dev *mdiodev = mdio_alloc(); + if (!mdiodev) return -ENOMEM; strncpy(mdiodev->name, bb_miiphy_buses[0].name, MDIO_NAME_LEN); @@ -182,7 +183,7 @@ int last_stage_init(void) } /* give slave-PLLs and Parade DP501 some time to be up and running */ - udelay(500000); + mdelay(500); mclink_fpgacount = CONFIG_SYS_MCLINK_MAX; slaves = mclink_probe(); @@ -210,6 +211,7 @@ int last_stage_init(void) if (hw_type_cat) { int retval; struct mii_dev *mdiodev = mdio_alloc(); + if (!mdiodev) return -ENOMEM; strncpy(mdiodev->name, bb_miiphy_buses[k].name, @@ -236,17 +238,17 @@ int last_stage_init(void) * provide access to fpga gpios and controls (for I2C bitbang) * (these may look all too simple but make iocon.h much more readable) */ -void fpga_gpio_set(unsigned int bus, int pin) +void fpga_gpio_set(uint bus, int pin) { FPGA_SET_REG(bus >= 4 ? (bus - 4) : bus, gpio.set, pin); } -void fpga_gpio_clear(unsigned int bus, int pin) +void fpga_gpio_clear(uint bus, int pin) { FPGA_SET_REG(bus >= 4 ? (bus - 4) : bus, gpio.clear, pin); } -int fpga_gpio_get(unsigned int bus, int pin) +int fpga_gpio_get(uint bus, int pin) { u16 val; @@ -255,7 +257,7 @@ int fpga_gpio_get(unsigned int bus, int pin) return val & pin; } -void fpga_control_set(unsigned int bus, int pin) +void fpga_control_set(uint bus, int pin) { u16 val; @@ -263,7 +265,7 @@ void fpga_control_set(unsigned int bus, int pin) FPGA_SET_REG(bus >= 4 ? (bus - 4) : bus, control, val | pin); } -void fpga_control_clear(unsigned int bus, int pin) +void fpga_control_clear(uint bus, int pin) { u16 val; @@ -276,7 +278,7 @@ void mpc8308_init(void) pca9698_direction_output(0x20, 4, 1); } -void mpc8308_set_fpga_reset(unsigned state) +void mpc8308_set_fpga_reset(uint state) { pca9698_set_value(0x20, 4, state ? 0 : 1); } @@ -288,11 +290,11 @@ void mpc8308_setup_hw(void) /* * set "startup-finished"-gpios */ - setbits_be32(&immr->gpio[0].dir, (1 << (31-11)) | (1 << (31-12))); - setbits_be32(&immr->gpio[0].dat, 1 << (31-12)); + setbits_be32(&immr->gpio[0].dir, (BIT(31 - 11) | BIT(31 - 12))); + setbits_be32(&immr->gpio[0].dat, BIT(31 - 12)); } -int mpc8308_get_fpga_done(unsigned fpga) +int mpc8308_get_fpga_done(uint fpga) { return pca9698_get_value(0x20, 19); } @@ -370,7 +372,7 @@ int ft_board_setup(void *blob, bd_t *bd) */ struct fpga_mii { - unsigned fpga; + uint fpga; int mdio; } fpga_mii[] = { { 0, 1}, @@ -497,5 +499,4 @@ struct bb_miiphy_bus bb_miiphy_buses[] = { }, }; -int bb_miiphy_buses_num = sizeof(bb_miiphy_buses) / - sizeof(bb_miiphy_buses[0]); +int bb_miiphy_buses_num = ARRAY_SIZE(bb_miiphy_buses); diff --git a/board/gdsys/mpc8308/mpc8308.c b/board/gdsys/mpc8308/mpc8308.c index 86b257f4de..0b1d4eab22 100644 --- a/board/gdsys/mpc8308/mpc8308.c +++ b/board/gdsys/mpc8308/mpc8308.c @@ -25,14 +25,14 @@ DECLARE_GLOBAL_DATA_PTR; -int get_fpga_state(unsigned dev) +int get_fpga_state(uint dev) { return gd->arch.fpga_state[dev]; } int board_early_init_f(void) { - unsigned k; + uint k; for (k = 0; k < CONFIG_SYS_FPGA_COUNT; ++k) gd->arch.fpga_state[k] = 0; @@ -42,8 +42,8 @@ int board_early_init_f(void) int board_early_init_r(void) { - unsigned k; - unsigned ctr; + uint k; + uint ctr; for (k = 0; k < CONFIG_SYS_FPGA_COUNT; ++k) gd->arch.fpga_state[k] = 0; @@ -60,7 +60,7 @@ int board_early_init_r(void) for (k = 0; k < CONFIG_SYS_FPGA_COUNT; ++k) { ctr = 0; while (!mpc8308_get_fpga_done(k)) { - udelay(100000); + mdelay(100); if (ctr++ > 5) { gd->arch.fpga_state[k] |= FPGA_STATE_DONE_FAILED; @@ -87,7 +87,7 @@ int board_early_init_r(void) if (val == REFLECTION_TESTPATTERN_INV) break; - udelay(100000); + mdelay(100); if (ctr++ > 5) { gd->arch.fpga_state[k] |= FPGA_STATE_REFLECTION_FAILED; diff --git a/board/gdsys/mpc8308/strider.c b/board/gdsys/mpc8308/strider.c index fec691515d..898782a2e4 100644 --- a/board/gdsys/mpc8308/strider.c +++ b/board/gdsys/mpc8308/strider.c @@ -53,7 +53,7 @@ enum { GPIO_MDIO = 1 << 15, }; -unsigned int mclink_fpgacount; +uint mclink_fpgacount; struct ihs_fpga *fpga_ptr[] = CONFIG_SYS_FPGA_PTR; struct { @@ -113,7 +113,7 @@ int checkboard(void) printf("Strider %s", hw_type_cat ? "CAT" : "Fiber"); - if (s != NULL) { + if (s) { puts(", serial# "); puts(s); } @@ -126,17 +126,17 @@ int checkboard(void) int last_stage_init(void) { int slaves; - unsigned int k; - unsigned int mux_ch; - unsigned char mclink_controllers_dvi[] = { 0x3c, 0x3d, 0x3e }; + uint k; + uint mux_ch; + uchar mclink_controllers_dvi[] = { 0x3c, 0x3d, 0x3e }; #ifdef CONFIG_STRIDER_CPU - unsigned char mclink_controllers_dp[] = { 0x24, 0x25, 0x26 }; + uchar mclink_controllers_dp[] = { 0x24, 0x25, 0x26 }; #endif bool hw_type_cat = pca9698_get_value(0x20, 18); #ifdef CONFIG_STRIDER_CON_DP bool is_dh = pca9698_get_value(0x20, 25); #endif - bool ch0_sgmii2_present = false; + bool ch0_sgmii2_present; /* Turn on Analog Devices ADV7611 */ pca9698_direction_output(0x20, 8, 0); @@ -149,8 +149,8 @@ int last_stage_init(void) /* wait for FPGA done, then reset FPGA */ for (k = 0; k < ARRAY_SIZE(mclink_controllers_dvi); ++k) { - unsigned int ctr = 0; - unsigned char *mclink_controllers = mclink_controllers_dvi; + uint ctr = 0; + uchar *mclink_controllers = mclink_controllers_dvi; #ifdef CONFIG_STRIDER_CPU if (i2c_probe(mclink_controllers[k])) { @@ -164,7 +164,7 @@ int last_stage_init(void) #endif while (!(pca953x_get_val(mclink_controllers[k]) & MCFPGA_DONE)) { - udelay(100000); + mdelay(100); if (ctr++ > 5) { printf("no done for mclink_controller %d\n", k); break; @@ -181,6 +181,7 @@ int last_stage_init(void) if (hw_type_cat) { int retval; struct mii_dev *mdiodev = mdio_alloc(); + if (!mdiodev) return -ENOMEM; strncpy(mdiodev->name, bb_miiphy_buses[0].name, MDIO_NAME_LEN); @@ -199,7 +200,7 @@ int last_stage_init(void) } /* give slave-PLLs and Parade DP501 some time to be up and running */ - udelay(500000); + mdelay(500); mclink_fpgacount = CONFIG_SYS_MCLINK_MAX; slaves = mclink_probe(); @@ -238,7 +239,7 @@ int last_stage_init(void) for (k = 1; k <= slaves; ++k) FPGA_SET_REG(k, extended_control, 0x10); /* enable video */ - udelay(500000); + mdelay(500); #endif for (k = 1; k <= slaves; ++k) { @@ -263,6 +264,7 @@ int last_stage_init(void) if (hw_type_cat) { int retval; struct mii_dev *mdiodev = mdio_alloc(); + if (!mdiodev) return -ENOMEM; strncpy(mdiodev->name, bb_miiphy_buses[k].name, @@ -289,17 +291,17 @@ int last_stage_init(void) * provide access to fpga gpios (for I2C bitbang) * (these may look all too simple but make iocon.h much more readable) */ -void fpga_gpio_set(unsigned int bus, int pin) +void fpga_gpio_set(uint bus, int pin) { FPGA_SET_REG(bus, gpio.set, pin); } -void fpga_gpio_clear(unsigned int bus, int pin) +void fpga_gpio_clear(uint bus, int pin) { FPGA_SET_REG(bus, gpio.clear, pin); } -int fpga_gpio_get(unsigned int bus, int pin) +int fpga_gpio_get(uint bus, int pin) { u16 val; @@ -309,7 +311,7 @@ int fpga_gpio_get(unsigned int bus, int pin) } #ifdef CONFIG_STRIDER_CON_DP -void fpga_control_set(unsigned int bus, int pin) +void fpga_control_set(uint bus, int pin) { u16 val; @@ -317,7 +319,7 @@ void fpga_control_set(unsigned int bus, int pin) FPGA_SET_REG(bus, control, val | pin); } -void fpga_control_clear(unsigned int bus, int pin) +void fpga_control_clear(uint bus, int pin) { u16 val; @@ -331,7 +333,7 @@ void mpc8308_init(void) pca9698_direction_output(0x20, 26, 1); } -void mpc8308_set_fpga_reset(unsigned state) +void mpc8308_set_fpga_reset(uint state) { pca9698_set_value(0x20, 26, state ? 0 : 1); } @@ -343,11 +345,11 @@ void mpc8308_setup_hw(void) /* * set "startup-finished"-gpios */ - setbits_be32(&immr->gpio[0].dir, (1 << (31-11)) | (1 << (31-12))); - setbits_be32(&immr->gpio[0].dat, 1 << (31-12)); + setbits_be32(&immr->gpio[0].dir, BIT(31 - 11) | BIT(31 - 12)); + setbits_be32(&immr->gpio[0].dat, BIT(31 - 12)); } -int mpc8308_get_fpga_done(unsigned fpga) +int mpc8308_get_fpga_done(uint fpga) { return pca9698_get_value(0x20, 20); } @@ -425,7 +427,7 @@ int ft_board_setup(void *blob, bd_t *bd) */ struct fpga_mii { - unsigned fpga; + uint fpga; int mdio; } fpga_mii[] = { { 0, 1}, @@ -552,5 +554,4 @@ struct bb_miiphy_bus bb_miiphy_buses[] = { }, }; -int bb_miiphy_buses_num = sizeof(bb_miiphy_buses) / - sizeof(bb_miiphy_buses[0]); +int bb_miiphy_buses_num = ARRAY_SIZE(bb_miiphy_buses); From patchwork Fri Sep 29 12:52:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819977 X-Patchwork-Delegate: wd@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 3y3XtL0hJwz9t4g for ; Fri, 29 Sep 2017 23:47:22 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id CB544C21EE5; Fri, 29 Sep 2017 13:13:42 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 B971AC21E71; Fri, 29 Sep 2017 12:59:28 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A8757C21DF3; Fri, 29 Sep 2017 12:55:07 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 351AFC21F25 for ; Fri, 29 Sep 2017 12:55:03 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxuoo-00004w-Ca; Fri, 29 Sep 2017 14:55:02 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:31 +0200 Message-Id: <20170929125238.26226-73-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 073/080] gdsys: mpc8308: Use shadow register for output GPIO values 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" Since gpio output status on MPC8xxx cannot be read back, it has to be buffered locally. Signed-off-by: Dirk Eibach Signed-off-by: Mario Six --- board/gdsys/mpc8308/hrcon.c | 4 ++-- board/gdsys/mpc8308/mpc8308.c | 19 +++++++++++++++++++ board/gdsys/mpc8308/mpc8308.h | 3 +++ board/gdsys/mpc8308/strider.c | 2 +- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/board/gdsys/mpc8308/hrcon.c b/board/gdsys/mpc8308/hrcon.c index 55422b0a7f..b3017de911 100644 --- a/board/gdsys/mpc8308/hrcon.c +++ b/board/gdsys/mpc8308/hrcon.c @@ -290,8 +290,8 @@ void mpc8308_setup_hw(void) /* * set "startup-finished"-gpios */ - setbits_be32(&immr->gpio[0].dir, (BIT(31 - 11) | BIT(31 - 12))); - setbits_be32(&immr->gpio[0].dat, BIT(31 - 12)); + setbits_be32(&immr->gpio[0].dir, BIT(31 - 11) | BIT(31 - 12)); + setbits_gpio0_out(BIT(31 - 12)); } int mpc8308_get_fpga_done(uint fpga) diff --git a/board/gdsys/mpc8308/mpc8308.c b/board/gdsys/mpc8308/mpc8308.c index 0b1d4eab22..8d6a49f86a 100644 --- a/board/gdsys/mpc8308/mpc8308.c +++ b/board/gdsys/mpc8308/mpc8308.c @@ -25,6 +25,25 @@ DECLARE_GLOBAL_DATA_PTR; +/* as gpio output status cannot be read back, we have to buffer it locally */ +u32 gpio0_out; + +void setbits_gpio0_out(u32 mask) +{ + immap_t *immr = (immap_t *)CONFIG_SYS_IMMR; + + gpio0_out |= mask; + out_be32(&immr->gpio[0].dat, gpio0_out); +} + +void clrbits_gpio0_out(u32 mask) +{ + immap_t *immr = (immap_t *)CONFIG_SYS_IMMR; + + gpio0_out &= ~mask; + out_be32(&immr->gpio[0].dat, gpio0_out); +} + int get_fpga_state(uint dev) { return gd->arch.fpga_state[dev]; diff --git a/board/gdsys/mpc8308/mpc8308.h b/board/gdsys/mpc8308/mpc8308.h index dc07d564eb..1e4f24fb2a 100644 --- a/board/gdsys/mpc8308/mpc8308.h +++ b/board/gdsys/mpc8308/mpc8308.h @@ -1,6 +1,9 @@ #ifndef __MPC8308_H_ #define __MPC8308_H_ +void setbits_gpio0_out(u32 mask); +void clrbits_gpio0_out(u32 mask); + /* functions to be provided by board implementation */ void mpc8308_init(void); void mpc8308_set_fpga_reset(unsigned state); diff --git a/board/gdsys/mpc8308/strider.c b/board/gdsys/mpc8308/strider.c index 898782a2e4..3ee5a4889d 100644 --- a/board/gdsys/mpc8308/strider.c +++ b/board/gdsys/mpc8308/strider.c @@ -346,7 +346,7 @@ void mpc8308_setup_hw(void) * set "startup-finished"-gpios */ setbits_be32(&immr->gpio[0].dir, BIT(31 - 11) | BIT(31 - 12)); - setbits_be32(&immr->gpio[0].dat, BIT(31 - 12)); + setbits_gpio0_out(BIT(31 - 12)); } int mpc8308_get_fpga_done(uint fpga) From patchwork Fri Sep 29 12:52:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819980 X-Patchwork-Delegate: wd@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 3y3Xvz0FLVz9t48 for ; Fri, 29 Sep 2017 23:48:46 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id BC063C21ECA; Fri, 29 Sep 2017 13:20:44 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 445EFC21EA5; Fri, 29 Sep 2017 13:11:09 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 1215DC21E18; Fri, 29 Sep 2017 12:55:10 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 3A728C21F2E for ; Fri, 29 Sep 2017 12:55:07 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxuos-00004w-H1; Fri, 29 Sep 2017 14:55:06 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:32 +0200 Message-Id: <20170929125238.26226-74-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 074/080] strider, hrcon: Reset CAT phy on CON2 module 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: Dirk Eibach The phy on the CON2 module needs a defined reset pulse of at least 10 ms to work reliably. Signed-off-by: Dirk Eibach Signed-off-by: Mario Six --- board/gdsys/mpc8308/hrcon.c | 30 ++++++++++++++++++++++++++++++ board/gdsys/mpc8308/strider.c | 24 ++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/board/gdsys/mpc8308/hrcon.c b/board/gdsys/mpc8308/hrcon.c index b3017de911..b03328278e 100644 --- a/board/gdsys/mpc8308/hrcon.c +++ b/board/gdsys/mpc8308/hrcon.c @@ -58,6 +58,26 @@ struct { u8 addr; } hrcon_fans[] = CONFIG_HRCON_FANS; +#ifdef CONFIG_HRCON_DH +struct { + u8 bus; + u8 addr; + u16 mask; +} rgmii2_reset[] = { { 0, 0x23, 0x0100}, + {10, 0x23, 0x0100}, + {11, 0x23, 0x0100}, + {12, 0x23, 0x0100} }; +#else +struct { + u8 bus; + u8 addr; + u16 mask; +} rgmii2_reset[] = { {0, 0x23, 0x0100}, + {6, 0x23, 0x0100}, + {7, 0x23, 0x0100}, + {8, 0x23, 0x0100} }; +#endif + int fpga_set_reg(u32 fpga, u16 *reg, off_t regoff, u16 data) { int res; @@ -160,6 +180,16 @@ int last_stage_init(void) MCFPGA_RESET_N); } + if (hw_type_cat && ch0_rgmii2_present) { + i2c_set_bus_num(rgmii2_reset[0].bus); + pca953x_set_val(rgmii2_reset[0].addr, rgmii2_reset[0].mask, 0); + pca953x_set_dir(rgmii2_reset[0].addr, rgmii2_reset[0].mask, 0); + mdelay(10); + pca953x_set_dir(rgmii2_reset[0].addr, rgmii2_reset[0].mask, + rgmii2_reset[0].mask); + i2c_set_bus_num(0); + } + if (hw_type_cat) { uint mux_ch; int retval; diff --git a/board/gdsys/mpc8308/strider.c b/board/gdsys/mpc8308/strider.c index 3ee5a4889d..c3f9c9a535 100644 --- a/board/gdsys/mpc8308/strider.c +++ b/board/gdsys/mpc8308/strider.c @@ -61,6 +61,17 @@ struct { u8 addr; } strider_fans[] = CONFIG_STRIDER_FANS; +#if defined(CONFIG_STRIDER_CON) || defined(CONFIG_STRIDER_CON_DP) +struct { + u8 bus; + u8 addr; + u16 mask; +} sgmii2_reset[] = { { 0, 0x23, 0x0100}, + {10, 0x23, 0x0100}, + {11, 0x23, 0x0100}, + {12, 0x23, 0x0100} }; +#endif + int fpga_set_reg(u32 fpga, u16 *reg, off_t regoff, u16 data) { int res; @@ -178,6 +189,18 @@ int last_stage_init(void) MCFPGA_RESET_N); } +#if defined(CONFIG_STRIDER_CON) || defined(CONFIG_STRIDER_CON_DP) + if (hw_type_cat && ch0_sgmii2_present) { + i2c_set_bus_num(sgmii2_reset[0].bus); + pca953x_set_val(sgmii2_reset[0].addr, sgmii2_reset[0].mask, 0); + pca953x_set_dir(sgmii2_reset[0].addr, sgmii2_reset[0].mask, 0); + mdelay(10); + pca953x_set_dir(sgmii2_reset[0].addr, sgmii2_reset[0].mask, + sgmii2_reset[0].mask); + i2c_set_bus_num(0); + } +#endif + if (hw_type_cat) { int retval; struct mii_dev *mdiodev = mdio_alloc(); @@ -261,6 +284,7 @@ int last_stage_init(void) ch7301_probe(k, false); dp501_probe(k, false); #endif + if (hw_type_cat) { int retval; struct mii_dev *mdiodev = mdio_alloc(); From patchwork Fri Sep 29 12:52:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819940 X-Patchwork-Delegate: wd@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 3y3XSk41qlz9t4g for ; Fri, 29 Sep 2017 23:28:38 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 560C4C21E4A; Fri, 29 Sep 2017 13:21: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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 E6732C21EFF; Fri, 29 Sep 2017 13:11:26 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 38AE1C21DD7; Fri, 29 Sep 2017 12:55:10 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 454A4C21DEF for ; Fri, 29 Sep 2017 12:55:07 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxuos-00004w-LG; Fri, 29 Sep 2017 14:55:06 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:33 +0200 Message-Id: <20170929125238.26226-75-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 075/080] gdsys:phy: Adapt fixup_88e1518() to latest Release Notes 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: Dirk Eibach The initialization sequence described in the latest Release Notes MV-S302033-00 for the Marvell 88E1518 phy omits two register writes. Use this new sequence for the setup of this phy. Signed-off-by: Dirk Eibach Signed-off-by: Mario Six --- board/gdsys/common/phy.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/board/gdsys/common/phy.c b/board/gdsys/common/phy.c index fb92658178..e45f923fed 100644 --- a/board/gdsys/common/phy.c +++ b/board/gdsys/common/phy.c @@ -46,8 +46,6 @@ struct mii_setupcmd fixup_88e1518[] = { { MIICMD_SET, 16, 0x214d }, { MIICMD_SET, 17, 0xcc0c }, { MIICMD_SET, 16, 0x2159 }, - { MIICMD_SET, 22, 0x00fb }, - { MIICMD_SET, 7, 0xc00d }, { MIICMD_SET, 22, 0x0000 }, }; From patchwork Fri Sep 29 12:52:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819989 X-Patchwork-Delegate: wd@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 3y3XxZ1YHmz9s7c for ; Fri, 29 Sep 2017 23:50:10 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id F40FEC21EB1; Fri, 29 Sep 2017 13:22:37 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 BCEA5C21E51; Fri, 29 Sep 2017 13:17:05 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C28C0C21E50; Fri, 29 Sep 2017 12:55:17 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id ACC90C21F2D for ; Fri, 29 Sep 2017 12:55:11 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxuow-00004w-Rw; Fri, 29 Sep 2017 14:55:10 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:34 +0200 Message-Id: <20170929125238.26226-76-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 076/080] phy: Fix style violations 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" Fix some style violations in the generic PHY management code. Signed-off-by: Mario Six --- drivers/net/phy/phy.c | 82 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 49 insertions(+), 33 deletions(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 5be51d73ce..0050a70075 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -27,7 +27,7 @@ DECLARE_GLOBAL_DATA_PTR; /* Generic PHY support and helper functions */ /** - * genphy_config_advert - sanitize and advertise auto-negotation parameters + * genphy_config_advert - sanitize and advertise auto-negotiation parameters * @phydev: target phy_device struct * * Description: Writes MII_ADVERTISE with the appropriate values, @@ -117,7 +117,6 @@ static int genphy_config_advert(struct phy_device *phydev) return changed; } - /** * genphy_setup_forced - configures/forces speed/duplex from @phydev * @phydev: target phy_device struct @@ -130,14 +129,15 @@ static int genphy_setup_forced(struct phy_device *phydev) int err; int ctl = BMCR_ANRESTART; - phydev->pause = phydev->asym_pause = 0; + phydev->pause = 0; + phydev->asym_pause = 0; - if (SPEED_1000 == phydev->speed) + if (phydev->speed == SPEED_1000) ctl |= BMCR_SPEED1000; - else if (SPEED_100 == phydev->speed) + else if (phydev->speed == SPEED_100) ctl |= BMCR_SPEED100; - if (DUPLEX_FULL == phydev->duplex) + if (phydev->duplex == DUPLEX_FULL) ctl |= BMCR_FULLDPLX; err = phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, ctl); @@ -145,7 +145,6 @@ static int genphy_setup_forced(struct phy_device *phydev) return err; } - /** * genphy_restart_aneg - Enable and Restart Autonegotiation * @phydev: target phy_device struct @@ -169,7 +168,6 @@ int genphy_restart_aneg(struct phy_device *phydev) return ctl; } - /** * genphy_config_aneg - restart auto-negotiation or write BMCR * @phydev: target phy_device struct @@ -182,7 +180,7 @@ int genphy_config_aneg(struct phy_device *phydev) { int result; - if (AUTONEG_ENABLE != phydev->autoneg) + if (phydev->autoneg != AUTONEG_ENABLE) return genphy_setup_forced(phydev); result = genphy_config_advert(phydev); @@ -192,7 +190,8 @@ int genphy_config_aneg(struct phy_device *phydev) if (result == 0) { /* Advertisment hasn't changed, but maybe aneg was never on to - * begin with? Or maybe phy was isolated? */ + * begin with? Or maybe phy was isolated? + */ int ctl = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR); if (ctl < 0) @@ -203,7 +202,8 @@ int genphy_config_aneg(struct phy_device *phydev) } /* Only restart aneg if we are advertising something different - * than we were before. */ + * than we were before. + */ if (result > 0) result = genphy_restart_aneg(phydev); @@ -240,7 +240,7 @@ int genphy_update_link(struct phy_device *phydev) int i = 0; printf("%s Waiting for PHY auto negotiation to complete", - phydev->dev->name); + phydev->dev->name); while (!(mii_reg & BMSR_ANEGCOMPLETE)) { /* * Timeout reached ? @@ -305,7 +305,8 @@ int genphy_parse_link(struct phy_device *phydev) */ gblpa = phy_read(phydev, MDIO_DEVAD_NONE, MII_STAT1000); if (gblpa < 0) { - debug("Could not read MII_STAT1000. Ignoring gigabit capability\n"); + debug("Could not read MII_STAT1000. "); + debug("Ignoring gigabit capability\n"); gblpa = 0; } gblpa &= phy_read(phydev, @@ -338,8 +339,9 @@ int genphy_parse_link(struct phy_device *phydev) if (lpa & LPA_100FULL) phydev->duplex = DUPLEX_FULL; - } else if (lpa & LPA_10FULL) + } else if (lpa & LPA_10FULL) { phydev->duplex = DUPLEX_FULL; + } /* * Extended status may indicate that the PHY supports @@ -574,7 +576,9 @@ static int phy_probe(struct phy_device *phydev) { int err = 0; - phydev->advertising = phydev->supported = phydev->drv->features; + phydev->advertising = phydev->drv->features; + phydev->supported = phydev->drv->features; + phydev->mmds = phydev->drv->mmds; if (phydev->drv->probe) @@ -594,7 +598,7 @@ static struct phy_driver *generic_for_interface(phy_interface_t interface) } static struct phy_driver *get_phy_driver(struct phy_device *phydev, - phy_interface_t interface) + phy_interface_t interface) { struct list_head *entry; int phy_id = phydev->phy_id; @@ -617,11 +621,12 @@ static struct phy_device *phy_device_create(struct mii_dev *bus, int addr, struct phy_device *dev; /* We allocate the device, and initialize the - * default values */ + * default values + */ dev = malloc(sizeof(*dev)); if (!dev) { printf("Failed to allocate PHY device for %s:%d\n", - bus->name, addr); + bus->name, addr); return NULL; } @@ -660,7 +665,8 @@ int __weak get_phy_id(struct mii_dev *bus, int addr, int devad, u32 *phy_id) int phy_reg; /* Grab the bits from PHYIR1, and put them - * in the upper half */ + * in the upper half + */ phy_reg = bus->read(bus, addr, devad, MII_PHYSID1); if (phy_reg < 0) @@ -680,9 +686,11 @@ int __weak get_phy_id(struct mii_dev *bus, int addr, int devad, u32 *phy_id) } static struct phy_device *create_phy_by_mask(struct mii_dev *bus, - unsigned phy_mask, int devad, phy_interface_t interface) + uint phy_mask, int devad, + phy_interface_t interface) { u32 phy_id = 0xffffffff; + while (phy_mask) { int addr = ffs(phy_mask) - 1; int r = get_phy_id(bus, addr, devad, &phy_id); @@ -695,11 +703,13 @@ static struct phy_device *create_phy_by_mask(struct mii_dev *bus, } static struct phy_device *search_for_existing_phy(struct mii_dev *bus, - unsigned phy_mask, phy_interface_t interface) + uint phy_mask, + phy_interface_t interface) { /* If we have one, return the existing device, with new interface */ while (phy_mask) { int addr = ffs(phy_mask) - 1; + if (bus->phymap[addr]) { bus->phymap[addr]->interface = interface; return bus->phymap[addr]; @@ -710,7 +720,8 @@ static struct phy_device *search_for_existing_phy(struct mii_dev *bus, } static struct phy_device *get_phy_device_by_mask(struct mii_dev *bus, - unsigned phy_mask, phy_interface_t interface) + uint phy_mask, + phy_interface_t interface) { int i; struct phy_device *phydev; @@ -722,7 +733,7 @@ static struct phy_device *get_phy_device_by_mask(struct mii_dev *bus, /* Otherwise we have to try Clause 45 */ for (i = 0; i < 5; i++) { phydev = create_phy_by_mask(bus, phy_mask, - i ? i : MDIO_DEVAD_NONE, interface); + i ? i : MDIO_DEVAD_NONE, interface); if (IS_ERR(phydev)) return NULL; if (phydev) @@ -732,6 +743,7 @@ static struct phy_device *get_phy_device_by_mask(struct mii_dev *bus, debug("\n%s PHY: ", bus->name); while (phy_mask) { int addr = ffs(phy_mask) - 1; + debug("%d ", addr); phy_mask &= ~(1 << addr); } @@ -741,7 +753,8 @@ static struct phy_device *get_phy_device_by_mask(struct mii_dev *bus, } /** - * get_phy_device - reads the specified PHY device and returns its @phy_device struct + * get_phy_device - reads the specified PHY device and returns its + * @phy_device struct * @bus: the target MII bus * @addr: PHY address on the MII bus * @@ -820,15 +833,15 @@ int miiphy_reset(const char *devname, unsigned char addr) return phy_reset(phydev); } -struct phy_device *phy_find_by_mask(struct mii_dev *bus, unsigned phy_mask, - phy_interface_t interface) +struct phy_device *phy_find_by_mask(struct mii_dev *bus, uint phy_mask, + phy_interface_t interface) { /* Reset the bus */ if (bus->reset) { bus->reset(bus); /* Wait 15ms to make sure the PHY has come out of hard reset */ - udelay(15000); + mdelay(15); } return get_phy_device_by_mask(bus, phy_mask, interface); @@ -844,8 +857,8 @@ void phy_connect_dev(struct phy_device *phydev, struct eth_device *dev) phy_reset(phydev); if (phydev->dev && phydev->dev != dev) { printf("%s:%d is connected to %s. Reconnecting to %s\n", - phydev->bus->name, phydev->addr, - phydev->dev->name, dev->name); + phydev->bus->name, phydev->addr, + phydev->dev->name, dev->name); } phydev->dev = dev; debug("%s connected to %s\n", dev->name, phydev->drv->name); @@ -853,20 +866,23 @@ void phy_connect_dev(struct phy_device *phydev, struct eth_device *dev) #ifdef CONFIG_DM_ETH struct phy_device *phy_connect(struct mii_dev *bus, int addr, - struct udevice *dev, phy_interface_t interface) + struct udevice *dev, + phy_interface_t interface) #else struct phy_device *phy_connect(struct mii_dev *bus, int addr, - struct eth_device *dev, phy_interface_t interface) + struct eth_device *dev, + phy_interface_t interface) #endif { struct phy_device *phydev = NULL; #ifdef CONFIG_PHY_FIXED int sn; const char *name; + sn = fdt_first_subnode(gd->fdt_blob, dev_of_offset(dev)); while (sn > 0) { name = fdt_get_name(gd->fdt_blob, sn, NULL); - if (name != NULL && strcmp(name, "fixed-link") == 0) { + if (name && strcmp(name, "fixed-link") == 0) { phydev = phy_device_create(bus, sn, PHY_FIXED_ID, interface); break; @@ -874,7 +890,7 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr, sn = fdt_next_subnode(gd->fdt_blob, sn); } #endif - if (phydev == NULL) + if (!phydev) phydev = phy_find_by_mask(bus, 1 << addr, interface); if (phydev) From patchwork Fri Sep 29 12:52:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819986 X-Patchwork-Delegate: wd@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 3y3Xws6l5rz9ryv for ; Fri, 29 Sep 2017 23:49:33 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 8CBADC21ED6; Fri, 29 Sep 2017 13:15: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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 9C30FC21E92; Fri, 29 Sep 2017 13:02:29 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B32BBC21E92; Fri, 29 Sep 2017 12:55:17 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id A2B8FC21DE4 for ; Fri, 29 Sep 2017 12:55:11 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxuox-00004w-2O; Fri, 29 Sep 2017 14:55:11 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:35 +0200 Message-Id: <20170929125238.26226-77-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 077/080] i2c: ihs_i2c: Prepare DM conversion 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" Prepare the function interface of the ihs_i2c driver for DM conversion in a future patch. While we're at it, fix some style violations, and make the code more readable. Signed-off-by: Mario Six --- drivers/i2c/ihs_i2c.c | 69 +++++++++++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 29 deletions(-) diff --git a/drivers/i2c/ihs_i2c.c b/drivers/i2c/ihs_i2c.c index 29612e69fe..6fd016339c 100644 --- a/drivers/i2c/ihs_i2c.c +++ b/drivers/i2c/ihs_i2c.c @@ -11,6 +11,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -41,30 +42,38 @@ DECLARE_GLOBAL_DATA_PTR; #endif enum { - I2CINT_ERROR_EV = 1 << 13, - I2CINT_TRANSMIT_EV = 1 << 14, - I2CINT_RECEIVE_EV = 1 << 15, + I2CINT_ERROR_EV = BIT(13), + I2CINT_TRANSMIT_EV = BIT(14), + I2CINT_RECEIVE_EV = BIT(15), }; enum { + I2CMB_READ = 0 << 10, I2CMB_WRITE = 1 << 10, + I2CMB_1BYTE = 0 << 11, I2CMB_2BYTE = 1 << 11, + I2CMB_DONT_HOLD_BUS = 0 << 13, I2CMB_HOLD_BUS = 1 << 13, I2CMB_NATIVE = 2 << 14, }; +enum { + I2COP_WRITE = 0, + I2COP_READ = 1, +}; + static int wait_for_int(bool read) { u16 val; - unsigned int ctr = 0; + uint ctr = 0; I2C_GET_REG(interrupt_status, &val); + /* Wait until error or receive/transmit interrupt was raised */ while (!(val & (I2CINT_ERROR_EV | (read ? I2CINT_RECEIVE_EV : I2CINT_TRANSMIT_EV)))) { udelay(10); - if (ctr++ > 5000) { + if (ctr++ > 5000) return 1; - } I2C_GET_REG(interrupt_status, &val); } @@ -76,10 +85,12 @@ static int ihs_i2c_transfer(uchar chip, uchar *buffer, int len, bool read, { u16 val; + /* Clear interrupt status */ I2C_SET_REG(interrupt_status, I2CINT_ERROR_EV | I2CINT_RECEIVE_EV | I2CINT_TRANSMIT_EV); I2C_GET_REG(interrupt_status, &val); + /* If we want to write and have data, write the bytes to the mailbox */ if (!read && len) { val = buffer[0]; @@ -98,6 +109,7 @@ static int ihs_i2c_transfer(uchar chip, uchar *buffer, int len, bool read, if (wait_for_int(read)) return 1; + /* If we want to read, get the bytes from the mailbox */ if (read) { I2C_GET_REG(read_mailbox_ext, &val); buffer[0] = val & 0xff; @@ -108,55 +120,44 @@ static int ihs_i2c_transfer(uchar chip, uchar *buffer, int len, bool read, return 0; } -static int ihs_i2c_address(uchar chip, uint addr, int alen, bool hold_bus) +static int ihs_i2c_address(uchar chip, u8 *addr, int alen, bool hold_bus) { - int shift = (alen-1) * 8; - while (alen) { int transfer = min(alen, 2); - uchar buf[2]; bool is_last = alen <= transfer; - buf[0] = addr >> shift; - if (alen > 1) - buf[1] = addr >> (shift - 8); - - if (ihs_i2c_transfer(chip, buf, transfer, false, + if (ihs_i2c_transfer(chip, addr, transfer, I2COP_WRITE, hold_bus ? false : is_last)) return 1; - shift -= 16; alen -= transfer; } return 0; } -static int ihs_i2c_access(struct i2c_adapter *adap, uchar chip, uint addr, - int alen, uchar *buffer, int len, bool read) +static int ihs_i2c_access(struct i2c_adapter *adap, uchar chip, u8 *addr, + int alen, uchar *buffer, int len, int read) { - if (len <= 0) - return 1; - - if (ihs_i2c_address(chip, addr, alen, len)) + /* Don't hold the bus if length of data to send/receive is zero */ + if (len <= 0 || ihs_i2c_address(chip, addr, alen, len)) return 1; while (len) { int transfer = min(len, 2); + bool is_last = len <= transfer; if (ihs_i2c_transfer(chip, buffer, transfer, read, - len <= transfer)) - return 1; + is_last)) + return 2; buffer += transfer; - addr += transfer; len -= transfer; } return 0; } - static void ihs_i2c_init(struct i2c_adapter *adap, int speed, int slaveaddr) { #ifdef CONFIG_SYS_I2C_INIT_BOARD @@ -173,7 +174,7 @@ static int ihs_i2c_probe(struct i2c_adapter *adap, uchar chip) { uchar buffer[2]; - if (ihs_i2c_transfer(chip, buffer, 0, true, true)) + if (ihs_i2c_transfer(chip, buffer, 0, I2COP_READ, true)) return 1; return 0; @@ -182,13 +183,23 @@ static int ihs_i2c_probe(struct i2c_adapter *adap, uchar chip) static int ihs_i2c_read(struct i2c_adapter *adap, uchar chip, uint addr, int alen, uchar *buffer, int len) { - return ihs_i2c_access(adap, chip, addr, alen, buffer, len, true); + u8 addr_bytes[4]; + + put_unaligned_le32(addr, addr_bytes); + + return ihs_i2c_access(adap, chip, addr_bytes, alen, buffer, len, + I2COP_READ); } static int ihs_i2c_write(struct i2c_adapter *adap, uchar chip, uint addr, int alen, uchar *buffer, int len) { - return ihs_i2c_access(adap, chip, addr, alen, buffer, len, false); + u8 addr_bytes[4]; + + put_unaligned_le32(addr, addr_bytes); + + return ihs_i2c_access(adap, chip, addr_bytes, alen, buffer, len, + I2COP_WRITE); } static unsigned int ihs_i2c_set_bus_speed(struct i2c_adapter *adap, From patchwork Fri Sep 29 12:52:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819937 X-Patchwork-Delegate: wd@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 3y3XR20QMmz9t3s for ; Fri, 29 Sep 2017 23:27:10 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id C77AFC21E26; Fri, 29 Sep 2017 13:21: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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 5E34BC21EEE; Fri, 29 Sep 2017 13:11:10 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 43BE4C21DDE; Fri, 29 Sep 2017 12:55:23 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 132A7C21E6C for ; Fri, 29 Sep 2017 12:55:16 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxup1-00004w-7D; Fri, 29 Sep 2017 14:55:15 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:36 +0200 Message-Id: <20170929125238.26226-78-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 078/080] i2c: ihs_i2c: Make DM compatible 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" Make the ihs_i2c driver DM-compatible; for legacy boards, the old functions are retained within #ifdefs. No board uses the new DM driver yet; this patch only lays the foundation for future support. Signed-off-by: Mario Six --- drivers/i2c/ihs_i2c.c | 201 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 198 insertions(+), 3 deletions(-) -- 2.11.0 diff --git a/drivers/i2c/ihs_i2c.c b/drivers/i2c/ihs_i2c.c index 6fd016339c..c3fddb55f9 100644 --- a/drivers/i2c/ihs_i2c.c +++ b/drivers/i2c/ihs_i2c.c @@ -3,19 +3,39 @@ * Dirk Eibach, Guntermann & Drunck GmbH, eibach@gdsys.de * * SPDX-License-Identifier: GPL-2.0+ - * - * NOTE: This driver should be converted to driver model before June 2017. - * Please see doc/driver-model/i2c-howto.txt for instructions. */ #include #include +#ifdef CONFIG_DM_I2C +#include +#include +#include "../misc/gdsys_soc.h" +#else #include +#endif #include +#ifdef CONFIG_DM_I2C +struct ihs_i2c_priv { + uint speed; + phys_addr_t addr; +}; + +enum { + REG_INTERRUPT_STATUS = 0x00, + REG_INTERRUPT_ENABLE_CONTROL = 0x02, + REG_WRITE_MAILBOX_EXT = 0x04, + REG_WRITE_MAILBOX = 0x06, + REG_READ_MAILBOX_EXT = 0x08, + REG_READ_MAILBOX = 0x0A, +}; + +#else /* !CONFIG_DM_I2C */ DECLARE_GLOBAL_DATA_PTR; #ifdef CONFIG_SYS_I2C_IHS_DUAL + #define I2C_SET_REG(fld, val) \ do { \ if (I2C_ADAP_HWNR & 0x10) \ @@ -40,6 +60,7 @@ DECLARE_GLOBAL_DATA_PTR; #define I2C_GET_REG(fld, val) \ FPGA_GET_REG(I2C_ADAP_HWNR, i2c0.fld, val) #endif +#endif /* CONFIG_DM_I2C */ enum { I2CINT_ERROR_EV = BIT(13), @@ -62,33 +83,71 @@ enum { I2COP_READ = 1, }; +#ifdef CONFIG_DM_I2C +static int wait_for_int(struct udevice *dev, int read) +#else static int wait_for_int(bool read) +#endif { u16 val; uint ctr = 0; +#ifdef CONFIG_DM_I2C + struct ihs_i2c_priv *priv = dev_get_priv(dev); + struct udevice *fpga; + gdsys_soc_get_fpga(dev, &fpga); +#endif + +#ifdef CONFIG_DM_I2C + val = fpga_in_le16(fpga, + priv->addr + REG_INTERRUPT_STATUS); +#else I2C_GET_REG(interrupt_status, &val); +#endif /* Wait until error or receive/transmit interrupt was raised */ while (!(val & (I2CINT_ERROR_EV | (read ? I2CINT_RECEIVE_EV : I2CINT_TRANSMIT_EV)))) { udelay(10); if (ctr++ > 5000) return 1; +#ifdef CONFIG_DM_I2C + val = fpga_in_le16(fpga, + priv->addr + REG_INTERRUPT_STATUS); +#else I2C_GET_REG(interrupt_status, &val); +#endif } return (val & I2CINT_ERROR_EV) ? 1 : 0; } +#ifdef CONFIG_DM_I2C +static int ihs_i2c_transfer(struct udevice *dev, uchar chip, + uchar *buffer, int len, int read, bool is_last) +#else static int ihs_i2c_transfer(uchar chip, uchar *buffer, int len, bool read, bool is_last) +#endif { u16 val; +#ifdef CONFIG_DM_I2C + struct ihs_i2c_priv *priv = dev_get_priv(dev); + struct udevice *fpga; + + gdsys_soc_get_fpga(dev, &fpga); +#endif /* Clear interrupt status */ +#ifdef CONFIG_DM_I2C + fpga_out_le16(fpga, priv->addr + REG_INTERRUPT_STATUS, + I2CINT_ERROR_EV | I2CINT_RECEIVE_EV | I2CINT_TRANSMIT_EV); + val = fpga_in_le16(fpga, + priv->addr + REG_INTERRUPT_STATUS); +#else I2C_SET_REG(interrupt_status, I2CINT_ERROR_EV | I2CINT_RECEIVE_EV | I2CINT_TRANSMIT_EV); I2C_GET_REG(interrupt_status, &val); +#endif /* If we want to write and have data, write the bytes to the mailbox */ if (!read && len) { @@ -96,22 +155,45 @@ static int ihs_i2c_transfer(uchar chip, uchar *buffer, int len, bool read, if (len > 1) val |= buffer[1] << 8; +#ifdef CONFIG_DM_I2C + fpga_out_le16(fpga, + priv->addr + REG_WRITE_MAILBOX_EXT, val); +#else I2C_SET_REG(write_mailbox_ext, val); +#endif } +#ifdef CONFIG_DM_I2C + fpga_out_le16(fpga, priv->addr + REG_WRITE_MAILBOX, + I2CMB_NATIVE + | (read ? I2CMB_READ : I2CMB_WRITE) + | (chip << 1) + | ((len > 1) ? I2CMB_2BYTE : I2CMB_1BYTE) + | (!is_last ? I2CMB_HOLD_BUS : I2CMB_DONT_HOLD_BUS)); +#else I2C_SET_REG(write_mailbox, I2CMB_NATIVE | (read ? 0 : I2CMB_WRITE) | (chip << 1) | ((len > 1) ? I2CMB_2BYTE : 0) | (is_last ? 0 : I2CMB_HOLD_BUS)); +#endif +#ifdef CONFIG_DM_I2C + if (wait_for_int(dev, read)) +#else if (wait_for_int(read)) +#endif return 1; /* If we want to read, get the bytes from the mailbox */ if (read) { +#ifdef CONFIG_DM_I2C + val = fpga_in_le16(fpga, + priv->addr + REG_READ_MAILBOX_EXT); +#else I2C_GET_REG(read_mailbox_ext, &val); +#endif buffer[0] = val & 0xff; if (len > 1) buffer[1] = val >> 8; @@ -120,15 +202,25 @@ static int ihs_i2c_transfer(uchar chip, uchar *buffer, int len, bool read, return 0; } +#ifdef CONFIG_DM_I2C +static int ihs_i2c_address(struct udevice *dev, uchar chip, u8 *addr, int alen, bool hold_bus) +#else static int ihs_i2c_address(uchar chip, u8 *addr, int alen, bool hold_bus) +#endif { while (alen) { int transfer = min(alen, 2); bool is_last = alen <= transfer; +#ifdef CONFIG_DM_I2C + if (ihs_i2c_transfer(dev, chip, addr, transfer, I2COP_WRITE, + hold_bus ? false : is_last)) + return 1; +#else if (ihs_i2c_transfer(chip, addr, transfer, I2COP_WRITE, hold_bus ? false : is_last)) return 1; +#endif alen -= transfer; } @@ -136,20 +228,36 @@ static int ihs_i2c_address(uchar chip, u8 *addr, int alen, bool hold_bus) return 0; } +#ifdef CONFIG_DM_I2C +static int ihs_i2c_access(struct udevice *dev, uchar chip, u8 *addr, + int alen, uchar *buffer, int len, int read) +#else static int ihs_i2c_access(struct i2c_adapter *adap, uchar chip, u8 *addr, int alen, uchar *buffer, int len, int read) +#endif { /* Don't hold the bus if length of data to send/receive is zero */ +#ifdef CONFIG_DM_I2C + if (len <= 0 || ihs_i2c_address(dev, chip, addr, alen, len)) + return 1; +#else if (len <= 0 || ihs_i2c_address(chip, addr, alen, len)) return 1; +#endif while (len) { int transfer = min(len, 2); bool is_last = len <= transfer; +#ifdef CONFIG_DM_I2C + if (ihs_i2c_transfer(dev, chip, buffer, transfer, read, + is_last)) + return 2; +#else if (ihs_i2c_transfer(chip, buffer, transfer, read, is_last)) return 2; +#endif buffer += transfer; len -= transfer; @@ -158,6 +266,92 @@ static int ihs_i2c_access(struct i2c_adapter *adap, uchar chip, u8 *addr, return 0; } +#ifdef CONFIG_DM_I2C + +int ihs_i2c_probe(struct udevice *bus) +{ + struct ihs_i2c_priv *priv = dev_get_priv(bus); + int addr; + + addr = dev_read_u32_default(bus, "reg", -1); + + priv->addr = addr; + + return 0; +} + +static int ihs_i2c_set_bus_speed(struct udevice *bus, uint speed) +{ + struct ihs_i2c_priv *priv = dev_get_priv(bus); + + if (speed != priv->speed && priv->speed != 0) + return 1; + + priv->speed = speed; + + return 0; +} + +static int ihs_i2c_xfer(struct udevice *bus, struct i2c_msg *msg, int nmsgs) +{ + struct i2c_msg *dmsg, *omsg, dummy; + + memset(&dummy, 0, sizeof(struct i2c_msg)); + + /* We expect either two messages (one with an offset and one with the + * actucal data) or one message (just data) + */ + if (nmsgs > 2 || nmsgs == 0) { + debug("%s: Only one or two messages are supported.", __func__); + return -1; + } + + omsg = nmsgs == 1 ? &dummy : msg; + dmsg = nmsgs == 1 ? msg : msg + 1; + + if (dmsg->flags & I2C_M_RD) + return ihs_i2c_access(bus, dmsg->addr, omsg->buf, + omsg->len, dmsg->buf, dmsg->len, + I2COP_READ); + else + return ihs_i2c_access(bus, dmsg->addr, omsg->buf, + omsg->len, dmsg->buf, dmsg->len, + I2COP_WRITE); +} + +static int ihs_i2c_probe_chip(struct udevice *bus, u32 chip_addr, + u32 chip_flags) +{ + uchar buffer[2]; + + if (ihs_i2c_transfer(bus, chip_addr, buffer, 0, I2COP_READ, true)) + return 1; + + return 0; +} + +static const struct dm_i2c_ops ihs_i2c_ops = { + .xfer = ihs_i2c_xfer, + .probe_chip = ihs_i2c_probe_chip, + .set_bus_speed = ihs_i2c_set_bus_speed, +}; + +static const struct udevice_id ihs_i2c_ids[] = { + { .compatible = "gdsys,ihs_i2cmaster", }, + { /* sentinel */ } +}; + +U_BOOT_DRIVER(i2c_ihs) = { + .name = "i2c_ihs", + .id = UCLASS_I2C, + .of_match = ihs_i2c_ids, + .probe = ihs_i2c_probe, + .priv_auto_alloc_size = sizeof(struct ihs_i2c_priv), + .ops = &ihs_i2c_ops, +}; + +#else /* CONFIG_DM_I2C */ + static void ihs_i2c_init(struct i2c_adapter *adap, int speed, int slaveaddr) { #ifdef CONFIG_SYS_I2C_INIT_BOARD @@ -269,3 +463,4 @@ U_BOOT_I2C_ADAP_COMPLETE(ihs3_1, ihs_i2c_init, ihs_i2c_probe, CONFIG_SYS_I2C_IHS_SLAVE_3_1, 19) #endif #endif +#endif /* CONFIG_DM_I2C */ From patchwork Fri Sep 29 12:52:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819983 X-Patchwork-Delegate: wd@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 3y3XwV0MnWz9t4g for ; Fri, 29 Sep 2017 23:49:14 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id B4109C21E73; Fri, 29 Sep 2017 13:17:21 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 D6355C21EEF; Fri, 29 Sep 2017 13:07:12 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id ACFB9C21E3A; Fri, 29 Sep 2017 12:55:27 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id E8406C21F1D for ; Fri, 29 Sep 2017 12:55:19 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxup5-00004w-Bi; Fri, 29 Sep 2017 14:55:19 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:37 +0200 Message-Id: <20170929125238.26226-79-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 079/080] i2c: ihs_i2c: Factor out send_buffer method 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" Simplify the driver logic by extracting a common send_buffer method. Signed-off-by: Mario Six --- drivers/i2c/ihs_i2c.c | 50 ++++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/drivers/i2c/ihs_i2c.c b/drivers/i2c/ihs_i2c.c index c3fddb55f9..0432ca0994 100644 --- a/drivers/i2c/ihs_i2c.c +++ b/drivers/i2c/ihs_i2c.c @@ -203,32 +203,48 @@ static int ihs_i2c_transfer(uchar chip, uchar *buffer, int len, bool read, } #ifdef CONFIG_DM_I2C -static int ihs_i2c_address(struct udevice *dev, uchar chip, u8 *addr, int alen, bool hold_bus) +static int ihs_i2c_send_buffer(struct udevice *dev, uchar chip, u8 *data, int len, bool hold_bus, int read) #else -static int ihs_i2c_address(uchar chip, u8 *addr, int alen, bool hold_bus) +static int ihs_i2c_send_buffer(uchar chip, u8 *data, int len, bool hold_bus, + int read) #endif { - while (alen) { - int transfer = min(alen, 2); - bool is_last = alen <= transfer; + while (len) { + int transfer = min(len, 2); + bool is_last = len <= transfer; #ifdef CONFIG_DM_I2C - if (ihs_i2c_transfer(dev, chip, addr, transfer, I2COP_WRITE, + if (ihs_i2c_transfer(dev, chip, data, transfer, read, hold_bus ? false : is_last)) return 1; #else - if (ihs_i2c_transfer(chip, addr, transfer, I2COP_WRITE, + if (ihs_i2c_transfer(chip, data, transfer, read, hold_bus ? false : is_last)) return 1; #endif - alen -= transfer; + data += transfer; + len -= transfer; } return 0; } #ifdef CONFIG_DM_I2C +static int ihs_i2c_address(struct udevice *dev, uchar chip, u8 *addr, int alen, + bool hold_bus) +#else +static int ihs_i2c_address(uchar chip, u8 *addr, int alen, bool hold_bus) +#endif +{ +#ifdef CONFIG_DM_I2C + return ihs_i2c_send_buffer(dev, chip, addr, alen, hold_bus, I2COP_WRITE); +#else + return ihs_i2c_send_buffer(chip, addr, alen, hold_bus, I2COP_WRITE); +#endif +} + +#ifdef CONFIG_DM_I2C static int ihs_i2c_access(struct udevice *dev, uchar chip, u8 *addr, int alen, uchar *buffer, int len, int read) #else @@ -245,25 +261,11 @@ static int ihs_i2c_access(struct i2c_adapter *adap, uchar chip, u8 *addr, return 1; #endif - while (len) { - int transfer = min(len, 2); - bool is_last = len <= transfer; - #ifdef CONFIG_DM_I2C - if (ihs_i2c_transfer(dev, chip, buffer, transfer, read, - is_last)) - return 2; + return ihs_i2c_send_buffer(dev, chip, buffer, len, false, read); #else - if (ihs_i2c_transfer(chip, buffer, transfer, read, - is_last)) - return 2; + return ihs_i2c_send_buffer(chip, buffer, len, false, read); #endif - - buffer += transfer; - len -= transfer; - } - - return 0; } #ifdef CONFIG_DM_I2C From patchwork Fri Sep 29 12:52:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 819951 X-Patchwork-Delegate: wd@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 3y3XXy65l3z9rxj for ; Fri, 29 Sep 2017 23:32:18 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 69F01C21E8A; Fri, 29 Sep 2017 13:13:09 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS 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 75C3BC21F50; Fri, 29 Sep 2017 12:58:48 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5B4F6C21E6F; Fri, 29 Sep 2017 12:55:27 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.18.28]) by lists.denx.de (Postfix) with ESMTPS id 2CFE8C21DEF for ; Fri, 29 Sep 2017 12:55:20 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1dxup5-00004w-Fv; Fri, 29 Sep 2017 14:55:19 +0200 From: Mario Six To: U-Boot Mailing List , Ilya Yanok , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Fri, 29 Sep 2017 14:52:38 +0200 Message-Id: <20170929125238.26226-80-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170929125238.26226-1-mario.six@gdsys.cc> References: <20170929125238.26226-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH 080/080] clk: Makefile: Sort entries alphabetically 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 Makefile entries in the clk driver directory were not alphabetically sorted. Correct this. Signed-off-by: Mario Six Reviewed-by: Simon Glass --- drivers/clk/Makefile | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) -- 2.11.0 diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index 83fe88ce9f..bb22416fb5 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -6,20 +6,20 @@ # obj-$(CONFIG_$(SPL_TPL_)CLK) += clk-uclass.o clk_fixed_rate.o -obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/ -obj-$(CONFIG_SANDBOX) += clk_sandbox.o -obj-$(CONFIG_SANDBOX) += clk_sandbox_test.o -obj-$(CONFIG_MACH_PIC32) += clk_pic32.o -obj-$(CONFIG_CLK_RENESAS) += renesas/ -obj-$(CONFIG_CLK_ZYNQ) += clk_zynq.o -obj-$(CONFIG_CLK_ZYNQMP) += clk_zynqmp.o obj-y += tegra/ -obj-$(CONFIG_CLK_UNIPHIER) += uniphier/ -obj-$(CONFIG_CLK_EXYNOS) += exynos/ +obj-$(CONFIG_ARCH_ASPEED) += aspeed/ +obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/ obj-$(CONFIG_CLK_AT91) += at91/ obj-$(CONFIG_CLK_BCM6345) += clk_bcm6345.o obj-$(CONFIG_CLK_BOSTON) += clk_boston.o -obj-$(CONFIG_ARCH_ASPEED) += aspeed/ +obj-$(CONFIG_CLK_EXYNOS) += exynos/ +obj-$(CONFIG_CLK_RENESAS) += renesas/ +obj-$(CONFIG_CLK_UNIPHIER) += uniphier/ +obj-$(CONFIG_CLK_ZYNQ) += clk_zynq.o +obj-$(CONFIG_CLK_ZYNQMP) += clk_zynqmp.o +obj-$(CONFIG_MACH_PIC32) += clk_pic32.o +obj-$(CONFIG_SANDBOX) += clk_sandbox.o +obj-$(CONFIG_SANDBOX) += clk_sandbox_test.o obj-$(CONFIG_STM32F7) += clk_stm32f7.o obj-$(CONFIG_STM32H7) += clk_stm32h7.o