From patchwork Wed Dec 13 07:18: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: 847810 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxSwK2rBJz9sCZ for ; Wed, 13 Dec 2017 18:28:17 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id D6705C21DD9; Wed, 13 Dec 2017 07: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=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 D4798C21DA1; Wed, 13 Dec 2017 07:21:02 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 40E9EC21DA1; Wed, 13 Dec 2017 07:20:55 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 6EF88C21DA3 for ; Wed, 13 Dec 2017 07:20:55 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1LZ-00073A-VO; Wed, 13 Dec 2017 08:20:54 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:29 +0100 Message-Id: <20171213071946.6181-1-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 01/78] 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 --- v1 -> v2: None --- board/freescale/mpc8308rdb/sdram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.13.6 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 Wed Dec 13 07:18: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: 847812 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxT0h0j89z9sCZ for ; Wed, 13 Dec 2017 18:32:04 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 0184CC21DBA; Wed, 13 Dec 2017 07:23: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=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 25FB5C21E31; Wed, 13 Dec 2017 07:21:06 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id AC61EC21D9F; Wed, 13 Dec 2017 07:20:56 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id BCB4FC21DB1 for ; Wed, 13 Dec 2017 07:20:55 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1La-00073A-5L; Wed, 13 Dec 2017 08:20:54 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:30 +0100 Message-Id: <20171213071946.6181-2-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 02/78] 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 --- v1 -> v2: * Fix compilation error (resulting from broken commit split) --- arch/powerpc/cpu/mpc83xx/spd_sdram.c | 142 +++++++++++++++++------------------ 1 file changed, 71 insertions(+), 71 deletions(-) -- 2.13.6 diff --git a/arch/powerpc/cpu/mpc83xx/spd_sdram.c b/arch/powerpc/cpu/mpc83xx/spd_sdram.c index 21ab0153fc..d945ab7ee4 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; } @@ -218,52 +219,52 @@ long int spd_sdram() /* 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] = (1 << 31 | (odt_rd_cfg << 20) | (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)); + ddr->cs_config[1] = (1 << 31 | (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 ddr->csbnds[2].csbnds = (banksize(spd.row_dens) >> 24) - 1; - ddr->cs_config[2] = ( 1 << 31 + ddr->cs_config[2] = (1 << 31 | (odt_rd_cfg << 20) | (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)); + ddr->cs_config[3] = (1 << 31 | (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 Wed Dec 13 07:18: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: 847808 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxStx0Ykkz9s74 for ; Wed, 13 Dec 2017 18:27:05 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 010D8C21E16; Wed, 13 Dec 2017 07:23:38 +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=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 3DFD3C21DD9; Wed, 13 Dec 2017 07:21:05 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 8454EC21DA1; Wed, 13 Dec 2017 07:20:56 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 9212DC21DA9 for ; Wed, 13 Dec 2017 07:20:55 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1La-00073A-At; Wed, 13 Dec 2017 08:20:54 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:31 +0100 Message-Id: <20171213071946.6181-3-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 03/78] 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 --- v1 -> v2: None --- arch/powerpc/cpu/mpc83xx/spd_sdram.c | 49 ++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 27 deletions(-) -- 2.13.6 diff --git a/arch/powerpc/cpu/mpc83xx/spd_sdram.c b/arch/powerpc/cpu/mpc83xx/spd_sdram.c index d945ab7ee4..aa77d9bb7a 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) @@ -232,7 +229,7 @@ long int spd_sdram() 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->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) @@ -257,7 +254,7 @@ long int spd_sdram() 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->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 Wed Dec 13 07:18: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: 847799 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxSm40NVgz9s74 for ; Wed, 13 Dec 2017 18:21:06 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 23B56C21DFA; Wed, 13 Dec 2017 07:21: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=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 F2A1EC21DB1; Wed, 13 Dec 2017 07:20:57 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BED7CC21DB2; Wed, 13 Dec 2017 07:20:55 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 5ED5AC21D9F for ; Wed, 13 Dec 2017 07:20:55 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1La-00073A-Fs; Wed, 13 Dec 2017 08:20:54 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:32 +0100 Message-Id: <20171213071946.6181-4-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 04/78] 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 --- v1 -> v2: None --- include/dm/read.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.13.6 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 Wed Dec 13 07:18: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: 847817 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxT311Gzjz9s7B for ; Wed, 13 Dec 2017 18:34:05 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id BAF94C21DBB; Wed, 13 Dec 2017 07:24:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=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 1324CC21DA6; Wed, 13 Dec 2017 07:21:07 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D5B80C21DAA; Wed, 13 Dec 2017 07:20:56 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id B9FABC21DAB for ; Wed, 13 Dec 2017 07:20:55 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1La-00073A-Kp; Wed, 13 Dec 2017 08:20:54 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:33 +0100 Message-Id: <20171213071946.6181-5-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 05/78] 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. Reviewed-by: Simon Glass Signed-off-by: Mario Six --- v1 -> v2: None --- lib/fdtdec.c | 56 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 26 deletions(-) -- 2.13.6 diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 30ec6b92b2..7b555189d5 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -83,8 +83,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; @@ -138,8 +139,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; @@ -164,8 +166,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; @@ -182,7 +185,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; @@ -191,15 +194,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; @@ -308,7 +310,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; @@ -349,14 +351,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); @@ -370,8 +371,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]; @@ -393,7 +394,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); @@ -402,7 +404,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]; @@ -429,7 +432,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); @@ -452,7 +455,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; } @@ -498,7 +501,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? */ @@ -641,7 +644,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; @@ -658,7 +662,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; @@ -850,7 +854,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; @@ -862,7 +866,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; @@ -874,7 +878,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 Wed Dec 13 07:18: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: 847809 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxSvL1MSyz9s74 for ; Wed, 13 Dec 2017 18:27:26 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id C3C80C21E16; Wed, 13 Dec 2017 07:22: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=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 9DB0CC21DED; Wed, 13 Dec 2017 07:21:01 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 307ADC21DA6; Wed, 13 Dec 2017 07:20:55 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 74EA2C21DA5 for ; Wed, 13 Dec 2017 07:20:55 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1La-00073A-Pu; Wed, 13 Dec 2017 08:20:54 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:34 +0100 Message-Id: <20171213071946.6181-6-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 06/78] 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. Reviewed-by: Simon Glass Signed-off-by: Mario Six --- v1 -> v2: None --- lib/fdtdec.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) -- 2.13.6 diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 7b555189d5..986a3525b7 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -233,10 +233,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) { @@ -245,10 +245,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; @@ -265,11 +265,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 @@ -299,7 +297,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; @@ -335,7 +333,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; } @@ -345,8 +343,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; } @@ -665,12 +663,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]); } @@ -975,7 +975,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; } From patchwork Wed Dec 13 07:18: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: 847805 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxSq12bjNz9s74 for ; Wed, 13 Dec 2017 18:23:41 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 3A14CC21DE6; Wed, 13 Dec 2017 07:21:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=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 1AE42C21DDA; Wed, 13 Dec 2017 07:21:00 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 15CE9C21DA3; Wed, 13 Dec 2017 07:20:55 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id A3B57C21DAA for ; Wed, 13 Dec 2017 07:20:55 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1La-00073A-Us; Wed, 13 Dec 2017 08:20:54 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:35 +0100 Message-Id: <20171213071946.6181-7-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 07/78] 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. Reviewed-by: Simon Glass Signed-off-by: Mario Six --- v1 -> v2: None --- drivers/core/ofnode.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) -- 2.13.6 diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index 0030ab962e..ebcf64d867 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); @@ -534,10 +536,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) { @@ -546,10 +548,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 Wed Dec 13 07:18: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: 847803 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxSp267g8z9sPm for ; Wed, 13 Dec 2017 18:22:50 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 2F138C21F18; Wed, 13 Dec 2017 07:21: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=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 E6044C21DB0; Wed, 13 Dec 2017 07:20:58 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id EE3C3C21DB5; Wed, 13 Dec 2017 07:20:55 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 7EA36C21DA6 for ; Wed, 13 Dec 2017 07:20:55 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Lb-00073A-3m; Wed, 13 Dec 2017 08:20:55 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:36 +0100 Message-Id: <20171213071946.6181-8-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 08/78] 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. Reviewed-by: Simon Glass Signed-off-by: Mario Six --- v1 -> v2: None --- drivers/core/read.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) -- 2.13.6 diff --git a/drivers/core/read.c b/drivers/core/read.c index 5d440cee72..08955f81fc 100644 --- a/drivers/core/read.c +++ b/drivers/core/read.c @@ -66,7 +66,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); } @@ -77,7 +77,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); } @@ -94,9 +94,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 Wed Dec 13 07:18: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: 847825 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxT7q12dLz9s7B for ; Wed, 13 Dec 2017 18:38:15 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id BCE9CC21E3E; Wed, 13 Dec 2017 07:23: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=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 07477C21DEF; Wed, 13 Dec 2017 07:21:04 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5849BC21D9F; Wed, 13 Dec 2017 07:20:56 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id C9E8EC21D9F for ; Wed, 13 Dec 2017 07:20:55 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Lb-00073A-8m; Wed, 13 Dec 2017 08:20:55 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:37 +0100 Message-Id: <20171213071946.6181-9-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 09/78] 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" Reviewed-by: Simon Glass Signed-off-by: Mario Six --- v1 -> v2: None --- 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(+) -- 2.13.6 diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index ebcf64d867..0b32f9b085 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -644,3 +644,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 08955f81fc..19207a3906 100644 --- a/drivers/core/read.c +++ b/drivers/core/read.c @@ -188,3 +188,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 8b9932a569..c359a60f95 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 Wed Dec 13 07:18: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: 847807 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxSsN2XX9z9s74 for ; Wed, 13 Dec 2017 18:25:44 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id E9E5EC21DAA; Wed, 13 Dec 2017 07:24: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=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 B91E3C21E44; Wed, 13 Dec 2017 07:21:08 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 28921C21DA5; Wed, 13 Dec 2017 07:20:56 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 739FAC21DA6 for ; Wed, 13 Dec 2017 07:20:56 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Lb-00073A-Dw; Wed, 13 Dec 2017 08:20:55 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:38 +0100 Message-Id: <20171213071946.6181-10-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 10/78] 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 it compatible with a live device tree. Reviewed-by: Simon Glass Signed-off-by: Mario Six --- v1 -> v2: None --- drivers/core/device.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- 2.13.6 diff --git a/drivers/core/device.c b/drivers/core/device.c index 9a46a7bbe5..144ac2a991 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -703,8 +704,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 Wed Dec 13 07:18: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: 847826 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxT9F2GQCz9sCZ for ; Wed, 13 Dec 2017 18:39:29 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id A93EAC21E3E; Wed, 13 Dec 2017 07:26:07 +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=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 C4D19C21E48; Wed, 13 Dec 2017 07:21:14 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id AA6CFC21DAB; Wed, 13 Dec 2017 07:20:56 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 18724C21DA5 for ; Wed, 13 Dec 2017 07:20:56 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Lb-00073A-K8; Wed, 13 Dec 2017 08:20:55 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:39 +0100 Message-Id: <20171213071946.6181-11-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 11/78] 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 const, so we mark them as const. Reviewed-by: Simon Glass Signed-off-by: Mario Six --- v1 -> v2: * Changed commit message and text to used the correct word "const" instead of "static". --- drivers/clk/clk-uclass.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) -- 2.13.6 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 Wed Dec 13 07:18: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: 847832 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTNk0SqRz9sPm for ; Wed, 13 Dec 2017 18:49:25 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 66FDEC21DF7; Wed, 13 Dec 2017 07:25: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=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 2D024C21E35; Wed, 13 Dec 2017 07:21:10 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 55F75C21DA1; Wed, 13 Dec 2017 07:20:56 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 4863BC21DA9 for ; Wed, 13 Dec 2017 07:20:56 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Lb-00073A-PG; Wed, 13 Dec 2017 08:20:55 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:40 +0100 Message-Id: <20171213071946.6181-12-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 12/78] 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 Reviewed-by: Simon Glass Signed-off-by: Mario Six --- v1 -> v2: None --- drivers/clk/clk_fixed_rate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.13.6 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 Wed Dec 13 07:18: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: 847824 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxT7R1XMxz9sCZ for ; Wed, 13 Dec 2017 18:37:55 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id D0B6EC21E84; Wed, 13 Dec 2017 07:25: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=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 43C0DC21E42; Wed, 13 Dec 2017 07:21:13 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 7F654C21DAA; Wed, 13 Dec 2017 07:20:56 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 774EBC21DAA for ; Wed, 13 Dec 2017 07:20:56 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Lb-00073A-VZ; Wed, 13 Dec 2017 08:20:56 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:41 +0100 Message-Id: <20171213071946.6181-13-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 13/78] 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. Reviewed-by: Simon Glass Signed-off-by: Mario Six --- v1 -> v2: None --- drivers/clk/clk-uclass.c | 2 -- drivers/clk/clk_fixed_rate.c | 2 -- 2 files changed, 4 deletions(-) -- 2.13.6 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 Wed Dec 13 07:18: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: 847823 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxT5P4fVnz9s7B for ; Wed, 13 Dec 2017 18:36:09 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 73B2CC21E54; Wed, 13 Dec 2017 07:25:28 +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=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 DD62BC21E4C; Wed, 13 Dec 2017 07:21:11 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6D750C21DA9; Wed, 13 Dec 2017 07:20:57 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id C4B4CC21DA6 for ; Wed, 13 Dec 2017 07:20:56 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Lc-00073A-5n; Wed, 13 Dec 2017 08:20:56 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:42 +0100 Message-Id: <20171213071946.6181-14-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 14/78] 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 --- v1 -> v2: None --- drivers/spi/spi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.13.6 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 Wed Dec 13 07:18: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: 847831 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTFg5nWHz9sCZ for ; Wed, 13 Dec 2017 18:43:17 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 4EE30C21DC8; Wed, 13 Dec 2017 07:26:26 +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=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 72AD9C21E63; Wed, 13 Dec 2017 07:21:16 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C3D34C21DA9; Wed, 13 Dec 2017 07:20:57 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id D2331C21DA9 for ; Wed, 13 Dec 2017 07:20:56 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Lc-00073A-C1; Wed, 13 Dec 2017 08:20:56 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:43 +0100 Message-Id: <20171213071946.6181-15-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 15/78] 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. Reviewed-by: Simon Glass Reviewed-by: Jagan Teki Signed-off-by: Mario Six --- v1 -> v2: None --- drivers/spi/spi.c | 20 -------------------- include/spi.h | 14 -------------- scripts/config_whitelist.txt | 1 - 3 files changed, 35 deletions(-) -- 2.13.6 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 d5ae1f4685..0dc473895c 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -1571,7 +1571,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 Wed Dec 13 07:18: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: 847821 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxT4P3N49z9s7B for ; Wed, 13 Dec 2017 18:35:17 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 0D7B2C21EA7; Wed, 13 Dec 2017 07:27: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=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 2A820C21E5A; Wed, 13 Dec 2017 07:21:20 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3269BC21DA9; Wed, 13 Dec 2017 07:20:58 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 0179EC21D9F for ; Wed, 13 Dec 2017 07:20:57 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Lc-00073A-HF; Wed, 13 Dec 2017 08:20:56 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:44 +0100 Message-Id: <20171213071946.6181-16-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 16/78] 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. Reviewed-by: Simon Glass Reviewed-by: Jagan Teki Signed-off-by: Mario Six --- v1 -> v2: None --- drivers/mtd/spi/sf_probe.c | 13 ------------- include/spi_flash.h | 12 ------------ 2 files changed, 25 deletions(-) -- 2.13.6 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 Wed Dec 13 07:18: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: 847819 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxT3q0KLjz9s7B for ; Wed, 13 Dec 2017 18:34:46 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 99CB3C21E50; Wed, 13 Dec 2017 07:26: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=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 68381C21E70; Wed, 13 Dec 2017 07:21:18 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 57828C21DB2; Wed, 13 Dec 2017 07:20:58 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 17E89C21DA3 for ; Wed, 13 Dec 2017 07:20:57 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Lc-00073A-MI; Wed, 13 Dec 2017 08:20:56 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:45 +0100 Message-Id: <20171213071946.6181-17-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 17/78] 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. Reviewed-by: Simon Glass Reviewed-by: Jagan Teki Signed-off-by: Mario Six --- v1 -> v2: None --- drivers/spi/spi-uclass.c | 16 ---------------- include/spi.h | 13 ------------- 2 files changed, 29 deletions(-) -- 2.13.6 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 Wed Dec 13 07:18: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: 847815 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxT283WT1z9s7B for ; Wed, 13 Dec 2017 18:33:20 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 07F1AC21F53; Wed, 13 Dec 2017 07:27: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=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 8B23DC21E6F; Wed, 13 Dec 2017 07:21:21 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 8667DC21DA5; Wed, 13 Dec 2017 07:20:58 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 5A33FC21DA6 for ; Wed, 13 Dec 2017 07:20:57 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Lc-00073A-RG; Wed, 13 Dec 2017 08:20:56 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:46 +0100 Message-Id: <20171213071946.6181-18-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 18/78] 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. Reviewed-by: Simon Glass Reviewed-by: Jagan Teki Signed-off-by: Mario Six --- v1 -> v2: None --- scripts/config_whitelist.txt | 1 - 1 file changed, 1 deletion(-) -- 2.13.6 diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 0dc473895c..1154cfda94 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -1571,7 +1571,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 Wed Dec 13 07:18: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: 847816 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxT2B3Y86z9s7B for ; Wed, 13 Dec 2017 18:33:22 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 2992EC21E39; Wed, 13 Dec 2017 07:28: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=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 C7E89C21EA5; Wed, 13 Dec 2017 07:21:23 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 7E518C21DBB; Wed, 13 Dec 2017 07:20:58 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 68FFBC21DA5 for ; Wed, 13 Dec 2017 07:20:57 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Ld-00073A-1U; Wed, 13 Dec 2017 08:20:57 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:47 +0100 Message-Id: <20171213071946.6181-19-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 19/78] 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 --- v1 -> v2: None --- drivers/mtd/spi/sf_probe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.13.6 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 Wed Dec 13 07:18: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: 847849 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTk71Rfjz9s9Y for ; Wed, 13 Dec 2017 19:04:31 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id B9AA7C21E45; Wed, 13 Dec 2017 07:27: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=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 A6F78C21E92; Wed, 13 Dec 2017 07:21:22 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 11236C21DBB; Wed, 13 Dec 2017 07:20:58 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id A85F1C21DA1 for ; Wed, 13 Dec 2017 07:20:57 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Ld-00073A-7k; Wed, 13 Dec 2017 08:20:57 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:48 +0100 Message-Id: <20171213071946.6181-20-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 20/78] 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. Reviewed-by: Simon Glass Reviewed-by: Jagan Teki Signed-off-by: Mario Six --- v1 -> v2: None --- drivers/spi/spi-uclass.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- 2.13.6 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 Wed Dec 13 07:18: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: 847850 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTkf2Jbsz9t2M for ; Wed, 13 Dec 2017 19:04:57 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 91751C21E54; Wed, 13 Dec 2017 07:28:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=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 48DB7C21E50; Wed, 13 Dec 2017 07:21:25 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id F2C0EC21DD0; Wed, 13 Dec 2017 07:20:58 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id D4DA4C21DB0 for ; Wed, 13 Dec 2017 07:20:57 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Ld-00073A-E6; Wed, 13 Dec 2017 08:20:57 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:49 +0100 Message-Id: <20171213071946.6181-21-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 21/78] 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. Reviewed-by: Simon Glass Signed-off-by: Mario Six --- v1 -> v2: None --- drivers/mtd/spi/sf_probe.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) -- 2.13.6 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 Wed Dec 13 07:18: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: 847845 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTgX6tpFz9t2W for ; Wed, 13 Dec 2017 19:02:16 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 3AE4AC21E71; Wed, 13 Dec 2017 07:29: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=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 D18E2C21E85; Wed, 13 Dec 2017 07:21:34 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0865BC21E57; Wed, 13 Dec 2017 07:21:01 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 39493C21D9F for ; Wed, 13 Dec 2017 07:20:58 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Ld-00073A-JA; Wed, 13 Dec 2017 08:20:57 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:50 +0100 Message-Id: <20171213071946.6181-22-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 22/78] 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 Acked-by: Joe Hershberger --- v1 -> v2: None --- drivers/net/tsec.c | 72 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 35 deletions(-) -- 2.13.6 diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index 18e7a83d0f..071595218e 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 Wed Dec 13 07:18: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: 847841 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTZw36gGz9s83 for ; Wed, 13 Dec 2017 18:58:16 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 047D5C21E5A; Wed, 13 Dec 2017 07:28: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=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 650B8C21DBA; Wed, 13 Dec 2017 07:21:26 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 074C0C21E0E; Wed, 13 Dec 2017 07:21:01 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 3FAF7C21DA3 for ; Wed, 13 Dec 2017 07:20:58 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Ld-00073A-OE; Wed, 13 Dec 2017 08:20:57 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:51 +0100 Message-Id: <20171213071946.6181-23-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 23/78] 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 Acked-by: Joe Hershberger --- v1 -> v2: None --- drivers/net/tsec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.13.6 diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index 071595218e..44140fb037 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -701,8 +701,10 @@ static int tsec_initialize(bd_t *bis, struct tsec_info_struct *tsec_info) priv = (struct tsec_private *)malloc(sizeof(*priv)); - if (!priv) + if (!priv) { + free(dev); return 0; + } priv->regs = tsec_info->regs; priv->phyregs_sgmii = tsec_info->miiregs_sgmii; From patchwork Wed Dec 13 07:18: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: 847811 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxT0T3fs5z9s7B for ; Wed, 13 Dec 2017 18:31:53 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 0D855C21ECE; Wed, 13 Dec 2017 07:30:55 +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=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 28B42C21ED6; Wed, 13 Dec 2017 07:21:49 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3B119C21DD0; Wed, 13 Dec 2017 07:21:02 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 82071C21DA1 for ; Wed, 13 Dec 2017 07:20:58 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Ld-00073A-UW; Wed, 13 Dec 2017 08:20:57 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:52 +0100 Message-Id: <20171213071946.6181-24-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 24/78] 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. Reviewed-by: Simon Glass Signed-off-by: Mario Six Acked-by: Joe Hershberger --- v1 -> v2: None --- drivers/net/tsec.c | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) -- 2.13.6 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 Wed Dec 13 07:18: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: 847813 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxT1J2jGzz9s7B for ; Wed, 13 Dec 2017 18:32:36 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id E1F5AC21F56; Wed, 13 Dec 2017 07:28:57 +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=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 A71E6C21EBC; Wed, 13 Dec 2017 07:21:27 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E6E6EC21E77; Wed, 13 Dec 2017 07:21:02 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 09BEAC21DB2 for ; Wed, 13 Dec 2017 07:20:59 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Le-00073A-3S; Wed, 13 Dec 2017 08:20:58 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:53 +0100 Message-Id: <20171213071946.6181-25-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 25/78] 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. Reviewed-by: Heiko Schocher Signed-off-by: Mario Six --- v1 -> v2: None --- drivers/i2c/fsl_i2c.c | 111 +++++++++++++++++++++++++------------------------- 1 file changed, 56 insertions(+), 55 deletions(-) -- 2.13.6 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 Wed Dec 13 07:18: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: 847858 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTsJ6Y0Dz9t4V for ; Wed, 13 Dec 2017 19:09:47 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 54CA4C21E54; Wed, 13 Dec 2017 07:30:20 +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=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 67231C21EC9; Wed, 13 Dec 2017 07:21:44 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C58A1C21EC9; Wed, 13 Dec 2017 07:21:06 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 0284EC21DB2 for ; Wed, 13 Dec 2017 07:21:03 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Li-00073A-8h; Wed, 13 Dec 2017 08:21:02 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:54 +0100 Message-Id: <20171213071946.6181-26-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 26/78] 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. Reviewed-by: Heiko Schocher Signed-off-by: Mario Six --- v1 -> v2: None --- drivers/i2c/fsl_i2c.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.13.6 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 Wed Dec 13 07:18: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: 847814 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxT1Z6Pd3z9s7B for ; Wed, 13 Dec 2017 18:32:50 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 6BF7BC21EC9; Wed, 13 Dec 2017 07:29: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=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 5B46CC21E5B; Wed, 13 Dec 2017 07:21:36 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3FF38C21E5B; Wed, 13 Dec 2017 07:21:06 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 1415AC21DF7 for ; Wed, 13 Dec 2017 07:21:03 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Li-00073A-Ew; Wed, 13 Dec 2017 08:21:02 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:55 +0100 Message-Id: <20171213071946.6181-27-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 27/78] 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. Reviewed-by: Heiko Schocher Signed-off-by: Mario Six --- v1 -> v2: None --- drivers/i2c/fsl_i2c.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) -- 2.13.6 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 Wed Dec 13 07:18: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: 847829 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTDH5Drxz9sPm for ; Wed, 13 Dec 2017 18:42:07 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 48A20C21DF3; Wed, 13 Dec 2017 07:30: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=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 63E4EC21DCE; Wed, 13 Dec 2017 07:21:42 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 324E3C21EC8; Wed, 13 Dec 2017 07:21:10 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 49D20C21E3B for ; Wed, 13 Dec 2017 07:21:07 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Lm-00073A-L2; Wed, 13 Dec 2017 08:21:06 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:56 +0100 Message-Id: <20171213071946.6181-28-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 28/78] 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 --- v1 -> v2: None --- drivers/gpio/pca953x_gpio.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) -- 2.13.6 diff --git a/drivers/gpio/pca953x_gpio.c b/drivers/gpio/pca953x_gpio.c index 791d1d1516..5ea1e05eed 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 Wed Dec 13 07:18: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: 847818 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxT3l0wn3z9sCZ for ; Wed, 13 Dec 2017 18:34:42 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 95996C21E8B; Wed, 13 Dec 2017 07:30:38 +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=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 E6EABC21DDA; Wed, 13 Dec 2017 07:21:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 8777AC21E72; Wed, 13 Dec 2017 07:21:11 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 5F434C21DE4 for ; Wed, 13 Dec 2017 07:21:07 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Lm-00073A-Q7; Wed, 13 Dec 2017 08:21:06 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:57 +0100 Message-Id: <20171213071946.6181-29-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 29/78] 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. Reviewed-by: Simon Glass Signed-off-by: Mario Six --- v1 -> v2: None --- drivers/gpio/pca953x_gpio.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 2.13.6 diff --git a/drivers/gpio/pca953x_gpio.c b/drivers/gpio/pca953x_gpio.c index 5ea1e05eed..a8a5a89c05 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 * @@ -253,7 +251,7 @@ static int pca953x_probe(struct udevice *dev) ulong driver_data; int ret; - 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 Wed Dec 13 07:18: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: 847840 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTXl0cmmz9s83 for ; Wed, 13 Dec 2017 18:56:22 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 6DCAFC21E57; Wed, 13 Dec 2017 07:36:18 +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=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 4DDD2C21F27; Wed, 13 Dec 2017 07:22:57 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 31CF2C21F2A; Wed, 13 Dec 2017 07:21:15 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 74EFBC21E32 for ; Wed, 13 Dec 2017 07:21:11 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Lr-00073A-0F; Wed, 13 Dec 2017 08:21:11 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:58 +0100 Message-Id: <20171213071946.6181-30-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 30/78] 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. Reviewed-by: Simon Glass Signed-off-by: Mario Six --- v1 -> v2: None --- drivers/serial/ns16550.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.13.6 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 Wed Dec 13 07:18: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: 847822 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxT5G3ldlz9s7B for ; Wed, 13 Dec 2017 18:36:02 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id E6EA5C21DC1; Wed, 13 Dec 2017 07:34: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=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 9CD0CC21E30; Wed, 13 Dec 2017 07:22:02 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4099BC21E74; Wed, 13 Dec 2017 07:21:15 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 01D6BC21DE4 for ; Wed, 13 Dec 2017 07:21:12 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Lr-00073A-6W; Wed, 13 Dec 2017 08:21:11 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:18:59 +0100 Message-Id: <20171213071946.6181-31-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 31/78] 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 --- v1 -> v2: None --- 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 -- 2.13.6 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 1154cfda94..62c5ce4fae 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -429,7 +429,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 @@ -1070,9 +1069,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 @@ -3253,8 +3249,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 @@ -3690,13 +3684,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 Wed Dec 13 07:19: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: 847871 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxV3S2tkDz9s9Y for ; Wed, 13 Dec 2017 19:19:31 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id A449DC21F04; Wed, 13 Dec 2017 07:35:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=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 CD095C21F14; Wed, 13 Dec 2017 07:22:27 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 538D7C21EFC; Wed, 13 Dec 2017 07:21:20 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 88DE1C21DE4 for ; Wed, 13 Dec 2017 07:21:16 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Lv-00073A-Bg; Wed, 13 Dec 2017 08:21:15 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:00 +0100 Message-Id: <20171213071946.6181-32-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 32/78] 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 Acked-by: Joe Hershberger --- v1 -> v2: None --- drivers/net/phy/marvell.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) -- 2.13.6 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 Wed Dec 13 07:19: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: 847846 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxThF0bBFz9s9Y for ; Wed, 13 Dec 2017 19:02:52 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 2E062C21E45; Wed, 13 Dec 2017 07:39: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=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 48BDCC21DA3; Wed, 13 Dec 2017 07:23:59 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A7891C21E18; Wed, 13 Dec 2017 07:21:22 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id D0772C21E2C for ; Wed, 13 Dec 2017 07:21:18 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Ly-00073A-Al; Wed, 13 Dec 2017 08:21:18 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:01 +0100 Message-Id: <20171213071946.6181-33-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 33/78] 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 --- v1 -> v2: None --- drivers/net/phy/marvell.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.13.6 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 Wed Dec 13 07:19: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: 847835 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTS61hD9z9sPm for ; Wed, 13 Dec 2017 18:52:22 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id CF15AC21E05; Wed, 13 Dec 2017 07:36: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=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 69E68C21F30; Wed, 13 Dec 2017 07:23:00 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E0581C21E66; Wed, 13 Dec 2017 07:21:25 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id C58EDC21E30 for ; Wed, 13 Dec 2017 07:21:20 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Ly-00073A-H3; Wed, 13 Dec 2017 08:21:18 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:02 +0100 Message-Id: <20171213071946.6181-34-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 34/78] 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 --- v1 -> v2: None --- drivers/mtd/cfi_flash.c | 428 ++++++++++++++++++++++++------------------------ 1 file changed, 214 insertions(+), 214 deletions(-) -- 2.13.6 diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index f096e039cb..0dc7f4a6ba 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; @@ -1721,26 +1721,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; @@ -1771,7 +1771,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; @@ -1866,7 +1866,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; @@ -1890,7 +1890,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; @@ -1899,21 +1899,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); @@ -1944,9 +1944,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) { @@ -1956,7 +1956,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; } @@ -2063,7 +2063,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; @@ -2087,20 +2087,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) { @@ -2145,11 +2145,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 */ @@ -2157,7 +2157,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; @@ -2168,12 +2168,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; } @@ -2186,7 +2186,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) @@ -2217,7 +2217,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, @@ -2274,7 +2274,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); @@ -2362,7 +2362,7 @@ static void flash_protect_default(void) #endif } -unsigned long flash_init (void) +unsigned long flash_init(void) { unsigned long size = 0; int i; @@ -2390,7 +2390,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); @@ -2422,7 +2422,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; @@ -2436,7 +2436,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 Wed Dec 13 07:19: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: 847828 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTCn06y6z9s7g for ; Wed, 13 Dec 2017 18:41:40 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id DDD47C21DDF; Wed, 13 Dec 2017 07:37: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=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 9ECC1C21F31; Wed, 13 Dec 2017 07:23:02 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 30C1FC21F0C; Wed, 13 Dec 2017 07:21:29 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id EA548C21E3E for ; Wed, 13 Dec 2017 07:21:24 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1M2-00073A-NK; Wed, 13 Dec 2017 08:21:22 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:03 +0100 Message-Id: <20171213071946.6181-35-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 35/78] 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 --- v1 -> v2: None --- drivers/mtd/cfi_flash.c | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) -- 2.13.6 diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 0dc7f4a6ba..a1b217cc0c 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; @@ -1771,7 +1771,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; @@ -1890,7 +1890,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; @@ -1944,7 +1944,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 Wed Dec 13 07:19: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: 847855 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTqR5fBSz9t2M for ; Wed, 13 Dec 2017 19:09:07 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 02431C21DDB; Wed, 13 Dec 2017 07:38: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=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 61223C21F3A; Wed, 13 Dec 2017 07:23:33 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4F12FC21E11; Wed, 13 Dec 2017 07:21:33 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 50D91C21E43 for ; Wed, 13 Dec 2017 07:21:28 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1M6-00073A-SP; Wed, 13 Dec 2017 08:21:26 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:04 +0100 Message-Id: <20171213071946.6181-36-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 36/78] 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 --- v1 -> v2: None --- drivers/mtd/cfi_flash.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) -- 2.13.6 diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index a1b217cc0c..e8f1739254 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; @@ -1719,7 +1719,7 @@ static void cmdset_amd_read_jedec_ids(flash_info_t *info) info->sr_supported = feature & 0x1; } - switch (info->chipwidth){ + switch (info->chipwidth) { case FLASH_CFI_8BIT: info->device_id = flash_read_uchar(info, FLASH_OFFSET_DEVICE_ID); @@ -1838,7 +1838,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: @@ -1925,12 +1925,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 Wed Dec 13 07:19: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: 847842 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTdW0kTcz9s9Y for ; Wed, 13 Dec 2017 19:00:30 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id A8A62C21E6C; Wed, 13 Dec 2017 07:40: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=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 AF4EBC21F3F; Wed, 13 Dec 2017 07:24:25 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 67004C21DAA; Wed, 13 Dec 2017 07:21:31 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 76162C21EBA for ; Wed, 13 Dec 2017 07:21:27 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1M7-00073A-1E; Wed, 13 Dec 2017 08:21:27 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:05 +0100 Message-Id: <20171213071946.6181-37-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 37/78] 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 --- v1 -> v2: None --- drivers/mtd/cfi_flash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.13.6 diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index e8f1739254..2dc6b09cd9 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 Wed Dec 13 07:19: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: 847827 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTCZ2tzhz9s7g for ; Wed, 13 Dec 2017 18:41:30 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 11BB4C21DF3; Wed, 13 Dec 2017 07:38:55 +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=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 D64F8C21E0F; Wed, 13 Dec 2017 07:23:37 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id DA350C21DF3; Wed, 13 Dec 2017 07:21:37 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id D4A91C21E74 for ; Wed, 13 Dec 2017 07:21:31 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1MB-00073A-7Z; Wed, 13 Dec 2017 08:21:31 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:06 +0100 Message-Id: <20171213071946.6181-38-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 38/78] 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 --- v1 -> v2: None --- drivers/mtd/cfi_flash.c | 200 ++++++++++++++++++++++++------------------------ 1 file changed, 100 insertions(+), 100 deletions(-) -- 2.13.6 diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 2dc6b09cd9..b77fd3c0a2 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 Wed Dec 13 07:19: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: 847833 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTNy5hytz9sPm for ; Wed, 13 Dec 2017 18:49:38 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 61229C21E05; Wed, 13 Dec 2017 07:38:19 +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=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 4C0EAC21DC8; Wed, 13 Dec 2017 07:23:32 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id CD013C21DC8; Wed, 13 Dec 2017 07:21:37 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id DE9DFC21EC9 for ; Wed, 13 Dec 2017 07:21:31 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1MB-00073A-Cc; Wed, 13 Dec 2017 08:21:31 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:07 +0100 Message-Id: <20171213071946.6181-39-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 39/78] 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 --- v1 -> v2: None --- drivers/mtd/cfi_flash.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) -- 2.13.6 diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index b77fd3c0a2..0d58914e44 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 @@ -1888,7 +1888,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) { @@ -2035,7 +2035,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; } } @@ -2093,9 +2093,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); } @@ -2392,7 +2392,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 Wed Dec 13 07:19: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: 847843 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTfr4JfMz9sCZ for ; Wed, 13 Dec 2017 19:01:40 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 2C61EC21E45; Wed, 13 Dec 2017 07:35: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=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 D0997C21EC8; Wed, 13 Dec 2017 07:22:46 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0BB2CC21DDF; Wed, 13 Dec 2017 07:21:40 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 2373FC21EBB for ; Wed, 13 Dec 2017 07:21:36 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1MF-00073A-Hf; Wed, 13 Dec 2017 08:21:35 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:08 +0100 Message-Id: <20171213071946.6181-40-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 40/78] 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 --- v1 -> v2: None --- drivers/mtd/cfi_flash.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) -- 2.13.6 diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 0d58914e44..9cc1b2b16f 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; /* @@ -1887,6 +1882,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"))); @@ -2370,6 +2366,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 Wed Dec 13 07:19: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: 847834 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTRK50jpz9sPm for ; Wed, 13 Dec 2017 18:51:38 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 8F3DEC21E26; Wed, 13 Dec 2017 07:33: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=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 96C73C21DDE; Wed, 13 Dec 2017 07:21:59 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5F1C7C21EBB; Wed, 13 Dec 2017 07:21:40 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 379F5C21EA8 for ; Wed, 13 Dec 2017 07:21:36 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1MF-00073A-Mi; Wed, 13 Dec 2017 08:21:35 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:09 +0100 Message-Id: <20171213071946.6181-41-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 41/78] 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 --- v1 -> v2: None --- drivers/mtd/cfi_flash.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) -- 2.13.6 diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 9cc1b2b16f..e2469055b8 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 Wed Dec 13 07:19: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: 847854 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTpQ6z5gz9t2M for ; Wed, 13 Dec 2017 19:08:14 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 69A90C21EA2; Wed, 13 Dec 2017 07:34: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=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 14F6AC21DED; Wed, 13 Dec 2017 07:22:11 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3ABEAC21DDB; Wed, 13 Dec 2017 07:21:46 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 92A0AC21ED5 for ; Wed, 13 Dec 2017 07:21:40 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1MJ-00073A-SP; Wed, 13 Dec 2017 08:21:39 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:10 +0100 Message-Id: <20171213071946.6181-42-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 42/78] 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 --- v1 -> v2: None --- drivers/mtd/cfi_flash.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) -- 2.13.6 diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index e2469055b8..eebd641e36 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" :) @@ -1807,8 +1807,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 { @@ -1892,9 +1892,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); @@ -2144,8 +2144,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 Wed Dec 13 07:19: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: 847837 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTVT0pJFz9s7g for ; Wed, 13 Dec 2017 18:54:24 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id A5897C21E72; Wed, 13 Dec 2017 07:34: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=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 B3684C21E54; Wed, 13 Dec 2017 07:22:06 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D56F7C21E77; Wed, 13 Dec 2017 07:21:51 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 8AE85C21EDE for ; Wed, 13 Dec 2017 07:21:44 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1MO-00073A-1b; Wed, 13 Dec 2017 08:21:44 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:11 +0100 Message-Id: <20171213071946.6181-43-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 43/78] 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 --- v1 -> v2: None --- drivers/mtd/cfi_flash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.13.6 diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index eebd641e36..6ae1ac871f 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 Wed Dec 13 07:19: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: 847844 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTgQ0sdPz9sPm for ; Wed, 13 Dec 2017 19:02:09 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 9F0AFC21E54; Wed, 13 Dec 2017 07:36: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=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 EC017C21F29; Wed, 13 Dec 2017 07:22:51 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 38A07C21DF4; Wed, 13 Dec 2017 07:21:51 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id D47FCC21E3E for ; Wed, 13 Dec 2017 07:21:44 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1MO-00073A-7n; Wed, 13 Dec 2017 08:21:44 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:12 +0100 Message-Id: <20171213071946.6181-44-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 44/78] 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 --- v1 -> v2: None --- drivers/mtd/cfi_flash.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 2.13.6 diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 6ae1ac871f..a21c407ed7 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) { @@ -1793,7 +1794,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 Wed Dec 13 07:19: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: 847848 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTk00KvZz9s9Y for ; Wed, 13 Dec 2017 19:04:23 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id DF122C21EAE; Wed, 13 Dec 2017 07:40:33 +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=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 1091EC21F48; Wed, 13 Dec 2017 07:24:24 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4AE23C21F00; Wed, 13 Dec 2017 07:21:56 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 33FE5C21EE9 for ; Wed, 13 Dec 2017 07:21:49 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1MS-00073A-EB; Wed, 13 Dec 2017 08:21:48 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:13 +0100 Message-Id: <20171213071946.6181-45-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 45/78] 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 --- v1 -> v2: None --- drivers/mtd/cfi_flash.c | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) -- 2.13.6 diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index a21c407ed7..0a24e9173a 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]); } } @@ -1919,11 +1919,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; @@ -2040,8 +2040,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 || @@ -2081,8 +2081,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) { @@ -2146,8 +2146,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", @@ -2157,7 +2157,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; } @@ -2172,7 +2172,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; @@ -2261,8 +2261,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 Wed Dec 13 07:19: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: 847856 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTsH6Dqnz9t3t for ; Wed, 13 Dec 2017 19:09:31 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 7EFE3C21E77; Wed, 13 Dec 2017 07:35: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=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 75AABC21DDB; Wed, 13 Dec 2017 07:22:14 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id CBAE8C21EDC; Wed, 13 Dec 2017 07:21:55 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 00776C21EE6 for ; Wed, 13 Dec 2017 07:21:49 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1MS-00073A-Jn; Wed, 13 Dec 2017 08:21:48 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:14 +0100 Message-Id: <20171213071946.6181-46-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 46/78] 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 --- v1 -> v2: None --- drivers/mtd/cfi_flash.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.13.6 diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 0a24e9173a..53842443eb 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 Wed Dec 13 07:19: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: 847838 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTWf3n8Wz9s83 for ; Wed, 13 Dec 2017 18:55:26 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id B2317C21E16; Wed, 13 Dec 2017 07:49: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=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 88463C21EAB; Wed, 13 Dec 2017 07:37:13 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 8966DC21EAB; Wed, 13 Dec 2017 07:21:58 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 34050C21EF3 for ; Wed, 13 Dec 2017 07:21:53 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1MW-00073A-QG; Wed, 13 Dec 2017 08:21:52 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:15 +0100 Message-Id: <20171213071946.6181-47-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 47/78] 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 --- v1 -> v2: None --- drivers/mtd/cfi_flash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.13.6 diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 53842443eb..4c5e1568e6 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 Wed Dec 13 07:19: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: 847877 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxV654Yf4z9s9Y for ; Wed, 13 Dec 2017 19:21:45 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 6B284C21F17; Wed, 13 Dec 2017 07:41:28 +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=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 1CCC8C21F19; Wed, 13 Dec 2017 07:25:02 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 74760C21C29; Wed, 13 Dec 2017 07:21:58 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 875C8C21DAA for ; Wed, 13 Dec 2017 07:21:53 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1MX-00073A-0M; Wed, 13 Dec 2017 08:21:53 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:16 +0100 Message-Id: <20171213071946.6181-48-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 48/78] 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 --- v1 -> v2: None --- drivers/mtd/cfi_flash.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.13.6 diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 4c5e1568e6..5b3c071b30 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1826,9 +1826,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 Wed Dec 13 07:19: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: 847857 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTsN1Rqsz9s9Y for ; Wed, 13 Dec 2017 19:10:47 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 909C5C21E72; Wed, 13 Dec 2017 07:45: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=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 5BCB5C21E99; Wed, 13 Dec 2017 07:31:40 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E1D9EC21EA7; Wed, 13 Dec 2017 07:22:07 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 0A1D5C21E64 for ; Wed, 13 Dec 2017 07:21:58 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Mb-00073A-6k; Wed, 13 Dec 2017 08:21:57 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:17 +0100 Message-Id: <20171213071946.6181-49-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 49/78] 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 --- v1 -> v2: None --- drivers/mtd/cfi_flash.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.13.6 diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 5b3c071b30..7aa379b0d8 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1925,8 +1925,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 Wed Dec 13 07:19: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: 847859 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTsL6YVDz9t2M for ; Wed, 13 Dec 2017 19:10:46 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 6EACDC21E35; Wed, 13 Dec 2017 07:43: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=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 95D85C21E16; Wed, 13 Dec 2017 07:29:22 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E382FC21E08; Wed, 13 Dec 2017 07:22:10 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id C7F38C21ECA for ; Wed, 13 Dec 2017 07:22:01 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Mf-00073A-DE; Wed, 13 Dec 2017 08:22:01 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:18 +0100 Message-Id: <20171213071946.6181-50-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 50/78] 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 --- v1 -> v2: None --- drivers/mtd/cfi_flash.c | 1 - 1 file changed, 1 deletion(-) -- 2.13.6 diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 7aa379b0d8..d16357343f 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 Wed Dec 13 07:19: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: 847879 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxV6R0Wsgz9t2W for ; Wed, 13 Dec 2017 19:22:06 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 52437C21EDE; Wed, 13 Dec 2017 07:41: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=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 6223AC21DDD; Wed, 13 Dec 2017 07:25:00 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C64A5C21E10; Wed, 13 Dec 2017 07:22:11 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 3C59CC21EEF for ; Wed, 13 Dec 2017 07:22:02 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Mf-00073A-JR; Wed, 13 Dec 2017 08:22:01 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:19 +0100 Message-Id: <20171213071946.6181-51-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 51/78] 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 --- v1 -> v2: None --- drivers/mtd/cfi_flash.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) -- 2.13.6 diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index d16357343f..48086ded5c 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1339,7 +1339,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) @@ -1370,7 +1371,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; @@ -1381,7 +1383,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; @@ -1397,7 +1400,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; @@ -1569,9 +1573,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 Wed Dec 13 07:19: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: 847885 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxVB10bFwz9s9Y for ; Wed, 13 Dec 2017 19:25:12 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 62B57C21F22; Wed, 13 Dec 2017 07:43: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=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 566AFC21E70; Wed, 13 Dec 2017 07:27:19 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 9035FC21E06; Wed, 13 Dec 2017 07:22:13 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 319D7C21F01 for ; Wed, 13 Dec 2017 07:22:06 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Mj-00073A-Od; Wed, 13 Dec 2017 08:22:05 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:20 +0100 Message-Id: <20171213071946.6181-52-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 52/78] 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 --- v1 -> v2: None --- drivers/mtd/cfi_flash.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.13.6 diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 48086ded5c..fced9847ef 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -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, uint offset, uchar cmd) { - void *addr; + u8 *addr; cfiword_t cword; int retval; @@ -872,9 +872,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 Wed Dec 13 07:19: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: 847839 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTX23KMwz9s83 for ; Wed, 13 Dec 2017 18:55:46 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 68871C21E42; Wed, 13 Dec 2017 07:47: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=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 93E5AC21F8F; Wed, 13 Dec 2017 07:33:33 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 129D4C21F5E; Wed, 13 Dec 2017 07:22:13 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 5F924C21F07 for ; Wed, 13 Dec 2017 07:22:06 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Mj-00073A-V4; Wed, 13 Dec 2017 08:22:05 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:21 +0100 Message-Id: <20171213071946.6181-53-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 53/78] 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 --- v1 -> v2: None --- drivers/mtd/cfi_flash.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) -- 2.13.6 diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index fced9847ef..8040e43de7 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1255,10 +1255,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:"); @@ -2050,8 +2049,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; } } @@ -2388,9 +2387,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 Wed Dec 13 07:19: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: 847853 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTm96W6cz9t2M for ; Wed, 13 Dec 2017 19:06:17 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 43A8DC21E7B; Wed, 13 Dec 2017 07:44: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=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 20B67C21E4C; Wed, 13 Dec 2017 07:29:56 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 06544C21E08; Wed, 13 Dec 2017 07:22:18 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id B3397C21DE6 for ; Wed, 13 Dec 2017 07:22:10 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Mo-00073A-3w; Wed, 13 Dec 2017 08:22:10 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:22 +0100 Message-Id: <20171213071946.6181-54-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 54/78] 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 --- v1 -> v2: None --- drivers/mtd/cfi_flash.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) -- 2.13.6 diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 8040e43de7..e94a7269e1 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -1687,8 +1687,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 feature; flash_write_cmd(info, 0, 0, AMD_CMD_RESET); @@ -1696,14 +1696,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; debug("info->ext_addr = 0x%x, cfi_version = 0x%x\n", info->ext_addr, info->cfi_version); From patchwork Wed Dec 13 07:19: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: 847874 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxV5c2Q65z9sCZ for ; Wed, 13 Dec 2017 19:21:24 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id E4379C21DF3; Wed, 13 Dec 2017 07:46: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=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 9246BC21F73; Wed, 13 Dec 2017 07:32:41 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 82550C21F70; Wed, 13 Dec 2017 07:22:18 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id C3C43C21EF2 for ; Wed, 13 Dec 2017 07:22:10 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Mo-00073A-9r; Wed, 13 Dec 2017 08:22:10 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:23 +0100 Message-Id: <20171213071946.6181-55-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 55/78] 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 --- v1 -> v2: None --- board/cobra5272/flash.c | 2 +- common/flash.c | 4 ++-- drivers/mtd/cfi_flash.c | 4 ++-- drivers/mtd/pic32_flash.c | 6 +++--- include/flash.h | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) -- 2.13.6 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 e94a7269e1..5ba0c5fdec 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -588,7 +588,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 */ } @@ -696,7 +696,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/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/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 Wed Dec 13 07:19: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: 847872 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxV3p0zscz9s9Y for ; Wed, 13 Dec 2017 19:19:49 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id ECF02C21E9C; Wed, 13 Dec 2017 07:42: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=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 1D4D3C21EFC; Wed, 13 Dec 2017 07:26:09 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 0B337C21F38; Wed, 13 Dec 2017 07:22:21 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id DBDF3C21F07 for ; Wed, 13 Dec 2017 07:22:14 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Ms-00073A-F4; Wed, 13 Dec 2017 08:22:14 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:24 +0100 Message-Id: <20171213071946.6181-56-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 56/78] 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 --- v1 -> v2: None --- drivers/mtd/cfi_flash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.13.6 diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 5ba0c5fdec..61c2e6379d 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -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 ((sector < info->sector_count - 1) && + (info->start[sector] < addr)) sector++; while ((info->start[sector] > addr) && (sector > 0)) /* From patchwork Wed Dec 13 07:19: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: 847886 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxVBb13D6z9s9Y for ; Wed, 13 Dec 2017 19:25:42 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 7E4E5C21F07; Wed, 13 Dec 2017 07:46: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=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 391E3C21F58; Wed, 13 Dec 2017 07:32:10 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 8ADAAC21DFA; Wed, 13 Dec 2017 07:22:32 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 292DCC21DE6 for ; Wed, 13 Dec 2017 07:22:19 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Mw-00073A-LO; Wed, 13 Dec 2017 08:22:18 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:25 +0100 Message-Id: <20171213071946.6181-57-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 57/78] 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 --- v1 -> v2: None --- drivers/mtd/cfi_flash.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) -- 2.13.6 diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 61c2e6379d..88c47cad90 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; @@ -569,8 +570,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 @@ -661,8 +663,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 @@ -937,7 +940,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); @@ -1152,7 +1156,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, @@ -1561,9 +1566,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 }; @@ -1899,9 +1906,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); @@ -2182,8 +2189,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 Wed Dec 13 07:19: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: 847870 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxV386FKvz9sBZ for ; Wed, 13 Dec 2017 19:19:16 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 0DF36C21EC8; Wed, 13 Dec 2017 07:50: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=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 B85DEC21EEC; Wed, 13 Dec 2017 07:38:49 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B4D40C21EC8; Wed, 13 Dec 2017 07:22:33 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 506D8C21F1B for ; Wed, 13 Dec 2017 07:22:20 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Mw-00073A-QZ; Wed, 13 Dec 2017 08:22:18 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:26 +0100 Message-Id: <20171213071946.6181-58-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 58/78] 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 --- v1 -> v2: None --- drivers/mtd/cfi_flash.c | 238 ++++++++++++++++++++++++------------------------ 1 file changed, 118 insertions(+), 120 deletions(-) -- 2.13.6 diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 88c47cad90..347382f529 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) { } @@ -329,7 +329,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 @@ -363,19 +363,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: @@ -386,8 +386,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); @@ -408,8 +408,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; @@ -456,8 +456,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; @@ -489,8 +489,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; @@ -544,12 +544,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; @@ -565,7 +565,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; @@ -586,8 +586,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; @@ -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, - ulong tout, char *prompt) + ulong tout, char *prompt) { int retcode; @@ -614,10 +614,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"); @@ -765,7 +765,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)) /* @@ -781,8 +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, - cfiword_t cword) +static int flash_write_cfiword(flash_info_t *info, ulong dest, cfiword_t cword) { void *dstaddr = (void *)dest; int flag; @@ -870,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, - int len) + int len) { flash_sect_t sector; int cnt; @@ -946,8 +945,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 @@ -978,7 +977,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"); @@ -1074,7 +1073,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'); } @@ -1117,11 +1116,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: @@ -1131,7 +1130,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: @@ -1145,7 +1144,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; } @@ -1212,14 +1211,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: @@ -1247,21 +1246,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); } @@ -1274,13 +1272,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'); @@ -1446,7 +1444,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" :) @@ -1487,15 +1485,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: @@ -1516,7 +1514,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) { @@ -1530,29 +1528,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, @@ -1580,7 +1578,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; @@ -1604,7 +1602,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; @@ -1622,7 +1620,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; @@ -1667,7 +1665,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); @@ -1684,8 +1682,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 @@ -1708,7 +1706,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; @@ -1724,11 +1722,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); @@ -1736,11 +1734,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); @@ -1821,7 +1819,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 { @@ -1830,9 +1828,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; @@ -1869,8 +1867,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; @@ -1904,22 +1902,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; @@ -2051,11 +2049,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; @@ -2118,7 +2116,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 @@ -2157,12 +2155,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; @@ -2177,7 +2175,7 @@ ulong flash_get_size(phys_addr_t base, int banknum) for (i = 0; i < num_erase_regions; i++) { 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; } @@ -2221,8 +2219,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; @@ -2332,25 +2330,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) @@ -2358,9 +2356,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 } @@ -2396,8 +2394,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 @@ -2441,10 +2439,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 Wed Dec 13 07:19: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: 847876 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxV5b3mWNz9sBZ for ; Wed, 13 Dec 2017 19:21:23 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 00CF6C21E7B; Wed, 13 Dec 2017 07:44: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=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 58347C21E43; Wed, 13 Dec 2017 07:30:23 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 1D87DC21DBB; Wed, 13 Dec 2017 07:22:34 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 63B2CC21F06 for ; Wed, 13 Dec 2017 07:22:23 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1N0-00073A-W3; Wed, 13 Dec 2017 08:22:23 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:27 +0100 Message-Id: <20171213071946.6181-59-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 59/78] 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 --- v1 -> v2: None --- drivers/mtd/cfi_flash.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.13.6 diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 347382f529..da44e6184e 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 Wed Dec 13 07:19: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: 847887 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxVC3454Kz9s9Y for ; Wed, 13 Dec 2017 19:26:07 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 07477C21F22; Wed, 13 Dec 2017 07:46: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=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 1DBD8C21E8E; Wed, 13 Dec 2017 07:33:07 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 64E1DC21E68; Wed, 13 Dec 2017 07:22:34 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 8B444C21F07 for ; Wed, 13 Dec 2017 07:22:23 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1N1-00073A-61; Wed, 13 Dec 2017 08:22:23 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:28 +0100 Message-Id: <20171213071946.6181-60-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 60/78] 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 --- v1 -> v2: None --- drivers/mtd/cfi_flash.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) -- 2.13.6 diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index da44e6184e..e5509fe353 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -2461,27 +2461,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 Wed Dec 13 07:19: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: 847847 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxThg2RpSz9s9Y for ; Wed, 13 Dec 2017 19:03:15 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id CEF57C21E76; Wed, 13 Dec 2017 07:49: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=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 70BB4C21EB4; Wed, 13 Dec 2017 07:36:53 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BA6E3C21E30; Wed, 13 Dec 2017 07:22:37 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 54153C21F27 for ; Wed, 13 Dec 2017 07:22:28 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1N5-00073A-BF; Wed, 13 Dec 2017 08:22:27 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:29 +0100 Message-Id: <20171213071946.6181-61-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 61/78] 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 --- v1 -> v2: None --- drivers/gpio/mpc85xx_gpio.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) -- 2.13.6 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 Wed Dec 13 07:19: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: 847883 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxV8S6fxpz9s71 for ; Wed, 13 Dec 2017 19:23:52 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 0D181C21F09; Wed, 13 Dec 2017 07:44:20 +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=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 D8C1FC21DF7; Wed, 13 Dec 2017 07:30:11 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id F16FDC21DA9; Wed, 13 Dec 2017 07:22:37 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 01695C21F20 for ; Wed, 13 Dec 2017 07:22:28 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1N5-00073A-GJ; Wed, 13 Dec 2017 08:22:27 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:30 +0100 Message-Id: <20171213071946.6181-62-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 62/78] 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 --- v1 -> v2: None --- 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%) -- 2.13.6 diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index 201d7bfff9..0204958a8a 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -38,7 +38,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 Wed Dec 13 07:19: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: 847862 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTzW0W8Jz9s9Y for ; Wed, 13 Dec 2017 19:16:06 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 52FF8C21F01; Wed, 13 Dec 2017 07:42: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=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 48D6CC21DAA; Wed, 13 Dec 2017 07:26:13 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5FD2EC21F40; Wed, 13 Dec 2017 07:22:38 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id AE2CAC21DE6 for ; Wed, 13 Dec 2017 07:22:32 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1N9-00073A-Mh; Wed, 13 Dec 2017 08:22:31 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:31 +0100 Message-Id: <20171213071946.6181-63-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 63/78] 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 --- v1 -> v2: None --- 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(-) -- 2.13.6 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 2acb33bb51..c04f2edef6 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -276,11 +276,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. @@ -298,7 +298,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 0204958a8a..a79163bf3f 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -38,7 +38,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 Wed Dec 13 07:19: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: 847880 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxV6g2WFNz9s9Y for ; Wed, 13 Dec 2017 19:22:18 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 85FD4C21E9C; Wed, 13 Dec 2017 07:50: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=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 B1570C21F0B; Wed, 13 Dec 2017 07:38:56 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 97D4DC21F06; Wed, 13 Dec 2017 07:22:43 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 4DF31C21EDE for ; Wed, 13 Dec 2017 07:22:36 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1ND-00073A-Rs; Wed, 13 Dec 2017 08:22:35 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:32 +0100 Message-Id: <20171213071946.6181-64-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 64/78] 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 --- v1 -> v2: None --- drivers/gpio/mpc8xxx_gpio.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) -- 2.13.6 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 Wed Dec 13 07:19: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: 847860 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTv55Pynz9s9Y for ; Wed, 13 Dec 2017 19:12:17 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 863B0C21EE7; Wed, 13 Dec 2017 07:45: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=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 083B8C21ECC; Wed, 13 Dec 2017 07:32:09 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 61EA7C21F3E; Wed, 13 Dec 2017 07:22:43 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 95D1CC21F07 for ; Wed, 13 Dec 2017 07:22:36 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1NE-00073A-0h; Wed, 13 Dec 2017 08:22:36 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:33 +0100 Message-Id: <20171213071946.6181-65-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 65/78] 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 --- v1 -> v2: None --- arch/powerpc/include/asm/arch-mpc83xx/gpio.h | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.13.6 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 Wed Dec 13 07:19: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: 847861 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTvH50Ggz9sCZ for ; Wed, 13 Dec 2017 19:12:27 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 16683C21DDA; Wed, 13 Dec 2017 07:39:33 +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=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 9F9A8C21F07; Wed, 13 Dec 2017 07:24:09 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 93DE7C21E10; Wed, 13 Dec 2017 07:22:44 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 967B0C21DDF for ; Wed, 13 Dec 2017 07:22:40 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1NI-00073A-77; Wed, 13 Dec 2017 08:22:40 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:34 +0100 Message-Id: <20171213071946.6181-66-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 66/78] 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 --- v1 -> v2: None --- drivers/gpio/mpc8xxx_gpio.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) -- 2.13.6 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 Wed Dec 13 07:19: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: 847868 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxV301F8Rz9sBZ for ; Wed, 13 Dec 2017 19:19:08 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id A290FC21DDA; Wed, 13 Dec 2017 07:42: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=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 B5988C21E4B; Wed, 13 Dec 2017 07:26:56 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 7B103C21E65; Wed, 13 Dec 2017 07:22:49 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id B8EECC21E66 for ; Wed, 13 Dec 2017 07:22:40 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1NI-00073A-C8; Wed, 13 Dec 2017 08:22:40 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:35 +0100 Message-Id: <20171213071946.6181-67-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 67/78] 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 Acked-by: Joe Hershberger --- v1 -> v2: None --- cmd/mdio.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) -- 2.13.6 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 Wed Dec 13 07:19: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: 847878 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxV6Q5b0rz9t2M for ; Wed, 13 Dec 2017 19:22:03 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 28718C21E7B; Wed, 13 Dec 2017 07:49: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=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 A5860C21EE7; Wed, 13 Dec 2017 07:35:32 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 8E3BEC21E92; Wed, 13 Dec 2017 07:23:02 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id ED184C21DF3 for ; Wed, 13 Dec 2017 07:22:44 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1NM-00073A-IY; Wed, 13 Dec 2017 08:22:44 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:36 +0100 Message-Id: <20171213071946.6181-68-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 68/78] 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. Reviewed-by: Simon Glass Signed-off-by: Mario Six --- v1 -> v2: None --- common/board_f.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.13.6 diff --git a/common/board_f.c b/common/board_f.c index e46eceda7d..df589fd570 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -49,7 +49,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 @@ -136,7 +136,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; @@ -413,7 +413,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; } @@ -443,7 +443,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 Wed Dec 13 07:19: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: 847875 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxV5w5tHBz9t2M for ; Wed, 13 Dec 2017 19:21:30 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 9A487C21F1B; Wed, 13 Dec 2017 07:41: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=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 8C138C21F00; Wed, 13 Dec 2017 07:25:32 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 95049C21E37; Wed, 13 Dec 2017 07:23:02 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 4071EC21DAA for ; Wed, 13 Dec 2017 07:22:45 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1NM-00073A-Ne; Wed, 13 Dec 2017 08:22:44 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:37 +0100 Message-Id: <20171213071946.6181-69-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 69/78] 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. Reviewed-by: Simon Glass Signed-off-by: Mario Six --- v1 -> v2: None --- common/board_r.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) -- 2.13.6 diff --git a/common/board_r.c b/common/board_r.c index 09167c13cc..e304bb208e 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -157,9 +157,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 @@ -351,14 +351,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'); @@ -375,7 +377,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; @@ -627,7 +628,7 @@ int initr_mem(void) # ifdef CONFIG_PRAM pram = env_get_ulong("pram", 10, CONFIG_PRAM); # 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; @@ -680,7 +681,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. */ @@ -743,7 +744,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 Wed Dec 13 07:19: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: 847864 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxV1S1Svpz9sPm for ; Wed, 13 Dec 2017 19:17:47 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id B277AC21E44; Wed, 13 Dec 2017 07:48:38 +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=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 9D64EC21E78; Wed, 13 Dec 2017 07:35:20 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 700A5C21E4D; Wed, 13 Dec 2017 07:23:02 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id E7AEFC21DC8 for ; Wed, 13 Dec 2017 07:22:49 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1NQ-00073A-So; Wed, 13 Dec 2017 08:22:48 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:38 +0100 Message-Id: <20171213071946.6181-70-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 70/78] 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 --- v1 -> v2: None --- 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(-) -- 2.13.6 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 Wed Dec 13 07:19: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: 847866 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxV2f4BMzz9s9Y for ; Wed, 13 Dec 2017 19:18:50 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 0F498C21D9F; Wed, 13 Dec 2017 07:44:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=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 1F86AC21E97; Wed, 13 Dec 2017 07:31:36 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 04CE4C21E42; Wed, 13 Dec 2017 07:23:02 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id CB323C21F07 for ; Wed, 13 Dec 2017 07:22:53 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1NV-00073A-1j; Wed, 13 Dec 2017 08:22:53 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:39 +0100 Message-Id: <20171213071946.6181-71-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 71/78] 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 --- v1 -> v2: None --- 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(-) -- 2.13.6 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 Wed Dec 13 07:19: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: 847869 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxV356lGBz9sBZ for ; Wed, 13 Dec 2017 19:19:13 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id C7ECAC21F06; Wed, 13 Dec 2017 07:40: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=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 D3ADEC21F4B; Wed, 13 Dec 2017 07:24:20 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2C661C21E18; Wed, 13 Dec 2017 07:23:02 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 737DCC21F13 for ; Wed, 13 Dec 2017 07:22:54 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1NV-00073A-6x; Wed, 13 Dec 2017 08:22:53 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:40 +0100 Message-Id: <20171213071946.6181-72-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 72/78] 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 --- v1 -> v2: None --- board/gdsys/mpc8308/hrcon.c | 30 ++++++++++++++++++++++++++++++ board/gdsys/mpc8308/strider.c | 24 ++++++++++++++++++++++++ 2 files changed, 54 insertions(+) -- 2.13.6 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 Wed Dec 13 07:19: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: 847867 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxV2z75HSz9s9Y for ; Wed, 13 Dec 2017 19:19:07 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 4AC2EC21F10; Wed, 13 Dec 2017 07:48:19 +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=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 2F2FAC21D9F; Wed, 13 Dec 2017 07:34:15 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id AC536C21E39; Wed, 13 Dec 2017 07:23:04 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 40D6CC21DE6 for ; Wed, 13 Dec 2017 07:22:58 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1NZ-00073A-C7; Wed, 13 Dec 2017 08:22:57 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:41 +0100 Message-Id: <20171213071946.6181-73-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 73/78] 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 --- v1 -> v2: None --- board/gdsys/common/phy.c | 2 -- 1 file changed, 2 deletions(-) -- 2.13.6 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 Wed Dec 13 07:19: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: 847865 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxV1L5Vjdz9s9Y for ; Wed, 13 Dec 2017 19:17:31 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id E4168C21F0A; Wed, 13 Dec 2017 07:39: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=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 D22CBC21F32; Wed, 13 Dec 2017 07:24:16 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 39876C21E18; Wed, 13 Dec 2017 07:23:05 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id AE457C21F2B for ; Wed, 13 Dec 2017 07:22:58 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1NZ-00073A-IM; Wed, 13 Dec 2017 08:22:57 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:42 +0100 Message-Id: <20171213071946.6181-74-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 74/78] 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 Acked-by: Joe Hershberger --- v1 -> v2: * Fixed comment style according to Joe's comments --- drivers/net/phy/phy.c | 94 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 37 deletions(-) -- 2.13.6 diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index fd3dd556c8..c576d26b67 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); @@ -191,8 +189,10 @@ int genphy_config_aneg(struct phy_device *phydev) return result; if (result == 0) { - /* Advertisment hasn't changed, but maybe aneg was never on to - * begin with? Or maybe phy was isolated? */ + /* + * Advertisment hasn't changed, but maybe aneg was never on to + * begin with? Or maybe phy was isolated? + */ int ctl = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR); if (ctl < 0) @@ -202,8 +202,10 @@ int genphy_config_aneg(struct phy_device *phydev) result = 1; /* do restart aneg */ } - /* Only restart aneg if we are advertising something different - * than we were before. */ + /* + * Only restart aneg if we are advertising something different + * than we were before. + */ if (result > 0) result = genphy_restart_aneg(phydev); @@ -240,7 +242,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 +307,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 +341,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 @@ -577,7 +581,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) @@ -597,7 +603,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; @@ -619,12 +625,14 @@ 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 */ + /* + * We allocate the device, and initialize the + * 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; } @@ -662,8 +670,10 @@ 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 */ + /* + * Grab the bits from PHYIR1, and put them + * in the upper half + */ phy_reg = bus->read(bus, addr, devad, MII_PHYSID1); if (phy_reg < 0) @@ -683,9 +693,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); @@ -698,11 +710,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]; @@ -713,7 +727,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; @@ -725,7 +740,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) @@ -735,6 +750,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); } @@ -744,7 +760,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 * @@ -823,15 +840,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); @@ -847,8 +864,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); @@ -856,20 +873,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; @@ -877,7 +897,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 Wed Dec 13 07:19: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: 847836 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxTSY2TVgz9sPm for ; Wed, 13 Dec 2017 18:52:45 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id EAA81C21E14; Wed, 13 Dec 2017 07:46: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=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 0BEA2C21F64; Wed, 13 Dec 2017 07:33:23 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id AFFD2C21F4D; Wed, 13 Dec 2017 07:23:06 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 42DA5C21EFC for ; Wed, 13 Dec 2017 07:23:02 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Nd-00073A-NS; Wed, 13 Dec 2017 08:23:01 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:43 +0100 Message-Id: <20171213071946.6181-75-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 75/78] 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 --- v1 -> v2: None --- drivers/i2c/ihs_i2c.c | 69 +++++++++++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 29 deletions(-) -- 2.13.6 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 Wed Dec 13 07:19: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: 847881 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxV7v3D6Hz9sBZ for ; Wed, 13 Dec 2017 19:23:19 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 1A210C21EC8; Wed, 13 Dec 2017 07:47:18 +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=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 460F1C21F7E; Wed, 13 Dec 2017 07:33:25 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6B506C21F69; Wed, 13 Dec 2017 07:23:07 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id C37D9C21F0C for ; Wed, 13 Dec 2017 07:23:02 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Nd-00073A-SS; Wed, 13 Dec 2017 08:23:01 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:44 +0100 Message-Id: <20171213071946.6181-76-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 76/78] 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 --- v1 -> v2: * Use put_unaligned_le32 instead of manual buffer copying * Make driver live-tree compatible * Accomodated for FPGA handle changes in (not yet upstreamed) gdsys_soc driver --- drivers/i2c/ihs_i2c.c | 201 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 198 insertions(+), 3 deletions(-) -- 2.13.6 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 Wed Dec 13 07:19: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: 847863 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxV0L3dF8z9sPm for ; Wed, 13 Dec 2017 19:16:49 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 3A1FBC21E93; Wed, 13 Dec 2017 07:45: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=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 CE90BC21E9B; Wed, 13 Dec 2017 07:31:57 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B0BCCC21E2F; Wed, 13 Dec 2017 07:23:10 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id 892CAC21F13 for ; Wed, 13 Dec 2017 07:23:06 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Ni-00073A-1M; Wed, 13 Dec 2017 08:23:06 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:45 +0100 Message-Id: <20171213071946.6181-77-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 77/78] 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 --- v1 -> v2: None --- drivers/i2c/ihs_i2c.c | 50 ++++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 24 deletions(-) -- 2.13.6 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 Wed Dec 13 07:19: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: 847873 X-Patchwork-Delegate: mario.six@gdsys.cc 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 3yxV4b0vFKz9sCZ for ; Wed, 13 Dec 2017 19:20:30 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 66090C21F0A; Wed, 13 Dec 2017 07:48:01 +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=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 BEE31C21E88; Wed, 13 Dec 2017 07:33:57 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 97A56C21E88; Wed, 13 Dec 2017 07:23:15 +0000 (UTC) Received: from smtprelay08.ispgateway.de (smtprelay08.ispgateway.de [134.119.228.106]) by lists.denx.de (Postfix) with ESMTPS id AFB05C21F0A for ; Wed, 13 Dec 2017 07:23:10 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay08.ispgateway.de with esmtpa (Exim 4.89) (envelope-from ) id 1eP1Nm-00073A-6V; Wed, 13 Dec 2017 08:23:10 +0100 From: Mario Six To: U-Boot Mailing List , Wolfgang Denk , Dirk Eibach , Simon Glass , Heiko Schocher , Stefan Roese , Jagan Teki , Joe Hershberger Date: Wed, 13 Dec 2017 08:19:46 +0100 Message-Id: <20171213071946.6181-78-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171213071946.6181-1-mario.six@gdsys.cc> References: <20171213071946.6181-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 78/78] 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. Reviewed-by: Simon Glass Signed-off-by: Mario Six --- v1 -> v2: None --- drivers/clk/Makefile | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) -- 2.13.6 diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index bcc8f82fb6..2e64969560 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_STM32F) += clk_stm32f.o +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_STM32H7) += clk_stm32h7.o