mips: bmips: add SPI support
Subsystems (22)
PATCH v8 2/12 wait_bit: use wait_for_bit_le32 and remove wait_for_bit
In reply to Álvaro Fernández Rojaswait_for_bit callers use the 32 bit LE version
---
v8: Introduce changes suggested by Jagan Teki & Daniel Schwierzeck:
- Squash wait_bit commits.
- Remove register param castings.
v7: Introduce changes suggested by Jagan Teki:
- Remove wait_for_bit and update callers to wait_for_bit_le32.
arch/arm/mach-imx/mx6/ddr.c | 22 ++++----- arch/arm/mach-socfpga/clock_manager.c | 4 +- arch/arm/mach-socfpga/clock_manager_gen5.c | 6 +-- arch/arm/mach-socfpga/reset_manager_arria10.c | 36 +++++++-------- arch/mips/mach-ath79/ar934x/clk.c | 2 +- board/samtec/vining_2000/vining_2000.c | 4 +- drivers/clk/clk_pic32.c | 12 ++--- drivers/clk/renesas/clk-rcar-gen3.c | 4 +- drivers/ddr/microchip/ddr2.c | 8 ++-- drivers/fpga/socfpga_arria10.c | 17 +++---- drivers/mmc/msm_sdhci.c | 8 ++-- drivers/mtd/pic32_flash.c | 4 +- drivers/net/ag7xxx.c | 16 +++---- drivers/net/dwc_eth_qos.c | 17 +++---- drivers/net/ethoc.c | 8 ++-- drivers/net/pic32_eth.c | 12 ++--- drivers/net/pic32_mdio.c | 28 ++++++------ drivers/net/ravb.c | 4 +- drivers/net/xilinx_axi_emac.c | 4 +- drivers/net/zynq_gem.c | 12 ++--- drivers/reset/sti-reset.c | 4 +- drivers/serial/serial_pic32.c | 4 +- drivers/spi/atmel_spi.c | 4 +- drivers/spi/cadence_qspi_apb.c | 14 +++--- drivers/spi/fsl_qspi.c | 20 ++++----- drivers/spi/mvebu_a3700_spi.c | 20 +++++---- drivers/usb/host/dwc2.c | 24 +++++----- drivers/usb/host/ehci-msm.c | 3 +- drivers/usb/host/ehci-mx6.c | 5 +-- drivers/usb/host/ohci-lpc32xx.c | 12 ++--- drivers/usb/host/xhci-rcar.c | 12 ++--- drivers/video/atmel_hlcdfb.c | 64 +++++++++++++-------------- include/wait_bit.h | 54 ---------------------- 33 files changed, 205 insertions(+), 263 deletions(-)
arch/arm/mach-imx/mx6/ddr.c +11 -11
@@ -21,10 +21,10 @@ static void reset_read_data_fifos(void)/* Reset data FIFOs twice. */ setbits_le32 (&mmdc0->mpdgctrl0,1 <<31 ); -wait_for_bit ("MMDC" , &mmdc0->mpdgctrl0,1 <<31 ,0 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mpdgctrl0,1 <<31 ,0 ,100 ,0 );setbits_le32 (&mmdc0->mpdgctrl0,1 <<31 ); -wait_for_bit ("MMDC" , &mmdc0->mpdgctrl0,1 <<31 ,0 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mpdgctrl0,1 <<31 ,0 ,100 ,0 ); }static void precharge_all (const bool cs0_enable,const bool cs1_enable)
@@ -39,12 +39,12 @@ static void precharge_all(const bool cs0_enable, const bool cs1_enable)*/ if (cs0_enable) {/* CS0 */ writel (0x04008050 , &mmdc0->mdscr); -wait_for_bit ("MMDC" , &mmdc0->mdscr,1 <<14 ,1 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mdscr,1 <<14 ,1 ,100 ,0 ); }if (cs1_enable) {/* CS1 */ writel (0x04008058 , &mmdc0->mdscr); -wait_for_bit ("MMDC" , &mmdc0->mdscr,1 <<14 ,1 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mdscr,1 <<14 ,1 ,100 ,0 ); } }
@@ -146,7 +146,7 @@ int mmdc_do_write_level_calibration(struct mx6_ddr_sysinfo const *sysinfo)* 7. Upon completion of this process the MMDC de-asserts * the MPWLGCR[HW_WL_EN] */ -wait_for_bit ("MMDC" , &mmdc0->mpwlgcr,1 <<0 ,0 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mpwlgcr,1 <<0 ,0 ,100 ,0 );/* * 8. check for any errors: check both PHYs for x64 configuration,
@@ -278,7 +278,7 @@ int mmdc_do_dqs_calibration(struct mx6_ddr_sysinfo const *sysinfo)writel (0x00008028 , &mmdc0->mdscr);/* poll to make sure the con_ack bit was asserted */ -wait_for_bit ("MMDC" , &mmdc0->mdscr,1 <<14 ,1 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mdscr,1 <<14 ,1 ,100 ,0 );/* * Check MDMISC register CALIB_PER_CS to see which CS calibration
@@ -312,7 +312,7 @@ int mmdc_do_dqs_calibration(struct mx6_ddr_sysinfo const *sysinfo)* this bit until it clears to indicate completion of the write access. */ setbits_le32 (&mmdc0->mpswdar0,1 ); -wait_for_bit ("MMDC" , &mmdc0->mpswdar0,1 <<0 ,0 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mpswdar0,1 <<0 ,0 ,100 ,0 );/* Set the RD_DL_ABS# bits to their default values * (will be calibrated later in the read delay-line calibration).
@@ -359,7 +359,7 @@ int mmdc_do_dqs_calibration(struct mx6_ddr_sysinfo const *sysinfo)setbits_le32 (&mmdc0->mpdgctrl0,5 <<28 );/* Poll for completion. MPDGCTRL0[HW_DG_EN] should be 0 */ -wait_for_bit ("MMDC" , &mmdc0->mpdgctrl0,1 <<28 ,0 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mpdgctrl0,1 <<28 ,0 ,100 ,0 );/* * Check to see if any errors were encountered during calibration
@@ -423,7 +423,7 @@ int mmdc_do_dqs_calibration(struct mx6_ddr_sysinfo const *sysinfo)* setting MPRDDLHWCTL[HW_RD_DL_EN] = 0. Also, ensure that * no error bits were set. */ -wait_for_bit ("MMDC" , &mmdc0->mprddlhwctl,1 <<4 ,0 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mprddlhwctl,1 <<4 ,0 ,100 ,0 );/* check both PHYs for x64 configuration, if x32, check only PHY0 */ if (readl (&mmdc0->mprddlhwctl) &0x0000000f )
@@ -477,7 +477,7 @@ int mmdc_do_dqs_calibration(struct mx6_ddr_sysinfo const *sysinfo)* by setting MPWRDLHWCTL[HW_WR_DL_EN] = 0. * Also, ensure that no error bits were set. */ -wait_for_bit ("MMDC" , &mmdc0->mpwrdlhwctl,1 <<4 ,0 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mpwrdlhwctl,1 <<4 ,0 ,100 ,0 );/* Check both PHYs for x64 configuration, if x32, check only PHY0 */ if (readl (&mmdc0->mpwrdlhwctl) &0x0000000f )
@@ -526,7 +526,7 @@ int mmdc_do_dqs_calibration(struct mx6_ddr_sysinfo const *sysinfo)writel (0x0 , &mmdc0->mdscr);/* CS0 */ /* Poll to make sure the con_ack bit is clear */ -wait_for_bit ("MMDC" , &mmdc0->mdscr,1 <<14 ,0 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mdscr,1 <<14 ,0 ,100 ,0 );/* * Print out the registers that were updated as a result
arch/arm/mach-socfpga/clock_manager.c +2 -2
@@ -37,8 +37,8 @@ void cm_wait_for_lock(u32 mask)/* function to poll in the fsm busy bit */ int cm_wait_for_fsm (void ) { -return wait_for_bit (__func__, (const u32 *)&clock_manager_base->stat, -CLKMGR_STAT_BUSY , false,20000 , false); +return wait_for_bit_le32 (&clock_manager_base->stat, +CLKMGR_STAT_BUSY , false,20000 , false); }int set_cpu_clk_info (void )
arch/arm/mach-socfpga/clock_manager_gen5.c +2 -4
@@ -37,15 +37,13 @@ static int cm_write_with_phase(u32 value, u32 reg_address, u32 mask)int ret;/* poll until phase is zero */ - ret =wait_for_bit (__func__, (const u32 *)reg_address, mask, - false,20000 , false); + ret =wait_for_bit_le32 (reg_address, mask, false,20000 , false);if (ret)return ret;writel (value, reg_address); -return wait_for_bit (__func__, (const u32 *)reg_address, mask, - false,20000 , false); +return wait_for_bit_le32 (reg_address, mask, false,20000 , false); }/*
arch/arm/mach-socfpga/reset_manager_arria10.c +18 -18
@@ -222,8 +222,8 @@ int socfpga_reset_deassert_bridges_handoff(void)clrbits_le32 (&reset_manager_base->brgmodrst, mask_rstmgr);/* Poll until all idleack to 0, timeout at 1000ms */ -return wait_for_bit (__func__, &sysmgr_regs->noc_idleack, mask_noc, - false,1000 , false); +return wait_for_bit_le32 (&sysmgr_regs->noc_idleack, mask_noc, + false,1000 , false); }void socfpga_reset_assert_fpga_connected_peripherals (void )
@@ -343,26 +343,26 @@ int socfpga_bridges_reset(void)writel (ALT_SYSMGR_NOC_TMO_EN_SET_MSK , &sysmgr_regs->noc_timeout);/* Poll until all idleack to 1 */ - ret =wait_for_bit (__func__, &sysmgr_regs->noc_idleack, -ALT_SYSMGR_NOC_H2F_SET_MSK | -ALT_SYSMGR_NOC_LWH2F_SET_MSK | -ALT_SYSMGR_NOC_F2H_SET_MSK | -ALT_SYSMGR_NOC_F2SDR0_SET_MSK | -ALT_SYSMGR_NOC_F2SDR1_SET_MSK | -ALT_SYSMGR_NOC_F2SDR2_SET_MSK , - true,10000 , false); + ret =wait_for_bit_le32 (&sysmgr_regs->noc_idleack, +ALT_SYSMGR_NOC_H2F_SET_MSK | +ALT_SYSMGR_NOC_LWH2F_SET_MSK | +ALT_SYSMGR_NOC_F2H_SET_MSK | +ALT_SYSMGR_NOC_F2SDR0_SET_MSK | +ALT_SYSMGR_NOC_F2SDR1_SET_MSK | +ALT_SYSMGR_NOC_F2SDR2_SET_MSK , + true,10000 , false);if (ret)return ret;/* Poll until all idlestatus to 1 */ - ret =wait_for_bit (__func__, &sysmgr_regs->noc_idlestatus, -ALT_SYSMGR_NOC_H2F_SET_MSK | -ALT_SYSMGR_NOC_LWH2F_SET_MSK | -ALT_SYSMGR_NOC_F2H_SET_MSK | -ALT_SYSMGR_NOC_F2SDR0_SET_MSK | -ALT_SYSMGR_NOC_F2SDR1_SET_MSK | -ALT_SYSMGR_NOC_F2SDR2_SET_MSK , - true,10000 , false); + ret =wait_for_bit_le32 (&sysmgr_regs->noc_idlestatus, +ALT_SYSMGR_NOC_H2F_SET_MSK | +ALT_SYSMGR_NOC_LWH2F_SET_MSK | +ALT_SYSMGR_NOC_F2H_SET_MSK | +ALT_SYSMGR_NOC_F2SDR0_SET_MSK | +ALT_SYSMGR_NOC_F2SDR1_SET_MSK | +ALT_SYSMGR_NOC_F2SDR2_SET_MSK , + true,10000 , false);if (ret)return ret;
arch/mips/mach-ath79/ar934x/clk.c +1 -1
@@ -90,7 +90,7 @@ static void ar934x_srif_pll_cfg(void __iomem *pll_reg_base, const u32 srif_val)setbits_be32 (pll_reg_base +0x8 ,BIT (30 ));udelay (5 ); -wait_for_bit ("clk" , pll_reg_base +0xc ,BIT (3 ),1 ,10 ,0 ); +wait_for_bit_le32 (pll_reg_base +0xc ,BIT (3 ),1 ,10 ,0 );clrbits_be32 (pll_reg_base +0x8 ,BIT (30 ));udelay (5 );
board/samtec/vining_2000/vining_2000.c +2 -2
@@ -378,7 +378,7 @@ static int read_adc(u32 *val)/* start auto calibration */ setbits_le32 (b + ADCx_GC, ADCx_GC_CAL); - ret =wait_for_bit ("ADC" , b + ADCx_GC, ADCx_GC_CAL, ADCx_GC_CAL,10 ,0 ); + ret =wait_for_bit_le32 (b + ADCx_GC, ADCx_GC_CAL, ADCx_GC_CAL,10 ,0 );if (ret) goto adc_exit;
@@ -386,7 +386,7 @@ static int read_adc(u32 *val)writel (0 , b + ADCx_HC0);/* wait for conversion */ - ret =wait_for_bit ("ADC" , b + ADCx_HS, ADCx_HS_C0, ADCx_HS_C0,10 ,0 ); + ret =wait_for_bit_le32 (b + ADCx_HS, ADCx_HS_C0, ADCx_HS_C0,10 ,0 );if (ret) goto adc_exit;
drivers/clk/clk_pic32.c +6 -6
@@ -197,8 +197,8 @@ static ulong pic32_set_refclk(struct pic32_clk_priv *priv, int periph,writel (REFO_ON |REFO_OE , reg + _CLR_OFFSET);/* wait till previous src change is active */ -wait_for_bit (__func__, reg,REFO_DIVSW_EN |REFO_ACTIVE , - false,CONFIG_SYS_HZ , false); +wait_for_bit_le32 (reg,REFO_DIVSW_EN |REFO_ACTIVE , + false,CONFIG_SYS_HZ , false);/* parent_id */ v =readl (reg);
@@ -223,8 +223,8 @@ static ulong pic32_set_refclk(struct pic32_clk_priv *priv, int periph,writel (REFO_DIVSW_EN , reg + _SET_OFFSET);/* wait for divider switching to complete */ -return wait_for_bit (__func__, reg,REFO_DIVSW_EN , false, -CONFIG_SYS_HZ , false); +return wait_for_bit_le32 (reg,REFO_DIVSW_EN , false, +CONFIG_SYS_HZ , false); }static ulong pic32_get_refclk (struct pic32_clk_priv *priv,int periph)
@@ -311,8 +311,8 @@ static int pic32_mpll_init(struct pic32_clk_priv *priv)/* Wait for ready */ mask =MPLL_RDY |MPLL_VREG_RDY ; -return wait_for_bit (__func__, priv->syscfg_base +CFGMPLL , mask, - true,get_tbclk (), false); +return wait_for_bit_le32 (priv->syscfg_base +CFGMPLL , mask, + true,get_tbclk (), false); }static void pic32_clk_init (struct udevice *dev)
drivers/clk/renesas/clk-rcar-gen3.c +2 -2
@@ -1046,8 +1046,8 @@ static int gen3_clk_endisable(struct clk *clk, bool enable)if (ret)return ret;clrbits_le32 (priv->base +SMSTPCR (reg), bitmask); -return wait_for_bit ("MSTP" , priv->base +MSTPSR (reg), - bitmask,0 ,100 ,0 ); +return wait_for_bit_le32 (priv->base +MSTPSR (reg), + bitmask,0 ,100 ,0 ); }else {setbits_le32 (priv->base +SMSTPCR (reg), bitmask);return 0 ;
drivers/ddr/microchip/ddr2.c +4 -4
@@ -57,8 +57,8 @@ static int ddr2_phy_calib_start(void)writel (SCL_START |SCL_EN , &ddr2_phy->scl_start);/* Wait for SCL for data byte to pass */ -return wait_for_bit (__func__, &ddr2_phy->scl_start,SCL_LUBPASS , - true,CONFIG_SYS_HZ , false); +return wait_for_bit_le32 (&ddr2_phy->scl_start,SCL_LUBPASS , + true,CONFIG_SYS_HZ , false); }/* DDR2 Controller initialization */
@@ -256,8 +256,8 @@ void ddr2_ctrl_init(void)writel (INIT_START , &ctrl->memcon);/* wait for all host cmds to be transmitted */ -wait_for_bit (__func__, &ctrl->cmdissue,CMD_VALID , false, -CONFIG_SYS_HZ , false); +wait_for_bit_le32 (&ctrl->cmdissue,CMD_VALID , false, +CONFIG_SYS_HZ , false);/* inform all cmds issued, ready for normal operation */ writel (INIT_START |INIT_DONE , &ctrl->memcon);
drivers/fpga/socfpga_arria10.c +7 -10
@@ -62,8 +62,7 @@ int is_fpgamgr_user_mode(void)static int wait_for_user_mode (void ) { -return wait_for_bit (__func__, - &fpga_manager_base->imgcfg_stat, +return wait_for_bit_le32 (&fpga_manager_base->imgcfg_stat,ALT_FPGAMGR_IMGCFG_STAT_F2S_USERMODE_SET_MSK ,1 ,FPGA_TIMEOUT_MSEC , false); }
@@ -115,19 +114,17 @@ static int wait_for_nconfig_pin_and_nstatus_pin(void)/* Poll until f2s_nconfig_pin and f2s_nstatus_pin; loop until de-asserted, * timeout at 1000ms */ -return wait_for_bit (__func__, - &fpga_manager_base->imgcfg_stat, - mask, - false,FPGA_TIMEOUT_MSEC , false); +return wait_for_bit_le32 (&fpga_manager_base->imgcfg_stat, + mask, + false,FPGA_TIMEOUT_MSEC , false); }static int wait_for_f2s_nstatus_pin (unsigned long value) {/* Poll until f2s to specific value, timeout at 1000ms */ -return wait_for_bit (__func__, - &fpga_manager_base->imgcfg_stat, -ALT_FPGAMGR_IMGCFG_STAT_F2S_NSTATUS_PIN_SET_MSK , - value,FPGA_TIMEOUT_MSEC , false); +return wait_for_bit_le32 (&fpga_manager_base->imgcfg_stat, +ALT_FPGAMGR_IMGCFG_STAT_F2S_NSTATUS_PIN_SET_MSK , + value,FPGA_TIMEOUT_MSEC , false); }/* set CD ratio */
drivers/mmc/msm_sdhci.c +4 -4
@@ -109,15 +109,15 @@ static int msm_sdc_probe(struct udevice *dev)/* Wait for reset to be written to register */ -if (wait_for_bit (__func__, prv->base +SDCC_MCI_STATUS2 , -SDCC_MCI_STATUS2_MCI_ACT , false,10 , false)) { +if (wait_for_bit_le32 (prv->base +SDCC_MCI_STATUS2 , +SDCC_MCI_STATUS2_MCI_ACT , false,10 , false)) {printf ("msm_sdhci: reset request failed\n" );return -EIO ; }/* SW reset can take upto 10HCLK + 15MCLK cycles. (min 40us) */ -if (wait_for_bit (__func__, prv->base +SDCC_MCI_POWER , -SDCC_MCI_POWER_SW_RST , false,2 , false)) { +if (wait_for_bit_le32 (prv->base +SDCC_MCI_POWER , +SDCC_MCI_POWER_SW_RST , false,2 , false)) {printf ("msm_sdhci: stuck in reset\n" );return -ETIMEDOUT ; }
drivers/mtd/pic32_flash.c +2 -2
@@ -66,8 +66,8 @@ static inline void flash_initiate_operation(u32 nvmop)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); +int ret =wait_for_bit_le32 (&nvm_regs_p->ctrl.raw, +NVM_WR , false, timeout, false);return ret ?ERR_TIMOUT :ERR_OK ; }
drivers/net/ag7xxx.c +8 -8
@@ -164,8 +164,8 @@ static int ag7xxx_switch_read(struct mii_dev *bus, int addr, int reg, u16 *val)writel (AG7XXX_ETH_MII_MGMT_CMD_READ , regs +AG7XXX_ETH_MII_MGMT_CMD ); - ret =wait_for_bit ("ag7xxx" , regs +AG7XXX_ETH_MII_MGMT_IND , -AG7XXX_ETH_MII_MGMT_IND_BUSY ,0 ,1000 ,0 ); + ret =wait_for_bit_le32 (regs +AG7XXX_ETH_MII_MGMT_IND , +AG7XXX_ETH_MII_MGMT_IND_BUSY ,0 ,1000 ,0 );if (ret)return ret;
@@ -185,8 +185,8 @@ static int ag7xxx_switch_write(struct mii_dev *bus, int addr, int reg, u16 val) regs + AG7XXX_ETH_MII_MGMT_ADDRESS);writel (val, regs +AG7XXX_ETH_MII_MGMT_CTRL ); - ret =wait_for_bit ("ag7xxx" , regs +AG7XXX_ETH_MII_MGMT_IND , -AG7XXX_ETH_MII_MGMT_IND_BUSY ,0 ,1000 ,0 ); + ret =wait_for_bit_le32 (regs +AG7XXX_ETH_MII_MGMT_IND , +AG7XXX_ETH_MII_MGMT_IND_BUSY ,0 ,1000 ,0 );return ret; }
@@ -510,13 +510,13 @@ static void ag7xxx_eth_stop(struct udevice *dev)/* Stop the TX DMA. */ writel (0 , priv->regs +AG7XXX_ETH_DMA_TX_CTRL ); -wait_for_bit ("ag7xxx" , priv->regs +AG7XXX_ETH_DMA_TX_CTRL , ~0 ,0 , -1000 ,0 ); +wait_for_bit_le32 (priv->regs +AG7XXX_ETH_DMA_TX_CTRL , ~0 ,0 , +1000 ,0 );/* Stop the RX DMA. */ writel (0 , priv->regs +AG7XXX_ETH_DMA_RX_CTRL ); -wait_for_bit ("ag7xxx" , priv->regs +AG7XXX_ETH_DMA_RX_CTRL , ~0 ,0 , -1000 ,0 ); +wait_for_bit_le32 (priv->regs +AG7XXX_ETH_DMA_RX_CTRL , ~0 ,0 , +1000 ,0 ); }/*
drivers/net/dwc_eth_qos.c +9 -8
@@ -361,8 +361,9 @@ static void eqos_flush_buffer(void *buf, size_t size)static int eqos_mdio_wait_idle (struct eqos_priv *eqos) { -return wait_for_bit (__func__, &eqos->mac_regs->mdio_address, -EQOS_MAC_MDIO_ADDRESS_GB , false,1000000 , true); +return wait_for_bit_le32 (&eqos->mac_regs->mdio_address, +EQOS_MAC_MDIO_ADDRESS_GB , false, +1000000 , true); } static int eqos_mdio_read(struct mii_dev *bus, int mdio_addr, int mdio_devad,
@@ -588,15 +589,15 @@ static int eqos_calibrate_pads_tegra186(struct udevice *dev)setbits_le32 (&eqos->tegra186_regs->auto_cal_config,EQOS_AUTO_CAL_CONFIG_START |EQOS_AUTO_CAL_CONFIG_ENABLE ); - ret =wait_for_bit (__func__, &eqos->tegra186_regs->auto_cal_status, -EQOS_AUTO_CAL_STATUS_ACTIVE , true,10 , false); + ret =wait_for_bit_le32 (&eqos->tegra186_regs->auto_cal_status, +EQOS_AUTO_CAL_STATUS_ACTIVE , true,10 , false);if (ret) {pr_err ("calibrate didn't start" ); goto failed; } - ret =wait_for_bit (__func__, &eqos->tegra186_regs->auto_cal_status, -EQOS_AUTO_CAL_STATUS_ACTIVE , false,10 , false); + ret =wait_for_bit_le32 (&eqos->tegra186_regs->auto_cal_status, +EQOS_AUTO_CAL_STATUS_ACTIVE , false,10 , false);if (ret) {pr_err ("calibrate didn't finish" ); goto failed;
@@ -862,8 +863,8 @@ static int eqos_start(struct udevice *dev) eqos->reg_access_ok = true; - ret =wait_for_bit (__func__, &eqos->dma_regs->mode, -EQOS_DMA_MODE_SWR , false,10 , false); + ret =wait_for_bit_le32 (&eqos->dma_regs->mode, +EQOS_DMA_MODE_SWR , false,10 , false);if (ret) {pr_err ("EQOS_DMA_MODE_SWR stuck" ); goto err_stop_resets;
drivers/net/ethoc.c +4 -4
@@ -548,8 +548,8 @@ static int ethoc_mdio_read(struct mii_dev *bus, int addr, int devad, int reg)ethoc_write (priv,MIIADDRESS ,MIIADDRESS_ADDR (addr, reg));ethoc_write (priv,MIICOMMAND ,MIICOMMAND_READ ); - rc =wait_for_bit (__func__,ethoc_reg (priv,MIISTATUS ), -MIISTATUS_BUSY , false,CONFIG_SYS_HZ , false); + rc =wait_for_bit_le32 (ethoc_reg (priv,MIISTATUS ), +MIISTATUS_BUSY , false,CONFIG_SYS_HZ , false);if (rc ==0 ) {u32 data =ethoc_read (priv,MIIRX_DATA );
@@ -571,8 +571,8 @@ static int ethoc_mdio_write(struct mii_dev *bus, int addr, int devad, int reg,ethoc_write (priv,MIITX_DATA , val);ethoc_write (priv,MIICOMMAND ,MIICOMMAND_WRITE ); - rc =wait_for_bit (__func__,ethoc_reg (priv,MIISTATUS ), -MIISTATUS_BUSY , false,CONFIG_SYS_HZ , false); + rc =wait_for_bit_le32 (ethoc_reg (priv,MIISTATUS ), +MIISTATUS_BUSY , false,CONFIG_SYS_HZ , false);if (rc ==0 ) {/* reset MII command register */
drivers/net/pic32_eth.c +6 -6
@@ -64,8 +64,8 @@ static int pic32_mii_init(struct pic32eth_dev *priv)writel (ETHCON_ON |ETHCON_TXRTS |ETHCON_RXEN , &ectl_p->con1.clr);/* wait till busy */ -wait_for_bit (__func__, &ectl_p->stat.raw,ETHSTAT_BUSY , false, -CONFIG_SYS_HZ , false); +wait_for_bit_le32 (&ectl_p->stat.raw,ETHSTAT_BUSY , false, +CONFIG_SYS_HZ , false);/* turn controller ON to access PHY over MII */ writel (ETHCON_ON , &ectl_p->con1.set);
@@ -239,8 +239,8 @@ static void pic32_ctrl_reset(struct pic32eth_dev *priv)writel (ETHCON_ON |ETHCON_TXRTS |ETHCON_RXEN , &ectl_p->con1.clr);/* wait till busy */ -wait_for_bit (__func__, &ectl_p->stat.raw,ETHSTAT_BUSY , false, -CONFIG_SYS_HZ , false); +wait_for_bit_le32 (&ectl_p->stat.raw,ETHSTAT_BUSY , false, +CONFIG_SYS_HZ , false);/* decrement received buffcnt to zero. */ while (readl (&ectl_p->stat.raw) ÐSTAT_BUFCNT )writel (ETHCON_BUFCDEC , &ectl_p->con1.set);
@@ -375,8 +375,8 @@ static void pic32_eth_stop(struct udevice *dev)mdelay (10 );/* wait until everything is down */ -wait_for_bit (__func__, &ectl_p->stat.raw,ETHSTAT_BUSY , false, -2 *CONFIG_SYS_HZ , false); +wait_for_bit_le32 (&ectl_p->stat.raw,ETHSTAT_BUSY , false, +2 *CONFIG_SYS_HZ , false);/* clear any existing interrupt event */ writel (0xffffffff , &ectl_p->irq.clr);
drivers/net/pic32_mdio.c +14 -14
@@ -22,8 +22,8 @@ static int pic32_mdio_write(struct mii_dev *bus,struct pic32_mii_regs *mii_regs = bus->priv;/* Wait for the previous operation to finish */ -wait_for_bit (__func__, &mii_regs->mind.raw,MIIMIND_BUSY , - false,CONFIG_SYS_HZ , true); +wait_for_bit_le32 (&mii_regs->mind.raw,MIIMIND_BUSY , + false,CONFIG_SYS_HZ , true);/* Put phyaddr and regaddr into MIIMADD */ v = (addr <<MIIMADD_PHYADDR_SHIFT ) | (reg &MIIMADD_REGADDR );
@@ -36,8 +36,8 @@ static int pic32_mdio_write(struct mii_dev *bus,udelay (12 );/* Wait for write to complete */ -wait_for_bit (__func__, &mii_regs->mind.raw,MIIMIND_BUSY , - false,CONFIG_SYS_HZ , true); +wait_for_bit_le32 (&mii_regs->mind.raw,MIIMIND_BUSY , + false,CONFIG_SYS_HZ , true);return 0 ; }
@@ -48,8 +48,8 @@ static int pic32_mdio_read(struct mii_dev *bus, int addr, int devaddr, int reg)struct pic32_mii_regs *mii_regs = bus->priv;/* Wait for the previous operation to finish */ -wait_for_bit (__func__, &mii_regs->mind.raw,MIIMIND_BUSY , - false,CONFIG_SYS_HZ , true); +wait_for_bit_le32 (&mii_regs->mind.raw,MIIMIND_BUSY , + false,CONFIG_SYS_HZ , true);/* Put phyaddr and regaddr into MIIMADD */ v = (addr <<MIIMADD_PHYADDR_SHIFT ) | (reg &MIIMADD_REGADDR );
@@ -62,9 +62,9 @@ static int pic32_mdio_read(struct mii_dev *bus, int addr, int devaddr, int reg)udelay (12 );/* Wait for read to complete */ -wait_for_bit (__func__, &mii_regs->mind.raw, -MIIMIND_NOTVALID |MIIMIND_BUSY , - false,CONFIG_SYS_HZ , false); +wait_for_bit_le32 (&mii_regs->mind.raw, +MIIMIND_NOTVALID |MIIMIND_BUSY , + false,CONFIG_SYS_HZ , false);/* Clear the command register */ writel (0 , &mii_regs->mcmd.raw);
@@ -82,22 +82,22 @@ static int pic32_mdio_reset(struct mii_dev *bus)writel (MIIMCFG_RSTMGMT , &mii_regs->mcfg.raw);/* Wait for the operation to finish */ -wait_for_bit (__func__, &mii_regs->mind.raw,MIIMIND_BUSY , +wait_for_bit_le32 (&mii_regs->mind.raw,MIIMIND_BUSY , false,CONFIG_SYS_HZ , true);/* Clear reset bit */ writel (0 , &mii_regs->mcfg);/* Wait for the operation to finish */ -wait_for_bit (__func__, &mii_regs->mind.raw,MIIMIND_BUSY , - false,CONFIG_SYS_HZ , true); +wait_for_bit_le32 (&mii_regs->mind.raw,MIIMIND_BUSY , + false,CONFIG_SYS_HZ , true);/* Set the MII Management Clock (MDC) - no faster than 2.5 MHz */ writel (MIIMCFG_CLKSEL_DIV40 , &mii_regs->mcfg.raw);/* Wait for the operation to finish */ -wait_for_bit (__func__, &mii_regs->mind.raw,MIIMIND_BUSY , - false,CONFIG_SYS_HZ , true); +wait_for_bit_le32 (&mii_regs->mind.raw,MIIMIND_BUSY , + false,CONFIG_SYS_HZ , true);return 0 ; }
drivers/net/ravb.c +2 -2
@@ -222,8 +222,8 @@ static int ravb_reset(struct udevice *dev)writel (CCC_OPC_CONFIG , eth->iobase +RAVB_REG_CCC );/* Check the operating mode is changed to the config mode. */ -return wait_for_bit (dev->name, (void *)eth->iobase +RAVB_REG_CSR , -CSR_OPS_CONFIG , true,100 , true); +return wait_for_bit_le32 (eth->iobase +RAVB_REG_CSR , +CSR_OPS_CONFIG , true,100 , true); }static void ravb_base_desc_init (struct ravb_priv *eth)
drivers/net/xilinx_axi_emac.c +2 -2
@@ -366,8 +366,8 @@ static int axi_ethernet_init(struct axidma_priv *priv)* processor mode and hence bypass in this mode */ if (!priv->eth_hasnobuf) { - err =wait_for_bit (__func__, (const u32 *)®s->is, -XAE_INT_MGTRDY_MASK , true,200 , false); + err =wait_for_bit_le32 (®s->is,XAE_INT_MGTRDY_MASK , + true,200 , false);if (err) {printf ("%s: Timeout\n" , __func__);return 1 ;
drivers/net/zynq_gem.c +6 -6
@@ -192,8 +192,8 @@ static u32 phy_setup_op(struct zynq_gem_priv *priv, u32 phy_addr, u32 regnum,struct zynq_gem_regs *regs = priv->iobase;int err; - err =wait_for_bit (__func__, ®s->nwsr,ZYNQ_GEM_NWSR_MDIOIDLE_MASK , - true,20000 , false); + err =wait_for_bit_le32 (®s->nwsr,ZYNQ_GEM_NWSR_MDIOIDLE_MASK , + true,20000 , false);if (err)return err;
@@ -205,8 +205,8 @@ static u32 phy_setup_op(struct zynq_gem_priv *priv, u32 phy_addr, u32 regnum,/* Write mgtcr and wait for completion */ writel (mgtcr, ®s->phymntnc); - err =wait_for_bit (__func__, ®s->nwsr,ZYNQ_GEM_NWSR_MDIOIDLE_MASK , - true,20000 , false); + err =wait_for_bit_le32 (®s->nwsr,ZYNQ_GEM_NWSR_MDIOIDLE_MASK , + true,20000 , false);if (err)return err;
@@ -514,8 +514,8 @@ static int zynq_gem_send(struct udevice *dev, void *ptr, int len)if (priv->tx_bd->status &ZYNQ_GEM_TXBUF_EXHAUSTED )printf ("TX buffers exhausted in mid frame\n" ); -return wait_for_bit (__func__, ®s->txsr,ZYNQ_GEM_TSR_DONE , - true,20000 , true); +return wait_for_bit_le32 (®s->txsr,ZYNQ_GEM_TSR_DONE , + true,20000 , true); }/* Do not check frame_recd flag in rx_status register 0x20 - just poll BD */
drivers/reset/sti-reset.c +2 -2
@@ -266,8 +266,8 @@ static int sti_reset_program_hw(struct reset_ctl *reset_ctl, int assert)return 0 ; reg = (void __iomem *)base + ch->ack_offset; -if (wait_for_bit (__func__, reg,BIT (ch->ack_bit), ctrl_val, -1000 , false)) { +if (wait_for_bit_le32 (reg,BIT (ch->ack_bit), ctrl_val, +1000 , false)) {pr_err ("Stuck on waiting ack reset_ctl=%p dev=%p id=%lu\n" , reset_ctl, reset_ctl->dev, reset_ctl->id);
drivers/serial/serial_pic32.c +2 -2
@@ -51,8 +51,8 @@ static int pic32_serial_init(void __iomem *base, ulong clk, u32 baudrate)u32 div =DIV_ROUND_CLOSEST (clk, baudrate *16 );/* wait for TX FIFO to empty */ -wait_for_bit (__func__, base +U_STA ,UART_TX_EMPTY , - true,CONFIG_SYS_HZ , false); +wait_for_bit_le32 (base +U_STA ,UART_TX_EMPTY , + true,CONFIG_SYS_HZ , false);/* send break */ writel (UART_TX_BRK , base +U_STASET );
drivers/spi/atmel_spi.c +2 -2
@@ -394,8 +394,8 @@ out:* Wait until the transfer is completely done before * we deactivate CS. */ -wait_for_bit (__func__, ®_base->sr, -ATMEL_SPI_SR_TXEMPTY , true,1000 , false); +wait_for_bit_le32 (®_base->sr, +ATMEL_SPI_SR_TXEMPTY , true,1000 , false);atmel_spi_cs_deactivate (dev); }
drivers/spi/cadence_qspi_apb.c +7 -7
@@ -675,8 +675,8 @@ int cadence_qspi_apb_indirect_read_execute(struct cadence_spi_platdata *plat, }/* Check indirect done status */ - ret =wait_for_bit ("QSPI" , plat->regbase +CQSPI_REG_INDIRECTRD , -CQSPI_REG_INDIRECTRD_DONE ,1 ,10 ,0 ); + ret =wait_for_bit_le32 (plat->regbase +CQSPI_REG_INDIRECTRD , +CQSPI_REG_INDIRECTRD_DONE ,1 ,10 ,0 );if (ret) {printf ("Indirect read completion error (%i)\n" , ret); goto failrd;
@@ -762,9 +762,9 @@ int cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat, bb_txbuf +rounddown (write_bytes,4 ), write_bytes % 4); - ret =wait_for_bit ("QSPI" , plat->regbase +CQSPI_REG_SDRAMLEVEL , -CQSPI_REG_SDRAMLEVEL_WR_MASK << -CQSPI_REG_SDRAMLEVEL_WR_LSB ,0 ,10 ,0 ); + ret =wait_for_bit_le32 (plat->regbase +CQSPI_REG_SDRAMLEVEL , +CQSPI_REG_SDRAMLEVEL_WR_MASK << +CQSPI_REG_SDRAMLEVEL_WR_LSB ,0 ,10 ,0 );if (ret) {printf ("Indirect write timed out (%i)\n" , ret); goto failwr;
@@ -775,8 +775,8 @@ int cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat, }/* Check indirect done status */ - ret =wait_for_bit ("QSPI" , plat->regbase +CQSPI_REG_INDIRECTWR , -CQSPI_REG_INDIRECTWR_DONE ,1 ,10 ,0 ); + ret =wait_for_bit_le32 (plat->regbase +CQSPI_REG_INDIRECTWR , +CQSPI_REG_INDIRECTWR_DONE ,1 ,10 ,0 );if (ret) {printf ("Indirect write completion error (%i)\n" , ret); goto failwr;
drivers/spi/fsl_qspi.c +10 -10
@@ -1011,11 +1011,11 @@ static int fsl_qspi_probe(struct udevice *bus) priv->num_chipselect = plat->num_chipselect;/* make sure controller is not busy anywhere */ - ret =wait_for_bit (__func__, &priv->regs->sr, -QSPI_SR_BUSY_MASK | -QSPI_SR_AHB_ACC_MASK | -QSPI_SR_IP_ACC_MASK , - false,100 , false); + ret =wait_for_bit_le32 (&priv->regs->sr, +QSPI_SR_BUSY_MASK | +QSPI_SR_AHB_ACC_MASK | +QSPI_SR_IP_ACC_MASK , + false,100 , false);if (ret) {debug ("ERROR : The controller is busy\n" );
@@ -1173,11 +1173,11 @@ static int fsl_qspi_claim_bus(struct udevice *dev) priv =dev_get_priv (bus);/* make sure controller is not busy anywhere */ - ret =wait_for_bit (__func__, &priv->regs->sr, -QSPI_SR_BUSY_MASK | -QSPI_SR_AHB_ACC_MASK | -QSPI_SR_IP_ACC_MASK , - false,100 , false); + ret =wait_for_bit_le32 (&priv->regs->sr, +QSPI_SR_BUSY_MASK | +QSPI_SR_AHB_ACC_MASK | +QSPI_SR_IP_ACC_MASK , + false,100 , false);if (ret) {debug ("ERROR : The controller is busy\n" );
drivers/spi/mvebu_a3700_spi.c +11 -9
@@ -95,8 +95,9 @@ static int spi_legacy_shift_byte(struct spi_reg *reg, unsigned int bytelen, din_8 = din;while (bytelen) { - ret =wait_for_bit (__func__, ®->ctrl, -MVEBU_SPI_A3700_XFER_RDY , true,100 , false); + ret =wait_for_bit_le32 (®->ctrl, +MVEBU_SPI_A3700_XFER_RDY , + true,100 , false);if (ret)return ret;
@@ -109,9 +110,9 @@ static int spi_legacy_shift_byte(struct spi_reg *reg, unsigned int bytelen,writel (pending_dout, ®->dout);if (din) { - ret =wait_for_bit (__func__, ®->ctrl, -MVEBU_SPI_A3700_XFER_RDY , - true,100 , false); + ret =wait_for_bit_le32 (®->ctrl, +MVEBU_SPI_A3700_XFER_RDY , + true,100 , false);if (ret)return ret;
@@ -160,8 +161,9 @@ static int mvebu_spi_xfer(struct udevice *dev, unsigned int bitlen,/* Deactivate CS */ if (flags &SPI_XFER_END ) { - ret =wait_for_bit (__func__, ®->ctrl, -MVEBU_SPI_A3700_XFER_RDY , true,100 , false); + ret =wait_for_bit_le32 (®->ctrl, +MVEBU_SPI_A3700_XFER_RDY , + true,100 , false);if (ret)return ret;
@@ -231,8 +233,8 @@ static int mvebu_spi_probe(struct udevice *bus)/* Flush read/write FIFO */ data =readl (®->cfg);writel (data |MVEBU_SPI_A3700_FIFO_FLUSH , ®->cfg); - ret =wait_for_bit (__func__, ®->cfg,MVEBU_SPI_A3700_FIFO_FLUSH , - false,1000 , false); + ret =wait_for_bit_le32 (®->cfg,MVEBU_SPI_A3700_FIFO_FLUSH , + false,1000 , false);if (ret)return ret;
drivers/usb/host/dwc2.c +12 -12
@@ -108,8 +108,8 @@ static void dwc_otg_flush_tx_fifo(struct dwc2_core_regs *regs, const int num)writel (DWC2_GRSTCTL_TXFFLSH | (num <<DWC2_GRSTCTL_TXFNUM_OFFSET ), ®s->grstctl); - ret =wait_for_bit (__func__, ®s->grstctl,DWC2_GRSTCTL_TXFFLSH , - false,1000 , false); + ret =wait_for_bit_le32 (®s->grstctl,DWC2_GRSTCTL_TXFFLSH , + false,1000 , false);if (ret)printf ("%s: Timeout!\n" , __func__);
@@ -127,8 +127,8 @@ static void dwc_otg_flush_rx_fifo(struct dwc2_core_regs *regs)int ret;writel (DWC2_GRSTCTL_RXFFLSH , ®s->grstctl); - ret =wait_for_bit (__func__, ®s->grstctl,DWC2_GRSTCTL_RXFFLSH , - false,1000 , false); + ret =wait_for_bit_le32 (®s->grstctl,DWC2_GRSTCTL_RXFFLSH , + false,1000 , false);if (ret)printf ("%s: Timeout!\n" , __func__);
@@ -145,15 +145,15 @@ static void dwc_otg_core_reset(struct dwc2_core_regs *regs)int ret;/* Wait for AHB master IDLE state. */ - ret =wait_for_bit (__func__, ®s->grstctl,DWC2_GRSTCTL_AHBIDLE , - true,1000 , false); + ret =wait_for_bit_le32 (®s->grstctl,DWC2_GRSTCTL_AHBIDLE , + true,1000 , false);if (ret)printf ("%s: Timeout!\n" , __func__);/* Core Soft Reset */ writel (DWC2_GRSTCTL_CSFTRST , ®s->grstctl); - ret =wait_for_bit (__func__, ®s->grstctl,DWC2_GRSTCTL_CSFTRST , - false,1000 , false); + ret =wait_for_bit_le32 (®s->grstctl,DWC2_GRSTCTL_CSFTRST , + false,1000 , false);if (ret)printf ("%s: Timeout!\n" , __func__);
@@ -267,8 +267,8 @@ static void dwc_otg_core_host_init(struct udevice *dev,clrsetbits_le32 (®s->hc_regs[i].hcchar,DWC2_HCCHAR_EPDIR ,DWC2_HCCHAR_CHEN |DWC2_HCCHAR_CHDIS ); - ret =wait_for_bit (__func__, ®s->hc_regs[i].hcchar, -DWC2_HCCHAR_CHEN , false,1000 , false); + ret =wait_for_bit_le32 (®s->hc_regs[i].hcchar, +DWC2_HCCHAR_CHEN , false,1000 , false);if (ret)printf ("%s: Timeout!\n" , __func__); }
@@ -783,8 +783,8 @@ int wait_for_chhltd(struct dwc2_hc_regs *hc_regs, uint32_t *sub, u8 *toggle)int ret;uint32_t hcint, hctsiz; - ret =wait_for_bit (__func__, &hc_regs->hcint,DWC2_HCINT_CHHLTD , true, -1000 , false); + ret =wait_for_bit_le32 (&hc_regs->hcint,DWC2_HCINT_CHHLTD , true, +1000 , false);if (ret)return ret;
drivers/usb/host/ehci-msm.c +1 -2
@@ -133,8 +133,7 @@ static int ehci_usb_remove(struct udevice *dev)setbits_le32 (&ehci->usbcmd,CMD_RESET );/* Wait for reset */ -if (wait_for_bit (__func__, &ehci->usbcmd,CMD_RESET , false,30 , - false)) { +if (wait_for_bit_le32 (&ehci->usbcmd,CMD_RESET , false,30 , false)) {printf ("Stuck on USB reset.\n" );return -ETIMEDOUT ; }
drivers/usb/host/ehci-mx6.c +2 -3
@@ -142,13 +142,12 @@ static int usb_phy_enable(int index, struct usb_ehci *ehci)/* Stop then Reset */ clrbits_le32 (usb_cmd,UCMD_RUN_STOP ); - ret =wait_for_bit (__func__, usb_cmd,UCMD_RUN_STOP , false,10000 , - false); + ret =wait_for_bit_le32 (usb_cmd,UCMD_RUN_STOP , false,10000 , false);if (ret)return ret;setbits_le32 (usb_cmd,UCMD_RESET ); - ret =wait_for_bit (__func__, usb_cmd,UCMD_RESET , false,10000 , false); + ret =wait_for_bit_le32 (usb_cmd,UCMD_RESET , false,10000 , false);if (ret)return ret;
drivers/usb/host/ohci-lpc32xx.c +6 -6
@@ -143,8 +143,8 @@ static int usbpll_setup(void)setbits_le32 (&clk_pwr->usb_ctrl,CLK_USBCTRL_POSTDIV_2POW (0x01 ));setbits_le32 (&clk_pwr->usb_ctrl,CLK_USBCTRL_PLL_PWRUP ); - ret =wait_for_bit (__func__, &clk_pwr->usb_ctrl,CLK_USBCTRL_PLL_STS , - true,CONFIG_SYS_HZ , false); + ret =wait_for_bit_le32 (&clk_pwr->usb_ctrl,CLK_USBCTRL_PLL_STS , + true,CONFIG_SYS_HZ , false);if (ret)return ret;
@@ -178,8 +178,8 @@ int usb_cpu_init(void)/* enable I2C clock */ writel (OTG_CLK_I2C_EN , &otg->otg_clk_ctrl); - ret =wait_for_bit (__func__, &otg->otg_clk_sts,OTG_CLK_I2C_EN , true, -CONFIG_SYS_HZ , false); + ret =wait_for_bit_le32 (&otg->otg_clk_sts,OTG_CLK_I2C_EN , true, +CONFIG_SYS_HZ , false);if (ret)return ret;
@@ -199,8 +199,8 @@ int usb_cpu_init(void)OTG_CLK_I2C_EN |OTG_CLK_HOST_EN ;writel (mask, &otg->otg_clk_ctrl); - ret =wait_for_bit (__func__, &otg->otg_clk_sts, mask, true, -CONFIG_SYS_HZ , false); + ret =wait_for_bit_le32 (&otg->otg_clk_sts, mask, true, +CONFIG_SYS_HZ , false);if (ret)return ret;
drivers/usb/host/xhci-rcar.c +6 -6
@@ -55,18 +55,18 @@ static int xhci_rcar_download_fw(struct rcar_xhci *ctx, const u32 *fw_data,setbits_le32 (regs +RCAR_USB3_DL_CTRL ,RCAR_USB3_DL_CTRL_FW_SET_DATA0 ); - ret =wait_for_bit ("xhci-rcar" , regs +RCAR_USB3_DL_CTRL , -RCAR_USB3_DL_CTRL_FW_SET_DATA0 , false, -10 , false); + ret =wait_for_bit_le32 (regs +RCAR_USB3_DL_CTRL , +RCAR_USB3_DL_CTRL_FW_SET_DATA0 , false, +10 , false);if (ret)break ; }clrbits_le32 (regs +RCAR_USB3_DL_CTRL ,RCAR_USB3_DL_CTRL_ENABLE ); - ret =wait_for_bit ("xhci-rcar" , regs +RCAR_USB3_DL_CTRL , -RCAR_USB3_DL_CTRL_FW_SUCCESS , true, -10 , false); + ret =wait_for_bit_le32 (regs +RCAR_USB3_DL_CTRL , +RCAR_USB3_DL_CTRL_FW_SUCCESS , true, +10 , false);return ret; }
drivers/video/atmel_hlcdfb.c +32 -32
136 lines not on this page · raw message
include/wait_bit.h +0 -54
60 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH v8 3/12 drivers: spi: allow limiting reads
In reply to Álvaro Fernández RojasFor some SPI controllers it's not possible to keep the CS active between transfers and they are limited to a known number of bytes. This splits spi_flash reads into different iterations in order to respect the SPI controller limits.
---
v8: no changes
v7: no changes
v6: no changes
v5: no changes
v4: no changes
v3: no changes
v2: no changes
drivers/mtd/spi/spi_flash.c | 3 +++ include/spi.h | 3 +++ 2 files changed, 6 insertions(+)
drivers/mtd/spi/spi_flash.c +3 -0
@@ -516,6 +516,9 @@ int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset,else read_len = remain_len; +if (spi->max_read_size) + read_len =min (read_len, spi->max_read_size); +spi_flash_addr (read_addr, cmd); ret =spi_flash_read_common (flash, cmd, cmdsz, data, read_len);
include/spi.h +3 -0
@@ -86,6 +86,8 @@ struct dm_spi_slave_platdata {* @cs: ID of the chip select connected to the slave. * @mode: SPI mode to use for this slave (see SPI mode flags) * @wordlen: Size of SPI word in number of bits +* @max_read_size: If non-zero, the maximum number of bytes which can +* be read at once. * @max_write_size: If non-zero, the maximum number of bytes which can * be written at once, excluding command bytes. * @memory_map: Address of read-only SPI flash access.
@@ -102,6 +104,7 @@ struct spi_slave {#endif uint mode;unsigned int wordlen; +unsigned int max_read_size;unsigned int max_write_size;void *memory_map;
Signature · 1 line
2.11.0
PATCH v8 4/12 drivers: spi: consider command bytes when sending transfers
In reply to Álvaro Fernández RojasCommand bytes are part of the written bytes and they should be taken into account when sending a spi transfer.
---
v8: no changes
v7: no changes
v6: no changes
v5: no changes
v4: no changes
v3: Fix bug introduced in v2: sizeof(cmd) vs len
v2: Introduce changes requested by Simon Glass:
- Always include command bytes when determining max write size.
drivers/mtd/spi/spi_flash.c | 2 +- include/spi.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/spi/spi_flash.c +1 -1
@@ -405,7 +405,7 @@ int spi_flash_cmd_write_ops(struct spi_flash *flash, u32 offset,if (spi->max_write_size) chunk_len =min (chunk_len, - (size_t )spi->max_write_size); + spi->max_write_size -sizeof (cmd));spi_flash_addr (write_addr, cmd);
include/spi.h +1 -1
@@ -89,7 +89,7 @@ struct dm_spi_slave_platdata {* @max_read_size: If non-zero, the maximum number of bytes which can * be read at once. * @max_write_size: If non-zero, the maximum number of bytes which can -* be written at once, excluding command bytes. +* be written at once. * @memory_map: Address of read-only SPI flash access. * @flags: Indication of SPI flags. */
Signature · 1 line
2.11.0
PATCH v8 5/12 dm: spi: add BCM63xx SPI driver
In reply to Álvaro Fernández RojasThis driver is a simplified version of linux/drivers/spi/spi-bcm63xx.c
---
v8: no changes
v7: Introduce changes suggested by Daniel Schwierzeck:
- Remove prefix and use __func__ instead.
v6: Introduce changes suggested by Jagan Teki:
- Use cmd instead of val to avoid confusions.
- Switch to wait_for_bit instead of infinite loop.
v5: Introduce changes suggested by Jagan Teki:
- Use long structure instead of a custom bmips_spi_hw structure.
- Define constants for each SPI core.
v4: Introduce changes suggested by Jagan Teki:
- Add data for each HW controller instead of having two separate configs.
- Also check clock and reset returns as suggested by Simon Glass for HSSPI.
v3: rename BCM6338 SPI driver to BCM6348
switch to devfdt_get_addr_size_index()
v2: no changes
drivers/spi/Kconfig | 8 + drivers/spi/Makefile | 1 + drivers/spi/bcm63xx_spi.c | 433 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 442 insertions(+) create mode 100644 drivers/spi/bcm63xx_spi.c
drivers/spi/Kconfig +8 -0
@@ -40,6 +40,14 @@ config ATMEL_SPI many AT91 (ARM) chips. This driver can be used to access the SPI Flash, such as AT25DF321. +config BCM63XX_SPI + bool "BCM6348 SPI driver" + depends on ARCH_BMIPS + help + Enable the BCM6348/BCM6358 SPI driver. This driver can be used to + access the SPI NOR flash on platforms embedding these Broadcom + SPI cores. + config CADENCE_QSPI bool "Cadence QSPI driver" help
drivers/spi/Makefile +1 -0
@@ -18,6 +18,7 @@ endif obj-$(CONFIG_ALTERA_SPI) += altera_spi.o obj-$(CONFIG_ATH79_SPI) += ath79_spi.o obj-$(CONFIG_ATMEL_SPI) += atmel_spi.o +obj-$(CONFIG_BCM63XX_SPI) += bcm63xx_spi.o obj-$(CONFIG_CADENCE_QSPI) += cadence_qspi.o cadence_qspi_apb.o obj-$(CONFIG_CF_SPI) += cf_spi.o obj-$(CONFIG_DAVINCI_SPI) += davinci_spi.o
drivers/spi/bcm63xx_spi.c new file +433 -0
433 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH v8 6/12 mips: bmips: add bcm63xx-spi driver support for BCM6338
In reply to Álvaro Fernández RojasThis driver manages the SPI controller present on this SoC.
---
v8: no changes
v7: no changes
v6: no changes
v5: no changes
v4: no changes
v3: rename BCM6338 SPI driver to BCM6348
v2: add spi alias
arch/mips/dts/brcm,bcm6338.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/mips/dts/brcm,bcm6338.dtsi +17 -0
@@ -12,6 +12,10 @@ / { compatible = "brcm,bcm6338"; + aliases { + spi0 = &spi; + }; + cpus { reg = <0xfffe0000 0x4>; #address-cells = <1>;
@@ -109,6 +113,19 @@ status = "disabled"; }; + spi: spi at fffe0c00 { + compatible = "brcm,bcm6348-spi"; + reg = <0xfffe0c00 0xc0>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&periph_clk BCM6338_CLK_SPI>; + resets = <&periph_rst BCM6338_RST_SPI>; + spi-max-frequency = <20000000>; + num-cs = <4>; + + status = "disabled"; + }; + memory-controller at fffe3100 { compatible = "brcm,bcm6338-mc"; reg = <0xfffe3100 0x38>;
Signature · 1 line
2.11.0
PATCH v8 6/12 mips: bmips: add bcm63xx-spi driver support for BCM6338
Quoted 14 lines · Álvaro Fernández Rojas
This driver manages the SPI controller present on this SoC.
Signed-off-by Álvaro Fernández Rojas <[email protected]>Reviewed-by Daniel Schwierzeck <[email protected]>Reviewed-by Jagan Teki <[email protected]>---
v8: no changes
v7: no changes
v6: no changes
v5: no changes
v4: no changes
v3: rename BCM6338 SPI driver to BCM6348
v2: add spi alias
Quoted 2 lines
arch/mips/dts/brcm,bcm6338.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
PATCH v8 7/12 mips: bmips: add bcm63xx-spi driver support for BCM6348
In reply to Álvaro Fernández RojasThis driver manages the SPI controller present on this SoC.
---
v8: no changes
v7: no changes
v6: no changes
v5: no changes
v4: no changes
v3: rename BCM6338 SPI driver to BCM6348
v2: add spi alias
arch/mips/dts/brcm,bcm6348.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/mips/dts/brcm,bcm6348.dtsi +17 -0
@@ -12,6 +12,10 @@ / { compatible = "brcm,bcm6348"; + aliases { + spi0 = &spi; + }; + cpus { reg = <0xfffe0000 0x4>; #address-cells = <1>;
@@ -118,6 +122,19 @@ status = "disabled"; }; + spi: spi at fffe0c00 { + compatible = "brcm,bcm6348-spi"; + reg = <0xfffe0c00 0xc0>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&periph_clk BCM6348_CLK_SPI>; + resets = <&periph_rst BCM6348_RST_SPI>; + spi-max-frequency = <20000000>; + num-cs = <4>; + + status = "disabled"; + }; + memory-controller at fffe2300 { compatible = "brcm,bcm6338-mc"; reg = <0xfffe2300 0x38>;
Signature · 1 line
2.11.0
PATCH v8 7/12 mips: bmips: add bcm63xx-spi driver support for BCM6348
Quoted 14 lines · Álvaro Fernández Rojas
This driver manages the SPI controller present on this SoC.
Signed-off-by Álvaro Fernández Rojas <[email protected]>Reviewed-by Daniel Schwierzeck <[email protected]>Reviewed-by Jagan Teki <[email protected]>---
v8: no changes
v7: no changes
v6: no changes
v5: no changes
v4: no changes
v3: rename BCM6338 SPI driver to BCM6348
v2: add spi alias
Quoted 3 lines
arch/mips/dts/brcm,bcm6348.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
PATCH v8 8/12 mips: bmips: add bcm63xx-spi driver support for BCM6358
In reply to Álvaro Fernández RojasThis driver manages the SPI controller present on this SoC.
---
v8: no changes
v7: no changes
v6: no changes
v5: no changes
v4: no changes
v3: no changes
v2: add spi alias
arch/mips/dts/brcm,bcm6358.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/mips/dts/brcm,bcm6358.dtsi +17 -0
@@ -12,6 +12,10 @@ / { compatible = "brcm,bcm6358"; + aliases { + spi0 = &spi; + }; + cpus { reg = <0xfffe0000 0x4>; #address-cells = <1>;
@@ -142,6 +146,19 @@ status = "disabled"; }; + spi: spi at fffe0800 { + compatible = "brcm,bcm6358-spi"; + reg = <0xfffe0800 0x70c>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&periph_clk BCM6358_CLK_SPI>; + resets = <&periph_rst BCM6358_RST_SPI>; + spi-max-frequency = <20000000>; + num-cs = <4>; + + status = "disabled"; + }; + memory-controller at fffe1200 { compatible = "brcm,bcm6358-mc"; reg = <0xfffe1200 0x4c>;
Signature · 1 line
2.11.0
PATCH v8 8/12 mips: bmips: add bcm63xx-spi driver support for BCM6358
Quoted 14 lines · Álvaro Fernández Rojas
This driver manages the SPI controller present on this SoC.
Signed-off-by Álvaro Fernández Rojas <[email protected]>Reviewed-by Daniel Schwierzeck <[email protected]>Reviewed-by Jagan Teki <[email protected]>---
v8: no changes
v7: no changes
v6: no changes
v5: no changes
v4: no changes
v3: no changes
v2: add spi alias
Quoted 3 lines
arch/mips/dts/brcm,bcm6358.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
PATCH v8 9/12 mips: bmips: add bcm63xx-spi driver support for BCM3380
In reply to Álvaro Fernández RojasThis driver manages the SPI controller present on this SoC.
---
v8: no changes
v7: no changes
v6: no changes
v5: no changes
v4: no changes
v3: no changes
v2: add spi alias
arch/mips/dts/brcm,bcm3380.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/mips/dts/brcm,bcm3380.dtsi +17 -0
@@ -12,6 +12,10 @@ / { compatible = "brcm,bcm3380"; + aliases { + spi0 = &spi; + }; + cpus { reg = <0x14e00000 0x4>; #address-cells = <1>;
@@ -142,6 +146,19 @@ status = "disabled"; }; + spi: spi at 14e02000 { + compatible = "brcm,bcm6358-spi"; + reg = <0x14e02000 0x70c>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&periph_clk0 BCM3380_CLK0_SPI>; + resets = <&periph_rst0 BCM3380_RST0_SPI>; + spi-max-frequency = <25000000>; + num-cs = <6>; + + status = "disabled"; + }; + leds: led-controller at 14e00f00 { compatible = "brcm,bcm6328-leds"; reg = <0x14e00f00 0x1c>;
Signature · 1 line
2.11.0
PATCH v8 9/12 mips: bmips: add bcm63xx-spi driver support for BCM3380
Quoted 14 lines · Álvaro Fernández Rojas
This driver manages the SPI controller present on this SoC.
Signed-off-by Álvaro Fernández Rojas <[email protected]>Reviewed-by Daniel Schwierzeck <[email protected]>Reviewed-by Jagan Teki <[email protected]>---
v8: no changes
v7: no changes
v6: no changes
v5: no changes
v4: no changes
v3: no changes
v2: add spi alias
Quoted 2 lines
arch/mips/dts/brcm,bcm3380.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
PATCH v8 10/12 mips: bmips: add bcm63xx-spi driver support for BCM63268
In reply to Álvaro Fernández RojasThis driver manages the low speed SPI controller present on this SoC.
---
v8: no changes
v7: no changes
v6: no changes
v5: no changes
v4: no changes
v3: no changes
v2: add spi alias
arch/mips/dts/brcm,bcm63268.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/mips/dts/brcm,bcm63268.dtsi +17 -0
@@ -13,6 +13,10 @@ / { compatible = "brcm,bcm63268"; + aliases { + spi0 = &lsspi; + }; + cpus { reg = <0x10000000 0x4>; #address-cells = <1>;
@@ -136,6 +140,19 @@ #power-domain-cells = <1>; }; + lsspi: spi at 10000800 { + compatible = "brcm,bcm6358-spi"; + reg = <0x10000800 0x70c>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&periph_clk BCM63268_CLK_SPI>; + resets = <&periph_rst BCM63268_RST_SPI>; + spi-max-frequency = <20000000>; + num-cs = <8>; + + status = "disabled"; + }; + leds: led-controller at 10001900 { compatible = "brcm,bcm6328-leds"; reg = <0x10001900 0x24>;
Signature · 1 line
2.11.0
PATCH v8 10/12 mips: bmips: add bcm63xx-spi driver support for BCM63268
Quoted 14 lines · Álvaro Fernández Rojas
This driver manages the low speed SPI controller present on this SoC.
Signed-off-by Álvaro Fernández Rojas <[email protected]>Reviewed-by Daniel Schwierzeck <[email protected]>Reviewed-by Jagan Teki <[email protected]>---
v8: no changes
v7: no changes
v6: no changes
v5: no changes
v4: no changes
v3: no changes
v2: add spi alias
Quoted 2 lines
arch/mips/dts/brcm,bcm63268.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
PATCH v8 11/12 mips: bmips: enable the SPI flash on the Sagem F@ST1704
In reply to Álvaro Fernández RojasIt's a Winbond (w25x32) 4 MB SPI flash.
---
v8: no changes
v7: no changes
v6: no changes
v5: sync with master
v4: switch to CONFIG_BCM63XX_SPI
v3: rename BCM6338 SPI driver to BCM6348
v2: remove spi alias
arch/mips/dts/sagem,f at st1704.dts | 12 ++++++++++++ configs/sagem_f at st1704_ram_defconfig | 8 ++++++++ 2 files changed, 20 insertions(+)
arch/mips/dts/sagem,f at st1704.dts +12 -0
@@ -44,6 +44,18 @@ status = "okay"; }; +&spi { + status = "okay"; + + spi-flash at 0 { + compatible = "spi-flash"; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + spi-max-frequency = <20000000>; + }; +}; + &uart0 { u-boot,dm-pre-reloc; status = "okay";
configs/sagem_f at st1704_ram_defconfig +8 -0
@@ -39,3 +39,11 @@ CONFIG_RESET_BCM6345=y # CONFIG_SPL_SERIAL_PRESENT is not set CONFIG_DM_SERIAL=y CONFIG_BCM6345_SERIAL=y +CONFIG_BCM63XX_SPI=y +CONFIG_CMD_SF=y +CONFIG_CMD_SPI=y +CONFIG_DM_SPI=y +CONFIG_DM_SPI_FLASH=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_MTD=y +CONFIG_SPI_FLASH_WINBOND=y
Signature · 1 line
2.11.0
PATCH v8 11/12 mips: bmips: enable the SPI flash on the Sagem F@ST1704
Quoted 14 lines · Álvaro Fernández Rojas
It's a Winbond (w25x32) 4 MB SPI flash.
Signed-off-by Álvaro Fernández Rojas <[email protected]>Reviewed-by Daniel Schwierzeck <[email protected]>Reviewed-by Jagan Teki <[email protected]>---
v8: no changes
v7: no changes
v6: no changes
v5: sync with master
v4: switch toCONFIG_BCM63XX_SPI
v3: rename BCM6338 SPI driver to BCM6348
v2: remove spi alias
Quoted 4 lines
arch/mips/dts/sagem,f at st1704.dts | 12 ++++++++++++ configs/sagem_f at st1704_ram_defconfig | 8 ++++++++ 2 files changed, 20 insertions(+)
Please see below.
Quoted 29 lines
arch/mips/dts/sagem,f at st1704.dts +12
-0@@ -44,6 +44,18 @@ status = "okay"; }; +&spi { + status = "okay"; + + spi-flash at 0 { + compatible = "spi-flash"; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + spi-max-frequency = <20000000>; + }; +}; + &uart0 { u-boot,dm-pre-reloc; status = "okay";configs/sagem_f at st1704_ram_defconfig +0
-0@@ -39,3 +39,11 @@ CONFIG_RESET_BCM6345=y # CONFIG_SPL_SERIAL_PRESENT is not set
configs/sagem_f at st1704_ram_defconfig CONFIG_RESET_BCM6345=y · line 49
Quoted 10 lines
configs/sagem_f at st1704_ram_defconfig +8
-0CONFIG_DM_SERIAL=y CONFIG_BCM6345_SERIAL=y +CONFIG_BCM63XX_SPI=y +CONFIG_CMD_SF=y +CONFIG_CMD_SPI=y +CONFIG_DM_SPI=y +CONFIG_DM_SPI_FLASH=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_MTD=y +CONFIG_SPI_FLASH_WINBOND=y
Are these definitely in the right order?
Quoted 3 lines
--
2.11.0
Regards,
Simon
PATCH v8 12/12 mips: bmips: enable the SPI flash on the Netgear CG3100D
In reply to Álvaro Fernández RojasIt's a Spansion (s25fl064a) 8 MB SPI flash.
---
v8: no changes
v7: no changes
v6: no changes
v5: sync with master
v4: switch to CONFIG_BCM63XX_SPI
v3: no changes
v2: remove spi alias
arch/mips/dts/netgear,cg3100d.dts | 12 ++++++++++++ configs/netgear_cg3100d_ram_defconfig | 8 ++++++++ 2 files changed, 20 insertions(+)
arch/mips/dts/netgear,cg3100d.dts +12 -0
@@ -90,6 +90,18 @@ status = "okay"; }; +&spi { + status = "okay"; + + spi-flash at 0 { + compatible = "spi-flash"; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + spi-max-frequency = <25000000>; + }; +}; + &uart0 { u-boot,dm-pre-reloc; status = "okay";
configs/netgear_cg3100d_ram_defconfig +8 -0
@@ -41,3 +41,11 @@ CONFIG_RESET_BCM6345=y CONFIG_DM_SERIAL=y CONFIG_BCM6345_SERIAL=y CONFIG_WDT_BCM6345=y +CONFIG_BCM63XX_SPI=y +CONFIG_CMD_SF=y +CONFIG_CMD_SPI=y +CONFIG_DM_SPI=y +CONFIG_DM_SPI_FLASH=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_MTD=y +CONFIG_SPI_FLASH_SPANSION=y
Signature · 1 line
2.11.0
PATCH v8 12/12 mips: bmips: enable the SPI flash on the Netgear CG3100D
Quoted 14 lines · Álvaro Fernández Rojas
It's a Spansion (s25fl064a) 8 MB SPI flash.
Signed-off-by Álvaro Fernández Rojas <[email protected]>Reviewed-by Daniel Schwierzeck <[email protected]>Reviewed-by Jagan Teki <[email protected]>---
v8: no changes
v7: no changes
v6: no changes
v5: sync with master
v4: switch toCONFIG_BCM63XX_SPI
v3: no changes
v2: remove spi alias
Quoted 3 lines
arch/mips/dts/netgear,cg3100d.dts | 12 ++++++++++++ configs/netgear_cg3100d_ram_defconfig | 8 ++++++++ 2 files changed, 20 insertions(+)
v9 cover mips: bmips: add SPI support
In reply to Álvaro Fernández RojasBCM63xx SPI controller is a bit tricky since it doesn't allow keeping CS active between transfers, so I had to modify the spi_flash driver in order to allow limiting reads.
v9: Introduce changes suggested by Simon Glass:
- Fix defconfig order.
v8: Introduce changes suggested by Jagan Teki & Daniel Schwierzeck:
- Squash wait_bit commits.
- Remove register param castings.
v7: Introduce changes suggested by Jagan Teki & Daniel Schwierzeck:
- Use const void* reg for compatibility with 64 bit systems.
- Remove prefix and use __func__ instead.
- Remove wait_for_bit and update callers to wait_for_bit_le32.
v6: Introduce changes suggested by Jagan Teki:
- Use cmd instead of val to avoid confusions.
- Switch to wait_for_bit instead of infinite loop.
v5: Introduce changes suggested by Jagan Teki:
- Use long structs for registers
v4: Introduce changes suggested by Jagan Teki:
- Add data for each HW controller instead of having two separate configs.
v3: Fix bug introduced in v2: sizeof(cmd) vs len.
Also rename BCM6338 SPI driver to BCM6348 SPI since BCM6338 is a stripped down version of the BCM6348.
Switch to devfdt_get_addr_size_index().
v2: Introduce changes requested by Simon Glass:
- Always include command bytes when determining max write size. Also move SPI aliases from .dts to .dtsi files.
Álvaro Fernández Rojas (12):
wait_bit: add 8/16/32 BE/LE versions of wait_for_bit
wait_bit: use wait_for_bit_le32 and remove wait_for_bit
drivers: spi: allow limiting reads
drivers: spi: consider command bytes when sending transfers
dm: spi: add BCM63xx SPI driver
mips: bmips: add bcm63xx-spi driver support for BCM6338
mips: bmips: add bcm63xx-spi driver support for BCM6348
mips: bmips: add bcm63xx-spi driver support for BCM6358
mips: bmips: add bcm63xx-spi driver support for BCM3380
mips: bmips: add bcm63xx-spi driver support for BCM63268
mips: bmips: enable the SPI flash on the Sagem F at ST1704
mips: bmips: enable the SPI flash on the Netgear CG3100D
arch/arm/mach-imx/mx6/ddr.c | 22 +- arch/arm/mach-socfpga/clock_manager.c | 4 +- arch/arm/mach-socfpga/clock_manager_gen5.c | 6 +- arch/arm/mach-socfpga/reset_manager_arria10.c | 36 +-- arch/mips/dts/brcm,bcm3380.dtsi | 17 + arch/mips/dts/brcm,bcm63268.dtsi | 17 + arch/mips/dts/brcm,bcm6338.dtsi | 17 + arch/mips/dts/brcm,bcm6348.dtsi | 17 + arch/mips/dts/brcm,bcm6358.dtsi | 17 + arch/mips/dts/netgear,cg3100d.dts | 12 + arch/mips/dts/sagem,f at st1704.dts | 12 + arch/mips/mach-ath79/ar934x/clk.c | 2 +- board/samtec/vining_2000/vining_2000.c | 4 +- configs/netgear_cg3100d_ram_defconfig | 8 + configs/sagem_f at st1704_ram_defconfig | 8 + drivers/clk/clk_pic32.c | 12 +- drivers/clk/renesas/clk-rcar-gen3.c | 4 +- drivers/ddr/microchip/ddr2.c | 8 +- drivers/fpga/socfpga_arria10.c | 17 +- drivers/mmc/msm_sdhci.c | 8 +- drivers/mtd/pic32_flash.c | 4 +- drivers/mtd/spi/spi_flash.c | 5 +- drivers/net/ag7xxx.c | 16 +- drivers/net/dwc_eth_qos.c | 17 +- drivers/net/ethoc.c | 8 +- drivers/net/pic32_eth.c | 12 +- drivers/net/pic32_mdio.c | 28 +- drivers/net/ravb.c | 4 +- drivers/net/xilinx_axi_emac.c | 4 +- drivers/net/zynq_gem.c | 12 +- drivers/reset/sti-reset.c | 4 +- drivers/serial/serial_pic32.c | 4 +- drivers/spi/Kconfig | 8 + drivers/spi/Makefile | 1 + drivers/spi/atmel_spi.c | 4 +- drivers/spi/bcm63xx_spi.c | 433 ++++++++++++++++++++++++++ drivers/spi/cadence_qspi_apb.c | 14 +- drivers/spi/fsl_qspi.c | 20 +- drivers/spi/mvebu_a3700_spi.c | 20 +- drivers/usb/host/dwc2.c | 24 +- drivers/usb/host/ehci-msm.c | 3 +- drivers/usb/host/ehci-mx6.c | 5 +- drivers/usb/host/ohci-lpc32xx.c | 12 +- drivers/usb/host/xhci-rcar.c | 12 +- drivers/video/atmel_hlcdfb.c | 64 ++-- include/spi.h | 5 +- include/wait_bit.h | 81 ++--- 47 files changed, 824 insertions(+), 248 deletions(-) create mode 100644 drivers/spi/bcm63xx_spi.c
Signature · 1 line
2.11.0
PATCH v9 1/12 wait_bit: add 8/16/32 BE/LE versions of wait_for_bit
Add 8/16/32 bits and BE/LE versions of wait_for_bit.
This is needed for reading registers that are not aligned to 32 bits, and for Big Endian platforms.
---
v9: no changes.
v8: no changes.
v7: Introduce changes suggested by Daniel Schwierzeck:
- Use const void* reg for compatibility with 64 bit systems.
- Remove prefix and use __func__ instead.
v6: Introduce changes suggested by Jagan Teki:
- Switch to wait_for_bit instead of infinite loop.
include/wait_bit.h | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+)
include/wait_bit.h +61 -0
@@ -69,5 +69,66 @@ static inline int wait_for_bit(const char *prefix, const u32 *reg, return -ETIMEDOUT; } +/** +* wait_for_bit_x() waits for bit set/cleared in register +* +* Function polls register waiting for specific bit(s) change +* (either 0->1 or 1->0). It can fail under two conditions: +* - Timeout +* - User interaction (CTRL-C) +* Function succeeds only if all bits of masked register are set/cleared +* (depending on set option). +* +* @param reg Register that will be read (using read_x()) +* @param mask Bit(s) of register that must be active +* @param set Selects wait condition (bit set or clear) +* @param timeout_ms Timeout (in milliseconds) +* @param breakable Enables CTRL-C interruption +* @return 0 on success, -ETIMEDOUT or -EINTR on failure +*/ + +#define BUILD_WAIT_FOR_BIT (sfx, type, read) \ + \ +static inline int wait_for_bit_##sfx(const void *reg, \ + const type mask, \ + const bool set, \ + const unsigned int timeout_ms, \ + const bool breakable) \ +{ \ + type val; \ + unsigned long start = get_timer(0); \ + \ + while (1) { \ + val = read(reg); \ + \ + if (!set) \ + val = ~val; \ + \ + if ((val & mask) == mask) \ + return 0; \ + \ + if (get_timer(start) > timeout_ms) \ + break; \ + \ + if (breakable && ctrlc()) { \ + puts("Abort\n"); \ + return -EINTR; \ + } \ + \ + udelay(1); \ + WATCHDOG_RESET(); \ + } \ + \ + debug("%s: Timeout (reg=%p mask=%x wait_set=%i)\n", __func__, \ + reg, mask, set); \ + \ + return -ETIMEDOUT; \ +} + +BUILD_WAIT_FOR_BIT(8, u8, readb) +BUILD_WAIT_FOR_BIT(le16, u16, readw) +BUILD_WAIT_FOR_BIT(be16, u16, readw_be) +BUILD_WAIT_FOR_BIT(le32, u32, readl) +BUILD_WAIT_FOR_BIT (be32, u32, readl_be) #endif
Signature · 1 line
2.11.0
PATCH v9 2/12 wait_bit: use wait_for_bit_le32 and remove wait_for_bit
In reply to Álvaro Fernández Rojaswait_for_bit callers use the 32 bit LE version
---
v9: no changes
v8: Introduce changes suggested by Jagan Teki & Daniel Schwierzeck:
- Squash wait_bit commits.
- Remove register param castings.
v7: Introduce changes suggested by Jagan Teki:
- Remove wait_for_bit and update callers to wait_for_bit_le32.
arch/arm/mach-imx/mx6/ddr.c | 22 ++++----- arch/arm/mach-socfpga/clock_manager.c | 4 +- arch/arm/mach-socfpga/clock_manager_gen5.c | 6 +-- arch/arm/mach-socfpga/reset_manager_arria10.c | 36 +++++++-------- arch/mips/mach-ath79/ar934x/clk.c | 2 +- board/samtec/vining_2000/vining_2000.c | 4 +- drivers/clk/clk_pic32.c | 12 ++--- drivers/clk/renesas/clk-rcar-gen3.c | 4 +- drivers/ddr/microchip/ddr2.c | 8 ++-- drivers/fpga/socfpga_arria10.c | 17 +++---- drivers/mmc/msm_sdhci.c | 8 ++-- drivers/mtd/pic32_flash.c | 4 +- drivers/net/ag7xxx.c | 16 +++---- drivers/net/dwc_eth_qos.c | 17 +++---- drivers/net/ethoc.c | 8 ++-- drivers/net/pic32_eth.c | 12 ++--- drivers/net/pic32_mdio.c | 28 ++++++------ drivers/net/ravb.c | 4 +- drivers/net/xilinx_axi_emac.c | 4 +- drivers/net/zynq_gem.c | 12 ++--- drivers/reset/sti-reset.c | 4 +- drivers/serial/serial_pic32.c | 4 +- drivers/spi/atmel_spi.c | 4 +- drivers/spi/cadence_qspi_apb.c | 14 +++--- drivers/spi/fsl_qspi.c | 20 ++++----- drivers/spi/mvebu_a3700_spi.c | 20 +++++---- drivers/usb/host/dwc2.c | 24 +++++----- drivers/usb/host/ehci-msm.c | 3 +- drivers/usb/host/ehci-mx6.c | 5 +-- drivers/usb/host/ohci-lpc32xx.c | 12 ++--- drivers/usb/host/xhci-rcar.c | 12 ++--- drivers/video/atmel_hlcdfb.c | 64 +++++++++++++-------------- include/wait_bit.h | 54 ---------------------- 33 files changed, 205 insertions(+), 263 deletions(-)
arch/arm/mach-imx/mx6/ddr.c +11 -11
@@ -21,10 +21,10 @@ static void reset_read_data_fifos(void)/* Reset data FIFOs twice. */ setbits_le32 (&mmdc0->mpdgctrl0,1 <<31 ); -wait_for_bit ("MMDC" , &mmdc0->mpdgctrl0,1 <<31 ,0 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mpdgctrl0,1 <<31 ,0 ,100 ,0 );setbits_le32 (&mmdc0->mpdgctrl0,1 <<31 ); -wait_for_bit ("MMDC" , &mmdc0->mpdgctrl0,1 <<31 ,0 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mpdgctrl0,1 <<31 ,0 ,100 ,0 ); }static void precharge_all (const bool cs0_enable,const bool cs1_enable)
@@ -39,12 +39,12 @@ static void precharge_all(const bool cs0_enable, const bool cs1_enable)*/ if (cs0_enable) {/* CS0 */ writel (0x04008050 , &mmdc0->mdscr); -wait_for_bit ("MMDC" , &mmdc0->mdscr,1 <<14 ,1 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mdscr,1 <<14 ,1 ,100 ,0 ); }if (cs1_enable) {/* CS1 */ writel (0x04008058 , &mmdc0->mdscr); -wait_for_bit ("MMDC" , &mmdc0->mdscr,1 <<14 ,1 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mdscr,1 <<14 ,1 ,100 ,0 ); } }
@@ -146,7 +146,7 @@ int mmdc_do_write_level_calibration(struct mx6_ddr_sysinfo const *sysinfo)* 7. Upon completion of this process the MMDC de-asserts * the MPWLGCR[HW_WL_EN] */ -wait_for_bit ("MMDC" , &mmdc0->mpwlgcr,1 <<0 ,0 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mpwlgcr,1 <<0 ,0 ,100 ,0 );/* * 8. check for any errors: check both PHYs for x64 configuration,
@@ -278,7 +278,7 @@ int mmdc_do_dqs_calibration(struct mx6_ddr_sysinfo const *sysinfo)writel (0x00008028 , &mmdc0->mdscr);/* poll to make sure the con_ack bit was asserted */ -wait_for_bit ("MMDC" , &mmdc0->mdscr,1 <<14 ,1 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mdscr,1 <<14 ,1 ,100 ,0 );/* * Check MDMISC register CALIB_PER_CS to see which CS calibration
@@ -312,7 +312,7 @@ int mmdc_do_dqs_calibration(struct mx6_ddr_sysinfo const *sysinfo)* this bit until it clears to indicate completion of the write access. */ setbits_le32 (&mmdc0->mpswdar0,1 ); -wait_for_bit ("MMDC" , &mmdc0->mpswdar0,1 <<0 ,0 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mpswdar0,1 <<0 ,0 ,100 ,0 );/* Set the RD_DL_ABS# bits to their default values * (will be calibrated later in the read delay-line calibration).
@@ -359,7 +359,7 @@ int mmdc_do_dqs_calibration(struct mx6_ddr_sysinfo const *sysinfo)setbits_le32 (&mmdc0->mpdgctrl0,5 <<28 );/* Poll for completion. MPDGCTRL0[HW_DG_EN] should be 0 */ -wait_for_bit ("MMDC" , &mmdc0->mpdgctrl0,1 <<28 ,0 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mpdgctrl0,1 <<28 ,0 ,100 ,0 );/* * Check to see if any errors were encountered during calibration
@@ -423,7 +423,7 @@ int mmdc_do_dqs_calibration(struct mx6_ddr_sysinfo const *sysinfo)* setting MPRDDLHWCTL[HW_RD_DL_EN] = 0. Also, ensure that * no error bits were set. */ -wait_for_bit ("MMDC" , &mmdc0->mprddlhwctl,1 <<4 ,0 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mprddlhwctl,1 <<4 ,0 ,100 ,0 );/* check both PHYs for x64 configuration, if x32, check only PHY0 */ if (readl (&mmdc0->mprddlhwctl) &0x0000000f )
@@ -477,7 +477,7 @@ int mmdc_do_dqs_calibration(struct mx6_ddr_sysinfo const *sysinfo)* by setting MPWRDLHWCTL[HW_WR_DL_EN] = 0. * Also, ensure that no error bits were set. */ -wait_for_bit ("MMDC" , &mmdc0->mpwrdlhwctl,1 <<4 ,0 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mpwrdlhwctl,1 <<4 ,0 ,100 ,0 );/* Check both PHYs for x64 configuration, if x32, check only PHY0 */ if (readl (&mmdc0->mpwrdlhwctl) &0x0000000f )
@@ -526,7 +526,7 @@ int mmdc_do_dqs_calibration(struct mx6_ddr_sysinfo const *sysinfo)writel (0x0 , &mmdc0->mdscr);/* CS0 */ /* Poll to make sure the con_ack bit is clear */ -wait_for_bit ("MMDC" , &mmdc0->mdscr,1 <<14 ,0 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mdscr,1 <<14 ,0 ,100 ,0 );/* * Print out the registers that were updated as a result
arch/arm/mach-socfpga/clock_manager.c +2 -2
@@ -37,8 +37,8 @@ void cm_wait_for_lock(u32 mask)/* function to poll in the fsm busy bit */ int cm_wait_for_fsm (void ) { -return wait_for_bit (__func__, (const u32 *)&clock_manager_base->stat, -CLKMGR_STAT_BUSY , false,20000 , false); +return wait_for_bit_le32 (&clock_manager_base->stat, +CLKMGR_STAT_BUSY , false,20000 , false); }int set_cpu_clk_info (void )
arch/arm/mach-socfpga/clock_manager_gen5.c +2 -4
@@ -37,15 +37,13 @@ static int cm_write_with_phase(u32 value, u32 reg_address, u32 mask)int ret;/* poll until phase is zero */ - ret =wait_for_bit (__func__, (const u32 *)reg_address, mask, - false,20000 , false); + ret =wait_for_bit_le32 (reg_address, mask, false,20000 , false);if (ret)return ret;writel (value, reg_address); -return wait_for_bit (__func__, (const u32 *)reg_address, mask, - false,20000 , false); +return wait_for_bit_le32 (reg_address, mask, false,20000 , false); }/*
arch/arm/mach-socfpga/reset_manager_arria10.c +18 -18
@@ -222,8 +222,8 @@ int socfpga_reset_deassert_bridges_handoff(void)clrbits_le32 (&reset_manager_base->brgmodrst, mask_rstmgr);/* Poll until all idleack to 0, timeout at 1000ms */ -return wait_for_bit (__func__, &sysmgr_regs->noc_idleack, mask_noc, - false,1000 , false); +return wait_for_bit_le32 (&sysmgr_regs->noc_idleack, mask_noc, + false,1000 , false); }void socfpga_reset_assert_fpga_connected_peripherals (void )
@@ -343,26 +343,26 @@ int socfpga_bridges_reset(void)writel (ALT_SYSMGR_NOC_TMO_EN_SET_MSK , &sysmgr_regs->noc_timeout);/* Poll until all idleack to 1 */ - ret =wait_for_bit (__func__, &sysmgr_regs->noc_idleack, -ALT_SYSMGR_NOC_H2F_SET_MSK | -ALT_SYSMGR_NOC_LWH2F_SET_MSK | -ALT_SYSMGR_NOC_F2H_SET_MSK | -ALT_SYSMGR_NOC_F2SDR0_SET_MSK | -ALT_SYSMGR_NOC_F2SDR1_SET_MSK | -ALT_SYSMGR_NOC_F2SDR2_SET_MSK , - true,10000 , false); + ret =wait_for_bit_le32 (&sysmgr_regs->noc_idleack, +ALT_SYSMGR_NOC_H2F_SET_MSK | +ALT_SYSMGR_NOC_LWH2F_SET_MSK | +ALT_SYSMGR_NOC_F2H_SET_MSK | +ALT_SYSMGR_NOC_F2SDR0_SET_MSK | +ALT_SYSMGR_NOC_F2SDR1_SET_MSK | +ALT_SYSMGR_NOC_F2SDR2_SET_MSK , + true,10000 , false);if (ret)return ret;/* Poll until all idlestatus to 1 */ - ret =wait_for_bit (__func__, &sysmgr_regs->noc_idlestatus, -ALT_SYSMGR_NOC_H2F_SET_MSK | -ALT_SYSMGR_NOC_LWH2F_SET_MSK | -ALT_SYSMGR_NOC_F2H_SET_MSK | -ALT_SYSMGR_NOC_F2SDR0_SET_MSK | -ALT_SYSMGR_NOC_F2SDR1_SET_MSK | -ALT_SYSMGR_NOC_F2SDR2_SET_MSK , - true,10000 , false); + ret =wait_for_bit_le32 (&sysmgr_regs->noc_idlestatus, +ALT_SYSMGR_NOC_H2F_SET_MSK | +ALT_SYSMGR_NOC_LWH2F_SET_MSK | +ALT_SYSMGR_NOC_F2H_SET_MSK | +ALT_SYSMGR_NOC_F2SDR0_SET_MSK | +ALT_SYSMGR_NOC_F2SDR1_SET_MSK | +ALT_SYSMGR_NOC_F2SDR2_SET_MSK , + true,10000 , false);if (ret)return ret;
arch/mips/mach-ath79/ar934x/clk.c +1 -1
@@ -90,7 +90,7 @@ static void ar934x_srif_pll_cfg(void __iomem *pll_reg_base, const u32 srif_val)setbits_be32 (pll_reg_base +0x8 ,BIT (30 ));udelay (5 ); -wait_for_bit ("clk" , pll_reg_base +0xc ,BIT (3 ),1 ,10 ,0 ); +wait_for_bit_le32 (pll_reg_base +0xc ,BIT (3 ),1 ,10 ,0 );clrbits_be32 (pll_reg_base +0x8 ,BIT (30 ));udelay (5 );
board/samtec/vining_2000/vining_2000.c +2 -2
@@ -378,7 +378,7 @@ static int read_adc(u32 *val)/* start auto calibration */ setbits_le32 (b + ADCx_GC, ADCx_GC_CAL); - ret =wait_for_bit ("ADC" , b + ADCx_GC, ADCx_GC_CAL, ADCx_GC_CAL,10 ,0 ); + ret =wait_for_bit_le32 (b + ADCx_GC, ADCx_GC_CAL, ADCx_GC_CAL,10 ,0 );if (ret) goto adc_exit;
@@ -386,7 +386,7 @@ static int read_adc(u32 *val)writel (0 , b + ADCx_HC0);/* wait for conversion */ - ret =wait_for_bit ("ADC" , b + ADCx_HS, ADCx_HS_C0, ADCx_HS_C0,10 ,0 ); + ret =wait_for_bit_le32 (b + ADCx_HS, ADCx_HS_C0, ADCx_HS_C0,10 ,0 );if (ret) goto adc_exit;
drivers/clk/clk_pic32.c +6 -6
@@ -197,8 +197,8 @@ static ulong pic32_set_refclk(struct pic32_clk_priv *priv, int periph,writel (REFO_ON |REFO_OE , reg + _CLR_OFFSET);/* wait till previous src change is active */ -wait_for_bit (__func__, reg,REFO_DIVSW_EN |REFO_ACTIVE , - false,CONFIG_SYS_HZ , false); +wait_for_bit_le32 (reg,REFO_DIVSW_EN |REFO_ACTIVE , + false,CONFIG_SYS_HZ , false);/* parent_id */ v =readl (reg);
@@ -223,8 +223,8 @@ static ulong pic32_set_refclk(struct pic32_clk_priv *priv, int periph,writel (REFO_DIVSW_EN , reg + _SET_OFFSET);/* wait for divider switching to complete */ -return wait_for_bit (__func__, reg,REFO_DIVSW_EN , false, -CONFIG_SYS_HZ , false); +return wait_for_bit_le32 (reg,REFO_DIVSW_EN , false, +CONFIG_SYS_HZ , false); }static ulong pic32_get_refclk (struct pic32_clk_priv *priv,int periph)
@@ -311,8 +311,8 @@ static int pic32_mpll_init(struct pic32_clk_priv *priv)/* Wait for ready */ mask =MPLL_RDY |MPLL_VREG_RDY ; -return wait_for_bit (__func__, priv->syscfg_base +CFGMPLL , mask, - true,get_tbclk (), false); +return wait_for_bit_le32 (priv->syscfg_base +CFGMPLL , mask, + true,get_tbclk (), false); }static void pic32_clk_init (struct udevice *dev)
drivers/clk/renesas/clk-rcar-gen3.c +2 -2
@@ -1046,8 +1046,8 @@ static int gen3_clk_endisable(struct clk *clk, bool enable)if (ret)return ret;clrbits_le32 (priv->base +SMSTPCR (reg), bitmask); -return wait_for_bit ("MSTP" , priv->base +MSTPSR (reg), - bitmask,0 ,100 ,0 ); +return wait_for_bit_le32 (priv->base +MSTPSR (reg), + bitmask,0 ,100 ,0 ); }else {setbits_le32 (priv->base +SMSTPCR (reg), bitmask);return 0 ;
drivers/ddr/microchip/ddr2.c +4 -4
@@ -57,8 +57,8 @@ static int ddr2_phy_calib_start(void)writel (SCL_START |SCL_EN , &ddr2_phy->scl_start);/* Wait for SCL for data byte to pass */ -return wait_for_bit (__func__, &ddr2_phy->scl_start,SCL_LUBPASS , - true,CONFIG_SYS_HZ , false); +return wait_for_bit_le32 (&ddr2_phy->scl_start,SCL_LUBPASS , + true,CONFIG_SYS_HZ , false); }/* DDR2 Controller initialization */
@@ -256,8 +256,8 @@ void ddr2_ctrl_init(void)writel (INIT_START , &ctrl->memcon);/* wait for all host cmds to be transmitted */ -wait_for_bit (__func__, &ctrl->cmdissue,CMD_VALID , false, -CONFIG_SYS_HZ , false); +wait_for_bit_le32 (&ctrl->cmdissue,CMD_VALID , false, +CONFIG_SYS_HZ , false);/* inform all cmds issued, ready for normal operation */ writel (INIT_START |INIT_DONE , &ctrl->memcon);
drivers/fpga/socfpga_arria10.c +7 -10
@@ -62,8 +62,7 @@ int is_fpgamgr_user_mode(void)static int wait_for_user_mode (void ) { -return wait_for_bit (__func__, - &fpga_manager_base->imgcfg_stat, +return wait_for_bit_le32 (&fpga_manager_base->imgcfg_stat,ALT_FPGAMGR_IMGCFG_STAT_F2S_USERMODE_SET_MSK ,1 ,FPGA_TIMEOUT_MSEC , false); }
@@ -115,19 +114,17 @@ static int wait_for_nconfig_pin_and_nstatus_pin(void)/* Poll until f2s_nconfig_pin and f2s_nstatus_pin; loop until de-asserted, * timeout at 1000ms */ -return wait_for_bit (__func__, - &fpga_manager_base->imgcfg_stat, - mask, - false,FPGA_TIMEOUT_MSEC , false); +return wait_for_bit_le32 (&fpga_manager_base->imgcfg_stat, + mask, + false,FPGA_TIMEOUT_MSEC , false); }static int wait_for_f2s_nstatus_pin (unsigned long value) {/* Poll until f2s to specific value, timeout at 1000ms */ -return wait_for_bit (__func__, - &fpga_manager_base->imgcfg_stat, -ALT_FPGAMGR_IMGCFG_STAT_F2S_NSTATUS_PIN_SET_MSK , - value,FPGA_TIMEOUT_MSEC , false); +return wait_for_bit_le32 (&fpga_manager_base->imgcfg_stat, +ALT_FPGAMGR_IMGCFG_STAT_F2S_NSTATUS_PIN_SET_MSK , + value,FPGA_TIMEOUT_MSEC , false); }/* set CD ratio */
drivers/mmc/msm_sdhci.c +4 -4
@@ -109,15 +109,15 @@ static int msm_sdc_probe(struct udevice *dev)/* Wait for reset to be written to register */ -if (wait_for_bit (__func__, prv->base +SDCC_MCI_STATUS2 , -SDCC_MCI_STATUS2_MCI_ACT , false,10 , false)) { +if (wait_for_bit_le32 (prv->base +SDCC_MCI_STATUS2 , +SDCC_MCI_STATUS2_MCI_ACT , false,10 , false)) {printf ("msm_sdhci: reset request failed\n" );return -EIO ; }/* SW reset can take upto 10HCLK + 15MCLK cycles. (min 40us) */ -if (wait_for_bit (__func__, prv->base +SDCC_MCI_POWER , -SDCC_MCI_POWER_SW_RST , false,2 , false)) { +if (wait_for_bit_le32 (prv->base +SDCC_MCI_POWER , +SDCC_MCI_POWER_SW_RST , false,2 , false)) {printf ("msm_sdhci: stuck in reset\n" );return -ETIMEDOUT ; }
drivers/mtd/pic32_flash.c +2 -2
@@ -66,8 +66,8 @@ static inline void flash_initiate_operation(u32 nvmop)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); +int ret =wait_for_bit_le32 (&nvm_regs_p->ctrl.raw, +NVM_WR , false, timeout, false);return ret ?ERR_TIMOUT :ERR_OK ; }
drivers/net/ag7xxx.c +8 -8
@@ -164,8 +164,8 @@ static int ag7xxx_switch_read(struct mii_dev *bus, int addr, int reg, u16 *val)writel (AG7XXX_ETH_MII_MGMT_CMD_READ , regs +AG7XXX_ETH_MII_MGMT_CMD ); - ret =wait_for_bit ("ag7xxx" , regs +AG7XXX_ETH_MII_MGMT_IND , -AG7XXX_ETH_MII_MGMT_IND_BUSY ,0 ,1000 ,0 ); + ret =wait_for_bit_le32 (regs +AG7XXX_ETH_MII_MGMT_IND , +AG7XXX_ETH_MII_MGMT_IND_BUSY ,0 ,1000 ,0 );if (ret)return ret;
@@ -185,8 +185,8 @@ static int ag7xxx_switch_write(struct mii_dev *bus, int addr, int reg, u16 val) regs + AG7XXX_ETH_MII_MGMT_ADDRESS);writel (val, regs +AG7XXX_ETH_MII_MGMT_CTRL ); - ret =wait_for_bit ("ag7xxx" , regs +AG7XXX_ETH_MII_MGMT_IND , -AG7XXX_ETH_MII_MGMT_IND_BUSY ,0 ,1000 ,0 ); + ret =wait_for_bit_le32 (regs +AG7XXX_ETH_MII_MGMT_IND , +AG7XXX_ETH_MII_MGMT_IND_BUSY ,0 ,1000 ,0 );return ret; }
@@ -510,13 +510,13 @@ static void ag7xxx_eth_stop(struct udevice *dev)/* Stop the TX DMA. */ writel (0 , priv->regs +AG7XXX_ETH_DMA_TX_CTRL ); -wait_for_bit ("ag7xxx" , priv->regs +AG7XXX_ETH_DMA_TX_CTRL , ~0 ,0 , -1000 ,0 ); +wait_for_bit_le32 (priv->regs +AG7XXX_ETH_DMA_TX_CTRL , ~0 ,0 , +1000 ,0 );/* Stop the RX DMA. */ writel (0 , priv->regs +AG7XXX_ETH_DMA_RX_CTRL ); -wait_for_bit ("ag7xxx" , priv->regs +AG7XXX_ETH_DMA_RX_CTRL , ~0 ,0 , -1000 ,0 ); +wait_for_bit_le32 (priv->regs +AG7XXX_ETH_DMA_RX_CTRL , ~0 ,0 , +1000 ,0 ); }/*
drivers/net/dwc_eth_qos.c +9 -8
@@ -361,8 +361,9 @@ static void eqos_flush_buffer(void *buf, size_t size)static int eqos_mdio_wait_idle (struct eqos_priv *eqos) { -return wait_for_bit (__func__, &eqos->mac_regs->mdio_address, -EQOS_MAC_MDIO_ADDRESS_GB , false,1000000 , true); +return wait_for_bit_le32 (&eqos->mac_regs->mdio_address, +EQOS_MAC_MDIO_ADDRESS_GB , false, +1000000 , true); } static int eqos_mdio_read(struct mii_dev *bus, int mdio_addr, int mdio_devad,
@@ -588,15 +589,15 @@ static int eqos_calibrate_pads_tegra186(struct udevice *dev)setbits_le32 (&eqos->tegra186_regs->auto_cal_config,EQOS_AUTO_CAL_CONFIG_START |EQOS_AUTO_CAL_CONFIG_ENABLE ); - ret =wait_for_bit (__func__, &eqos->tegra186_regs->auto_cal_status, -EQOS_AUTO_CAL_STATUS_ACTIVE , true,10 , false); + ret =wait_for_bit_le32 (&eqos->tegra186_regs->auto_cal_status, +EQOS_AUTO_CAL_STATUS_ACTIVE , true,10 , false);if (ret) {pr_err ("calibrate didn't start" ); goto failed; } - ret =wait_for_bit (__func__, &eqos->tegra186_regs->auto_cal_status, -EQOS_AUTO_CAL_STATUS_ACTIVE , false,10 , false); + ret =wait_for_bit_le32 (&eqos->tegra186_regs->auto_cal_status, +EQOS_AUTO_CAL_STATUS_ACTIVE , false,10 , false);if (ret) {pr_err ("calibrate didn't finish" ); goto failed;
@@ -862,8 +863,8 @@ static int eqos_start(struct udevice *dev) eqos->reg_access_ok = true; - ret =wait_for_bit (__func__, &eqos->dma_regs->mode, -EQOS_DMA_MODE_SWR , false,10 , false); + ret =wait_for_bit_le32 (&eqos->dma_regs->mode, +EQOS_DMA_MODE_SWR , false,10 , false);if (ret) {pr_err ("EQOS_DMA_MODE_SWR stuck" ); goto err_stop_resets;
drivers/net/ethoc.c +4 -4
@@ -548,8 +548,8 @@ static int ethoc_mdio_read(struct mii_dev *bus, int addr, int devad, int reg)ethoc_write (priv,MIIADDRESS ,MIIADDRESS_ADDR (addr, reg));ethoc_write (priv,MIICOMMAND ,MIICOMMAND_READ ); - rc =wait_for_bit (__func__,ethoc_reg (priv,MIISTATUS ), -MIISTATUS_BUSY , false,CONFIG_SYS_HZ , false); + rc =wait_for_bit_le32 (ethoc_reg (priv,MIISTATUS ), +MIISTATUS_BUSY , false,CONFIG_SYS_HZ , false);if (rc ==0 ) {u32 data =ethoc_read (priv,MIIRX_DATA );
@@ -571,8 +571,8 @@ static int ethoc_mdio_write(struct mii_dev *bus, int addr, int devad, int reg,ethoc_write (priv,MIITX_DATA , val);ethoc_write (priv,MIICOMMAND ,MIICOMMAND_WRITE ); - rc =wait_for_bit (__func__,ethoc_reg (priv,MIISTATUS ), -MIISTATUS_BUSY , false,CONFIG_SYS_HZ , false); + rc =wait_for_bit_le32 (ethoc_reg (priv,MIISTATUS ), +MIISTATUS_BUSY , false,CONFIG_SYS_HZ , false);if (rc ==0 ) {/* reset MII command register */
drivers/net/pic32_eth.c +6 -6
@@ -64,8 +64,8 @@ static int pic32_mii_init(struct pic32eth_dev *priv)writel (ETHCON_ON |ETHCON_TXRTS |ETHCON_RXEN , &ectl_p->con1.clr);/* wait till busy */ -wait_for_bit (__func__, &ectl_p->stat.raw,ETHSTAT_BUSY , false, -CONFIG_SYS_HZ , false); +wait_for_bit_le32 (&ectl_p->stat.raw,ETHSTAT_BUSY , false, +CONFIG_SYS_HZ , false);/* turn controller ON to access PHY over MII */ writel (ETHCON_ON , &ectl_p->con1.set);
@@ -239,8 +239,8 @@ static void pic32_ctrl_reset(struct pic32eth_dev *priv)writel (ETHCON_ON |ETHCON_TXRTS |ETHCON_RXEN , &ectl_p->con1.clr);/* wait till busy */ -wait_for_bit (__func__, &ectl_p->stat.raw,ETHSTAT_BUSY , false, -CONFIG_SYS_HZ , false); +wait_for_bit_le32 (&ectl_p->stat.raw,ETHSTAT_BUSY , false, +CONFIG_SYS_HZ , false);/* decrement received buffcnt to zero. */ while (readl (&ectl_p->stat.raw) ÐSTAT_BUFCNT )writel (ETHCON_BUFCDEC , &ectl_p->con1.set);
@@ -375,8 +375,8 @@ static void pic32_eth_stop(struct udevice *dev)mdelay (10 );/* wait until everything is down */ -wait_for_bit (__func__, &ectl_p->stat.raw,ETHSTAT_BUSY , false, -2 *CONFIG_SYS_HZ , false); +wait_for_bit_le32 (&ectl_p->stat.raw,ETHSTAT_BUSY , false, +2 *CONFIG_SYS_HZ , false);/* clear any existing interrupt event */ writel (0xffffffff , &ectl_p->irq.clr);
drivers/net/pic32_mdio.c +14 -14
@@ -22,8 +22,8 @@ static int pic32_mdio_write(struct mii_dev *bus,struct pic32_mii_regs *mii_regs = bus->priv;/* Wait for the previous operation to finish */ -wait_for_bit (__func__, &mii_regs->mind.raw,MIIMIND_BUSY , - false,CONFIG_SYS_HZ , true); +wait_for_bit_le32 (&mii_regs->mind.raw,MIIMIND_BUSY , + false,CONFIG_SYS_HZ , true);/* Put phyaddr and regaddr into MIIMADD */ v = (addr <<MIIMADD_PHYADDR_SHIFT ) | (reg &MIIMADD_REGADDR );
@@ -36,8 +36,8 @@ static int pic32_mdio_write(struct mii_dev *bus,udelay (12 );/* Wait for write to complete */ -wait_for_bit (__func__, &mii_regs->mind.raw,MIIMIND_BUSY , - false,CONFIG_SYS_HZ , true); +wait_for_bit_le32 (&mii_regs->mind.raw,MIIMIND_BUSY , + false,CONFIG_SYS_HZ , true);return 0 ; }
@@ -48,8 +48,8 @@ static int pic32_mdio_read(struct mii_dev *bus, int addr, int devaddr, int reg)struct pic32_mii_regs *mii_regs = bus->priv;/* Wait for the previous operation to finish */ -wait_for_bit (__func__, &mii_regs->mind.raw,MIIMIND_BUSY , - false,CONFIG_SYS_HZ , true); +wait_for_bit_le32 (&mii_regs->mind.raw,MIIMIND_BUSY , + false,CONFIG_SYS_HZ , true);/* Put phyaddr and regaddr into MIIMADD */ v = (addr <<MIIMADD_PHYADDR_SHIFT ) | (reg &MIIMADD_REGADDR );
@@ -62,9 +62,9 @@ static int pic32_mdio_read(struct mii_dev *bus, int addr, int devaddr, int reg)udelay (12 );/* Wait for read to complete */ -wait_for_bit (__func__, &mii_regs->mind.raw, -MIIMIND_NOTVALID |MIIMIND_BUSY , - false,CONFIG_SYS_HZ , false); +wait_for_bit_le32 (&mii_regs->mind.raw, +MIIMIND_NOTVALID |MIIMIND_BUSY , + false,CONFIG_SYS_HZ , false);/* Clear the command register */ writel (0 , &mii_regs->mcmd.raw);
@@ -82,22 +82,22 @@ static int pic32_mdio_reset(struct mii_dev *bus)writel (MIIMCFG_RSTMGMT , &mii_regs->mcfg.raw);/* Wait for the operation to finish */ -wait_for_bit (__func__, &mii_regs->mind.raw,MIIMIND_BUSY , +wait_for_bit_le32 (&mii_regs->mind.raw,MIIMIND_BUSY , false,CONFIG_SYS_HZ , true);/* Clear reset bit */ writel (0 , &mii_regs->mcfg);/* Wait for the operation to finish */ -wait_for_bit (__func__, &mii_regs->mind.raw,MIIMIND_BUSY , - false,CONFIG_SYS_HZ , true); +wait_for_bit_le32 (&mii_regs->mind.raw,MIIMIND_BUSY , + false,CONFIG_SYS_HZ , true);/* Set the MII Management Clock (MDC) - no faster than 2.5 MHz */ writel (MIIMCFG_CLKSEL_DIV40 , &mii_regs->mcfg.raw);/* Wait for the operation to finish */ -wait_for_bit (__func__, &mii_regs->mind.raw,MIIMIND_BUSY , - false,CONFIG_SYS_HZ , true); +wait_for_bit_le32 (&mii_regs->mind.raw,MIIMIND_BUSY , + false,CONFIG_SYS_HZ , true);return 0 ; }
drivers/net/ravb.c +2 -2
@@ -222,8 +222,8 @@ static int ravb_reset(struct udevice *dev)writel (CCC_OPC_CONFIG , eth->iobase +RAVB_REG_CCC );/* Check the operating mode is changed to the config mode. */ -return wait_for_bit (dev->name, (void *)eth->iobase +RAVB_REG_CSR , -CSR_OPS_CONFIG , true,100 , true); +return wait_for_bit_le32 (eth->iobase +RAVB_REG_CSR , +CSR_OPS_CONFIG , true,100 , true); }static void ravb_base_desc_init (struct ravb_priv *eth)
drivers/net/xilinx_axi_emac.c +2 -2
@@ -366,8 +366,8 @@ static int axi_ethernet_init(struct axidma_priv *priv)* processor mode and hence bypass in this mode */ if (!priv->eth_hasnobuf) { - err =wait_for_bit (__func__, (const u32 *)®s->is, -XAE_INT_MGTRDY_MASK , true,200 , false); + err =wait_for_bit_le32 (®s->is,XAE_INT_MGTRDY_MASK , + true,200 , false);if (err) {printf ("%s: Timeout\n" , __func__);return 1 ;
drivers/net/zynq_gem.c +6 -6
@@ -192,8 +192,8 @@ static u32 phy_setup_op(struct zynq_gem_priv *priv, u32 phy_addr, u32 regnum,struct zynq_gem_regs *regs = priv->iobase;int err; - err =wait_for_bit (__func__, ®s->nwsr,ZYNQ_GEM_NWSR_MDIOIDLE_MASK , - true,20000 , false); + err =wait_for_bit_le32 (®s->nwsr,ZYNQ_GEM_NWSR_MDIOIDLE_MASK , + true,20000 , false);if (err)return err;
@@ -205,8 +205,8 @@ static u32 phy_setup_op(struct zynq_gem_priv *priv, u32 phy_addr, u32 regnum,/* Write mgtcr and wait for completion */ writel (mgtcr, ®s->phymntnc); - err =wait_for_bit (__func__, ®s->nwsr,ZYNQ_GEM_NWSR_MDIOIDLE_MASK , - true,20000 , false); + err =wait_for_bit_le32 (®s->nwsr,ZYNQ_GEM_NWSR_MDIOIDLE_MASK , + true,20000 , false);if (err)return err;
@@ -514,8 +514,8 @@ static int zynq_gem_send(struct udevice *dev, void *ptr, int len)if (priv->tx_bd->status &ZYNQ_GEM_TXBUF_EXHAUSTED )printf ("TX buffers exhausted in mid frame\n" ); -return wait_for_bit (__func__, ®s->txsr,ZYNQ_GEM_TSR_DONE , - true,20000 , true); +return wait_for_bit_le32 (®s->txsr,ZYNQ_GEM_TSR_DONE , + true,20000 , true); }/* Do not check frame_recd flag in rx_status register 0x20 - just poll BD */
drivers/reset/sti-reset.c +2 -2
@@ -266,8 +266,8 @@ static int sti_reset_program_hw(struct reset_ctl *reset_ctl, int assert)return 0 ; reg = (void __iomem *)base + ch->ack_offset; -if (wait_for_bit (__func__, reg,BIT (ch->ack_bit), ctrl_val, -1000 , false)) { +if (wait_for_bit_le32 (reg,BIT (ch->ack_bit), ctrl_val, +1000 , false)) {pr_err ("Stuck on waiting ack reset_ctl=%p dev=%p id=%lu\n" , reset_ctl, reset_ctl->dev, reset_ctl->id);
drivers/serial/serial_pic32.c +2 -2
@@ -51,8 +51,8 @@ static int pic32_serial_init(void __iomem *base, ulong clk, u32 baudrate)u32 div =DIV_ROUND_CLOSEST (clk, baudrate *16 );/* wait for TX FIFO to empty */ -wait_for_bit (__func__, base +U_STA ,UART_TX_EMPTY , - true,CONFIG_SYS_HZ , false); +wait_for_bit_le32 (base +U_STA ,UART_TX_EMPTY , + true,CONFIG_SYS_HZ , false);/* send break */ writel (UART_TX_BRK , base +U_STASET );
drivers/spi/atmel_spi.c +2 -2
@@ -394,8 +394,8 @@ out:* Wait until the transfer is completely done before * we deactivate CS. */ -wait_for_bit (__func__, ®_base->sr, -ATMEL_SPI_SR_TXEMPTY , true,1000 , false); +wait_for_bit_le32 (®_base->sr, +ATMEL_SPI_SR_TXEMPTY , true,1000 , false);atmel_spi_cs_deactivate (dev); }
drivers/spi/cadence_qspi_apb.c +7 -7
@@ -675,8 +675,8 @@ int cadence_qspi_apb_indirect_read_execute(struct cadence_spi_platdata *plat, }/* Check indirect done status */ - ret =wait_for_bit ("QSPI" , plat->regbase +CQSPI_REG_INDIRECTRD , -CQSPI_REG_INDIRECTRD_DONE ,1 ,10 ,0 ); + ret =wait_for_bit_le32 (plat->regbase +CQSPI_REG_INDIRECTRD , +CQSPI_REG_INDIRECTRD_DONE ,1 ,10 ,0 );if (ret) {printf ("Indirect read completion error (%i)\n" , ret); goto failrd;
@@ -762,9 +762,9 @@ int cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat, bb_txbuf +rounddown (write_bytes,4 ), write_bytes % 4); - ret =wait_for_bit ("QSPI" , plat->regbase +CQSPI_REG_SDRAMLEVEL , -CQSPI_REG_SDRAMLEVEL_WR_MASK << -CQSPI_REG_SDRAMLEVEL_WR_LSB ,0 ,10 ,0 ); + ret =wait_for_bit_le32 (plat->regbase +CQSPI_REG_SDRAMLEVEL , +CQSPI_REG_SDRAMLEVEL_WR_MASK << +CQSPI_REG_SDRAMLEVEL_WR_LSB ,0 ,10 ,0 );if (ret) {printf ("Indirect write timed out (%i)\n" , ret); goto failwr;
@@ -775,8 +775,8 @@ int cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat, }/* Check indirect done status */ - ret =wait_for_bit ("QSPI" , plat->regbase +CQSPI_REG_INDIRECTWR , -CQSPI_REG_INDIRECTWR_DONE ,1 ,10 ,0 ); + ret =wait_for_bit_le32 (plat->regbase +CQSPI_REG_INDIRECTWR , +CQSPI_REG_INDIRECTWR_DONE ,1 ,10 ,0 );if (ret) {printf ("Indirect write completion error (%i)\n" , ret); goto failwr;
drivers/spi/fsl_qspi.c +10 -10
@@ -1018,11 +1018,11 @@ static int fsl_qspi_probe(struct udevice *bus) priv->num_chipselect = plat->num_chipselect;/* make sure controller is not busy anywhere */ - ret =wait_for_bit (__func__, &priv->regs->sr, -QSPI_SR_BUSY_MASK | -QSPI_SR_AHB_ACC_MASK | -QSPI_SR_IP_ACC_MASK , - false,100 , false); + ret =wait_for_bit_le32 (&priv->regs->sr, +QSPI_SR_BUSY_MASK | +QSPI_SR_AHB_ACC_MASK | +QSPI_SR_IP_ACC_MASK , + false,100 , false);if (ret) {debug ("ERROR : The controller is busy\n" );
@@ -1185,11 +1185,11 @@ static int fsl_qspi_claim_bus(struct udevice *dev) priv =dev_get_priv (bus);/* make sure controller is not busy anywhere */ - ret =wait_for_bit (__func__, &priv->regs->sr, -QSPI_SR_BUSY_MASK | -QSPI_SR_AHB_ACC_MASK | -QSPI_SR_IP_ACC_MASK , - false,100 , false); + ret =wait_for_bit_le32 (&priv->regs->sr, +QSPI_SR_BUSY_MASK | +QSPI_SR_AHB_ACC_MASK | +QSPI_SR_IP_ACC_MASK , + false,100 , false);if (ret) {debug ("ERROR : The controller is busy\n" );
drivers/spi/mvebu_a3700_spi.c +11 -9
@@ -95,8 +95,9 @@ static int spi_legacy_shift_byte(struct spi_reg *reg, unsigned int bytelen, din_8 = din;while (bytelen) { - ret =wait_for_bit (__func__, ®->ctrl, -MVEBU_SPI_A3700_XFER_RDY , true,100 , false); + ret =wait_for_bit_le32 (®->ctrl, +MVEBU_SPI_A3700_XFER_RDY , + true,100 , false);if (ret)return ret;
@@ -109,9 +110,9 @@ static int spi_legacy_shift_byte(struct spi_reg *reg, unsigned int bytelen,writel (pending_dout, ®->dout);if (din) { - ret =wait_for_bit (__func__, ®->ctrl, -MVEBU_SPI_A3700_XFER_RDY , - true,100 , false); + ret =wait_for_bit_le32 (®->ctrl, +MVEBU_SPI_A3700_XFER_RDY , + true,100 , false);if (ret)return ret;
@@ -160,8 +161,9 @@ static int mvebu_spi_xfer(struct udevice *dev, unsigned int bitlen,/* Deactivate CS */ if (flags &SPI_XFER_END ) { - ret =wait_for_bit (__func__, ®->ctrl, -MVEBU_SPI_A3700_XFER_RDY , true,100 , false); + ret =wait_for_bit_le32 (®->ctrl, +MVEBU_SPI_A3700_XFER_RDY , + true,100 , false);if (ret)return ret;
@@ -231,8 +233,8 @@ static int mvebu_spi_probe(struct udevice *bus)/* Flush read/write FIFO */ data =readl (®->cfg);writel (data |MVEBU_SPI_A3700_FIFO_FLUSH , ®->cfg); - ret =wait_for_bit (__func__, ®->cfg,MVEBU_SPI_A3700_FIFO_FLUSH , - false,1000 , false); + ret =wait_for_bit_le32 (®->cfg,MVEBU_SPI_A3700_FIFO_FLUSH , + false,1000 , false);if (ret)return ret;
drivers/usb/host/dwc2.c +12 -12
@@ -108,8 +108,8 @@ static void dwc_otg_flush_tx_fifo(struct dwc2_core_regs *regs, const int num)writel (DWC2_GRSTCTL_TXFFLSH | (num <<DWC2_GRSTCTL_TXFNUM_OFFSET ), ®s->grstctl); - ret =wait_for_bit (__func__, ®s->grstctl,DWC2_GRSTCTL_TXFFLSH , - false,1000 , false); + ret =wait_for_bit_le32 (®s->grstctl,DWC2_GRSTCTL_TXFFLSH , + false,1000 , false);if (ret)printf ("%s: Timeout!\n" , __func__);
@@ -127,8 +127,8 @@ static void dwc_otg_flush_rx_fifo(struct dwc2_core_regs *regs)int ret;writel (DWC2_GRSTCTL_RXFFLSH , ®s->grstctl); - ret =wait_for_bit (__func__, ®s->grstctl,DWC2_GRSTCTL_RXFFLSH , - false,1000 , false); + ret =wait_for_bit_le32 (®s->grstctl,DWC2_GRSTCTL_RXFFLSH , + false,1000 , false);if (ret)printf ("%s: Timeout!\n" , __func__);
@@ -145,15 +145,15 @@ static void dwc_otg_core_reset(struct dwc2_core_regs *regs)int ret;/* Wait for AHB master IDLE state. */ - ret =wait_for_bit (__func__, ®s->grstctl,DWC2_GRSTCTL_AHBIDLE , - true,1000 , false); + ret =wait_for_bit_le32 (®s->grstctl,DWC2_GRSTCTL_AHBIDLE , + true,1000 , false);if (ret)printf ("%s: Timeout!\n" , __func__);/* Core Soft Reset */ writel (DWC2_GRSTCTL_CSFTRST , ®s->grstctl); - ret =wait_for_bit (__func__, ®s->grstctl,DWC2_GRSTCTL_CSFTRST , - false,1000 , false); + ret =wait_for_bit_le32 (®s->grstctl,DWC2_GRSTCTL_CSFTRST , + false,1000 , false);if (ret)printf ("%s: Timeout!\n" , __func__);
@@ -267,8 +267,8 @@ static void dwc_otg_core_host_init(struct udevice *dev,clrsetbits_le32 (®s->hc_regs[i].hcchar,DWC2_HCCHAR_EPDIR ,DWC2_HCCHAR_CHEN |DWC2_HCCHAR_CHDIS ); - ret =wait_for_bit (__func__, ®s->hc_regs[i].hcchar, -DWC2_HCCHAR_CHEN , false,1000 , false); + ret =wait_for_bit_le32 (®s->hc_regs[i].hcchar, +DWC2_HCCHAR_CHEN , false,1000 , false);if (ret)printf ("%s: Timeout!\n" , __func__); }
@@ -783,8 +783,8 @@ int wait_for_chhltd(struct dwc2_hc_regs *hc_regs, uint32_t *sub, u8 *toggle)int ret;uint32_t hcint, hctsiz; - ret =wait_for_bit (__func__, &hc_regs->hcint,DWC2_HCINT_CHHLTD , true, -1000 , false); + ret =wait_for_bit_le32 (&hc_regs->hcint,DWC2_HCINT_CHHLTD , true, +1000 , false);if (ret)return ret;
drivers/usb/host/ehci-msm.c +1 -2
@@ -133,8 +133,7 @@ static int ehci_usb_remove(struct udevice *dev)setbits_le32 (&ehci->usbcmd,CMD_RESET );/* Wait for reset */ -if (wait_for_bit (__func__, &ehci->usbcmd,CMD_RESET , false,30 , - false)) { +if (wait_for_bit_le32 (&ehci->usbcmd,CMD_RESET , false,30 , false)) {printf ("Stuck on USB reset.\n" );return -ETIMEDOUT ; }
drivers/usb/host/ehci-mx6.c +2 -3
@@ -142,13 +142,12 @@ static int usb_phy_enable(int index, struct usb_ehci *ehci)/* Stop then Reset */ clrbits_le32 (usb_cmd,UCMD_RUN_STOP ); - ret =wait_for_bit (__func__, usb_cmd,UCMD_RUN_STOP , false,10000 , - false); + ret =wait_for_bit_le32 (usb_cmd,UCMD_RUN_STOP , false,10000 , false);if (ret)return ret;setbits_le32 (usb_cmd,UCMD_RESET ); - ret =wait_for_bit (__func__, usb_cmd,UCMD_RESET , false,10000 , false); + ret =wait_for_bit_le32 (usb_cmd,UCMD_RESET , false,10000 , false);if (ret)return ret;
drivers/usb/host/ohci-lpc32xx.c +6 -6
@@ -143,8 +143,8 @@ static int usbpll_setup(void)setbits_le32 (&clk_pwr->usb_ctrl,CLK_USBCTRL_POSTDIV_2POW (0x01 ));setbits_le32 (&clk_pwr->usb_ctrl,CLK_USBCTRL_PLL_PWRUP ); - ret =wait_for_bit (__func__, &clk_pwr->usb_ctrl,CLK_USBCTRL_PLL_STS , - true,CONFIG_SYS_HZ , false); + ret =wait_for_bit_le32 (&clk_pwr->usb_ctrl,CLK_USBCTRL_PLL_STS , + true,CONFIG_SYS_HZ , false);if (ret)return ret;
@@ -178,8 +178,8 @@ int usb_cpu_init(void)/* enable I2C clock */ writel (OTG_CLK_I2C_EN , &otg->otg_clk_ctrl); - ret =wait_for_bit (__func__, &otg->otg_clk_sts,OTG_CLK_I2C_EN , true, -CONFIG_SYS_HZ , false); + ret =wait_for_bit_le32 (&otg->otg_clk_sts,OTG_CLK_I2C_EN , true, +CONFIG_SYS_HZ , false);if (ret)return ret;
@@ -199,8 +199,8 @@ int usb_cpu_init(void)OTG_CLK_I2C_EN |OTG_CLK_HOST_EN ;writel (mask, &otg->otg_clk_ctrl); - ret =wait_for_bit (__func__, &otg->otg_clk_sts, mask, true, -CONFIG_SYS_HZ , false); + ret =wait_for_bit_le32 (&otg->otg_clk_sts, mask, true, +CONFIG_SYS_HZ , false);if (ret)return ret;
drivers/usb/host/xhci-rcar.c +6 -6
@@ -55,18 +55,18 @@ static int xhci_rcar_download_fw(struct rcar_xhci *ctx, const u32 *fw_data,setbits_le32 (regs +RCAR_USB3_DL_CTRL ,RCAR_USB3_DL_CTRL_FW_SET_DATA0 ); - ret =wait_for_bit ("xhci-rcar" , regs +RCAR_USB3_DL_CTRL , -RCAR_USB3_DL_CTRL_FW_SET_DATA0 , false, -10 , false); + ret =wait_for_bit_le32 (regs +RCAR_USB3_DL_CTRL , +RCAR_USB3_DL_CTRL_FW_SET_DATA0 , false, +10 , false);if (ret)break ; }clrbits_le32 (regs +RCAR_USB3_DL_CTRL ,RCAR_USB3_DL_CTRL_ENABLE ); - ret =wait_for_bit ("xhci-rcar" , regs +RCAR_USB3_DL_CTRL , -RCAR_USB3_DL_CTRL_FW_SUCCESS , true, -10 , false); + ret =wait_for_bit_le32 (regs +RCAR_USB3_DL_CTRL , +RCAR_USB3_DL_CTRL_FW_SUCCESS , true, +10 , false);return ret; }
drivers/video/atmel_hlcdfb.c +32 -32
136 lines not on this page · raw message
include/wait_bit.h +0 -54
60 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH v9 3/12 drivers: spi: allow limiting reads
In reply to Álvaro Fernández RojasFor some SPI controllers it's not possible to keep the CS active between transfers and they are limited to a known number of bytes. This splits spi_flash reads into different iterations in order to respect the SPI controller limits.
---
v9: no changes
v8: no changes
v7: no changes
v6: no changes
v5: no changes
v4: no changes
v3: no changes
v2: no changes
drivers/mtd/spi/spi_flash.c | 3 +++ include/spi.h | 3 +++ 2 files changed, 6 insertions(+)
drivers/mtd/spi/spi_flash.c +3 -0
@@ -516,6 +516,9 @@ int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset,else read_len = remain_len; +if (spi->max_read_size) + read_len =min (read_len, spi->max_read_size); +spi_flash_addr (read_addr, cmd); ret =spi_flash_read_common (flash, cmd, cmdsz, data, read_len);
include/spi.h +3 -0
@@ -86,6 +86,8 @@ struct dm_spi_slave_platdata {* @cs: ID of the chip select connected to the slave. * @mode: SPI mode to use for this slave (see SPI mode flags) * @wordlen: Size of SPI word in number of bits +* @max_read_size: If non-zero, the maximum number of bytes which can +* be read at once. * @max_write_size: If non-zero, the maximum number of bytes which can * be written at once, excluding command bytes. * @memory_map: Address of read-only SPI flash access.
@@ -102,6 +104,7 @@ struct spi_slave {#endif uint mode;unsigned int wordlen; +unsigned int max_read_size;unsigned int max_write_size;void *memory_map;
Signature · 1 line
2.11.0
PATCH v9 4/12 drivers: spi: consider command bytes when sending transfers
In reply to Álvaro Fernández RojasCommand bytes are part of the written bytes and they should be taken into account when sending a spi transfer.
---
v9: no changes
v8: no changes
v7: no changes
v6: no changes
v5: no changes
v4: no changes
v3: Fix bug introduced in v2: sizeof(cmd) vs len
v2: Introduce changes requested by Simon Glass:
- Always include command bytes when determining max write size.
drivers/mtd/spi/spi_flash.c | 2 +- include/spi.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/spi/spi_flash.c +1 -1
@@ -405,7 +405,7 @@ int spi_flash_cmd_write_ops(struct spi_flash *flash, u32 offset,if (spi->max_write_size) chunk_len =min (chunk_len, - (size_t )spi->max_write_size); + spi->max_write_size -sizeof (cmd));spi_flash_addr (write_addr, cmd);
include/spi.h +1 -1
@@ -89,7 +89,7 @@ struct dm_spi_slave_platdata {* @max_read_size: If non-zero, the maximum number of bytes which can * be read at once. * @max_write_size: If non-zero, the maximum number of bytes which can -* be written at once, excluding command bytes. +* be written at once. * @memory_map: Address of read-only SPI flash access. * @flags: Indication of SPI flags. */
Signature · 1 line
2.11.0
PATCH v9 5/12 dm: spi: add BCM63xx SPI driver
In reply to Álvaro Fernández RojasThis driver is a simplified version of linux/drivers/spi/spi-bcm63xx.c
---
v9: no changes
v8: no changes
v7: Introduce changes suggested by Daniel Schwierzeck:
- Remove prefix and use __func__ instead.
v6: Introduce changes suggested by Jagan Teki:
- Use cmd instead of val to avoid confusions.
- Switch to wait_for_bit instead of infinite loop.
v5: Introduce changes suggested by Jagan Teki:
- Use long structure instead of a custom bmips_spi_hw structure.
- Define constants for each SPI core.
v4: Introduce changes suggested by Jagan Teki:
- Add data for each HW controller instead of having two separate configs.
- Also check clock and reset returns as suggested by Simon Glass for HSSPI.
v3: rename BCM6338 SPI driver to BCM6348
switch to devfdt_get_addr_size_index()
v2: no changes
drivers/spi/Kconfig | 8 + drivers/spi/Makefile | 1 + drivers/spi/bcm63xx_spi.c | 433 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 442 insertions(+) create mode 100644 drivers/spi/bcm63xx_spi.c
drivers/spi/Kconfig +8 -0
@@ -40,6 +40,14 @@ config ATMEL_SPI many AT91 (ARM) chips. This driver can be used to access the SPI Flash, such as AT25DF321. +config BCM63XX_SPI + bool "BCM6348 SPI driver" + depends on ARCH_BMIPS + help + Enable the BCM6348/BCM6358 SPI driver. This driver can be used to + access the SPI NOR flash on platforms embedding these Broadcom + SPI cores. + config CADENCE_QSPI bool "Cadence QSPI driver" help
drivers/spi/Makefile +1 -0
@@ -18,6 +18,7 @@ endif obj-$(CONFIG_ALTERA_SPI) += altera_spi.o obj-$(CONFIG_ATH79_SPI) += ath79_spi.o obj-$(CONFIG_ATMEL_SPI) += atmel_spi.o +obj-$(CONFIG_BCM63XX_SPI) += bcm63xx_spi.o obj-$(CONFIG_CADENCE_QSPI) += cadence_qspi.o cadence_qspi_apb.o obj-$(CONFIG_CF_SPI) += cf_spi.o obj-$(CONFIG_DAVINCI_SPI) += davinci_spi.o
drivers/spi/bcm63xx_spi.c new file +433 -0
433 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH v9 6/12 mips: bmips: add bcm63xx-spi driver support for BCM6338
In reply to Álvaro Fernández RojasThis driver manages the SPI controller present on this SoC.
---
v9: no changes
v8: no changes
v7: no changes
v6: no changes
v5: no changes
v4: no changes
v3: rename BCM6338 SPI driver to BCM6348
v2: add spi alias
arch/mips/dts/brcm,bcm6338.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/mips/dts/brcm,bcm6338.dtsi +17 -0
@@ -12,6 +12,10 @@ / { compatible = "brcm,bcm6338"; + aliases { + spi0 = &spi; + }; + cpus { reg = <0xfffe0000 0x4>; #address-cells = <1>;
@@ -109,6 +113,19 @@ status = "disabled"; }; + spi: spi at fffe0c00 { + compatible = "brcm,bcm6348-spi"; + reg = <0xfffe0c00 0xc0>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&periph_clk BCM6338_CLK_SPI>; + resets = <&periph_rst BCM6338_RST_SPI>; + spi-max-frequency = <20000000>; + num-cs = <4>; + + status = "disabled"; + }; + memory-controller at fffe3100 { compatible = "brcm,bcm6338-mc"; reg = <0xfffe3100 0x38>;
Signature · 1 line
2.11.0
PATCH v9 7/12 mips: bmips: add bcm63xx-spi driver support for BCM6348
In reply to Álvaro Fernández RojasThis driver manages the SPI controller present on this SoC.
---
v9: no changes
v8: no changes
v7: no changes
v6: no changes
v5: no changes
v4: no changes
v3: rename BCM6338 SPI driver to BCM6348
v2: add spi alias
arch/mips/dts/brcm,bcm6348.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/mips/dts/brcm,bcm6348.dtsi +17 -0
@@ -12,6 +12,10 @@ / { compatible = "brcm,bcm6348"; + aliases { + spi0 = &spi; + }; + cpus { reg = <0xfffe0000 0x4>; #address-cells = <1>;
@@ -118,6 +122,19 @@ status = "disabled"; }; + spi: spi at fffe0c00 { + compatible = "brcm,bcm6348-spi"; + reg = <0xfffe0c00 0xc0>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&periph_clk BCM6348_CLK_SPI>; + resets = <&periph_rst BCM6348_RST_SPI>; + spi-max-frequency = <20000000>; + num-cs = <4>; + + status = "disabled"; + }; + memory-controller at fffe2300 { compatible = "brcm,bcm6338-mc"; reg = <0xfffe2300 0x38>;
Signature · 1 line
2.11.0
PATCH v9 8/12 mips: bmips: add bcm63xx-spi driver support for BCM6358
In reply to Álvaro Fernández RojasThis driver manages the SPI controller present on this SoC.
---
v9: no changes
v8: no changes
v7: no changes
v6: no changes
v5: no changes
v4: no changes
v3: no changes
v2: add spi alias
arch/mips/dts/brcm,bcm6358.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/mips/dts/brcm,bcm6358.dtsi +17 -0
@@ -12,6 +12,10 @@ / { compatible = "brcm,bcm6358"; + aliases { + spi0 = &spi; + }; + cpus { reg = <0xfffe0000 0x4>; #address-cells = <1>;
@@ -142,6 +146,19 @@ status = "disabled"; }; + spi: spi at fffe0800 { + compatible = "brcm,bcm6358-spi"; + reg = <0xfffe0800 0x70c>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&periph_clk BCM6358_CLK_SPI>; + resets = <&periph_rst BCM6358_RST_SPI>; + spi-max-frequency = <20000000>; + num-cs = <4>; + + status = "disabled"; + }; + memory-controller at fffe1200 { compatible = "brcm,bcm6358-mc"; reg = <0xfffe1200 0x4c>;
Signature · 1 line
2.11.0
PATCH v9 9/12 mips: bmips: add bcm63xx-spi driver support for BCM3380
In reply to Álvaro Fernández RojasThis driver manages the SPI controller present on this SoC.
---
v9: no changes
v8: no changes
v7: no changes
v6: no changes
v5: no changes
v4: no changes
v3: no changes
v2: add spi alias
arch/mips/dts/brcm,bcm3380.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/mips/dts/brcm,bcm3380.dtsi +17 -0
@@ -12,6 +12,10 @@ / { compatible = "brcm,bcm3380"; + aliases { + spi0 = &spi; + }; + cpus { reg = <0x14e00000 0x4>; #address-cells = <1>;
@@ -142,6 +146,19 @@ status = "disabled"; }; + spi: spi at 14e02000 { + compatible = "brcm,bcm6358-spi"; + reg = <0x14e02000 0x70c>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&periph_clk0 BCM3380_CLK0_SPI>; + resets = <&periph_rst0 BCM3380_RST0_SPI>; + spi-max-frequency = <25000000>; + num-cs = <6>; + + status = "disabled"; + }; + leds: led-controller at 14e00f00 { compatible = "brcm,bcm6328-leds"; reg = <0x14e00f00 0x1c>;
Signature · 1 line
2.11.0
PATCH v9 10/12 mips: bmips: add bcm63xx-spi driver support for BCM63268
In reply to Álvaro Fernández RojasThis driver manages the low speed SPI controller present on this SoC.
---
v9: no changes
v8: no changes
v7: no changes
v6: no changes
v5: no changes
v4: no changes
v3: no changes
v2: add spi alias
arch/mips/dts/brcm,bcm63268.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/mips/dts/brcm,bcm63268.dtsi +17 -0
@@ -13,6 +13,10 @@ / { compatible = "brcm,bcm63268"; + aliases { + spi0 = &lsspi; + }; + cpus { reg = <0x10000000 0x4>; #address-cells = <1>;
@@ -136,6 +140,19 @@ #power-domain-cells = <1>; }; + lsspi: spi at 10000800 { + compatible = "brcm,bcm6358-spi"; + reg = <0x10000800 0x70c>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&periph_clk BCM63268_CLK_SPI>; + resets = <&periph_rst BCM63268_RST_SPI>; + spi-max-frequency = <20000000>; + num-cs = <8>; + + status = "disabled"; + }; + leds: led-controller at 10001900 { compatible = "brcm,bcm6328-leds"; reg = <0x10001900 0x24>;
Signature · 1 line
2.11.0
PATCH v9 11/12 mips: bmips: enable the SPI flash on the Sagem F@ST1704
In reply to Álvaro Fernández RojasIt's a Winbond (w25x32) 4 MB SPI flash.
---
v9: Introduce changes suggested by Simon Glass:
- Fix defconfig order.
v8: no changes
v7: no changes
v6: no changes
v5: sync with master
v4: switch to CONFIG_BCM63XX_SPI
v3: rename BCM6338 SPI driver to BCM6348
v2: remove spi alias
arch/mips/dts/sagem,f at st1704.dts | 12 ++++++++++++ configs/sagem_f at st1704_ram_defconfig | 8 ++++++++ 2 files changed, 20 insertions(+)
arch/mips/dts/sagem,f at st1704.dts +12 -0
@@ -44,6 +44,18 @@ status = "okay"; }; +&spi { + status = "okay"; + + spi-flash at 0 { + compatible = "spi-flash"; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + spi-max-frequency = <20000000>; + }; +}; + &uart0 { u-boot,dm-pre-reloc; status = "okay";
configs/sagem_f at st1704_ram_defconfig +8 -0
@@ -26,6 +26,8 @@ CONFIG_CMD_MEMINFO=y # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set # CONFIG_CMD_LOADS is not set +CONFIG_CMD_SF=y +CONFIG_CMD_SPI=y # CONFIG_CMD_NET is not set # CONFIG_CMD_NFS is not set # CONFIG_CMD_MISC is not set
@@ -34,8 +36,14 @@ CONFIG_DM_GPIO=y CONFIG_BCM6345_GPIO=y CONFIG_LED=y CONFIG_LED_GPIO=y +CONFIG_DM_SPI_FLASH=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_WINBOND=y +CONFIG_SPI_FLASH_MTD=y CONFIG_DM_RESET=y CONFIG_RESET_BCM6345=y # CONFIG_SPL_SERIAL_PRESENT is not set CONFIG_DM_SERIAL=y CONFIG_BCM6345_SERIAL=y +CONFIG_DM_SPI=y +CONFIG_BCM63XX_SPI=y
Signature · 1 line
2.11.0
PATCH v9 12/12 mips: bmips: enable the SPI flash on the Netgear CG3100D
In reply to Álvaro Fernández RojasIt's a Spansion (s25fl064a) 8 MB SPI flash.
---
v9: Introduce changes suggested by Simon Glass:
- Fix defconfig order.
v8: no changes
v7: no changes
v6: no changes
v5: sync with master
v4: switch to CONFIG_BCM63XX_SPI
v3: no changes
v2: remove spi alias
arch/mips/dts/netgear,cg3100d.dts | 12 ++++++++++++ configs/netgear_cg3100d_ram_defconfig | 8 ++++++++ 2 files changed, 20 insertions(+)
arch/mips/dts/netgear,cg3100d.dts +12 -0
@@ -90,6 +90,18 @@ status = "okay"; }; +&spi { + status = "okay"; + + spi-flash at 0 { + compatible = "spi-flash"; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + spi-max-frequency = <25000000>; + }; +}; + &uart0 { u-boot,dm-pre-reloc; status = "okay";
configs/netgear_cg3100d_ram_defconfig +8 -0
@@ -25,6 +25,8 @@ CONFIG_CMD_MEMINFO=y # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set # CONFIG_CMD_LOADS is not set +CONFIG_CMD_SF=y +CONFIG_CMD_SPI=y # CONFIG_CMD_NET is not set # CONFIG_CMD_NFS is not set # CONFIG_CMD_MISC is not set
@@ -35,9 +37,15 @@ CONFIG_LED=y CONFIG_LED_BCM6328=y CONFIG_LED_BLINK=y CONFIG_LED_GPIO=y +CONFIG_DM_SPI_FLASH=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SPI_FLASH_MTD=y CONFIG_DM_RESET=y CONFIG_RESET_BCM6345=y # CONFIG_SPL_SERIAL_PRESENT is not set CONFIG_DM_SERIAL=y CONFIG_BCM6345_SERIAL=y +CONFIG_DM_SPI=y +CONFIG_BCM63XX_SPI=y CONFIG_WDT_BCM6345=y
Signature · 1 line
2.11.0
v9 cover mips: bmips: add SPI support
In reply to Álvaro Fernández RojasQuoted 28 lines · Álvaro Fernández Rojas
BCM63xx SPI controller is a bit tricky since it doesn't allow keeping CS active between transfers, so I had to modify the
spi_flashdriver in order to allow limiting reads.v9: Introduce changes suggested by Simon Glass:
- Fix defconfig order.
v8: Introduce changes suggested by Jagan Teki & Daniel Schwierzeck:
- Squashwait_bitcommits.
- Remove register param castings.
v7: Introduce changes suggested by Jagan Teki & Daniel Schwierzeck:
- Use const void* reg for compatibility with 64 bit systems.
- Remove prefix and use__func__instead.
- Removewait_for_bitand update callers towait_for_bit_le32.
v6: Introduce changes suggested by Jagan Teki:
- Use cmd instead of val to avoid confusions.
- Switch towait_for_bitinstead of infinite loop.
v5: Introduce changes suggested by Jagan Teki:
- Use long structs for registers
v4: Introduce changes suggested by Jagan Teki:
- Add data for each HW controller instead of having two separate configs.
v3: Fix bug introduced in v2: sizeof(cmd) vs len.
Also rename BCM6338 SPI driver to BCM6348 SPI since BCM6338 is a stripped down version of the BCM6348.
Switch todevfdt_get_addr_size_index().
v2: Introduce changes requested by Simon Glass:
- Always include command bytes when determining max write size. Also move SPI aliases from .dts to .dtsi files.
Quoted 13 lines
Álvaro Fernández Rojas (12):
wait_bit: add 8/16/32 BE/LE versions ofwait_for_bit
wait_bit: usewait_for_bit_le32and removewait_for_bit
drivers: spi: allow limiting reads
drivers: spi: consider command bytes when sending transfers
dm: spi: add BCM63xx SPI driver
mips: bmips: add bcm63xx-spi driver support for BCM6338
mips: bmips: add bcm63xx-spi driver support for BCM6348
mips: bmips: add bcm63xx-spi driver support for BCM6358
mips: bmips: add bcm63xx-spi driver support for BCM3380
mips: bmips: add bcm63xx-spi driver support for BCM63268
mips: bmips: enable the SPI flash on the Sagem F at ST1704
mips: bmips: enable the SPI flash on the Netgear CG3100D
Applied to u-boot-spi/master, thanks!
v10 cover mips: bmips: add SPI support
In reply to Álvaro Fernández RojasBCM63xx SPI controller is a bit tricky since it doesn't allow keeping CS active between transfers, so I had to modify the spi_flash driver in order to allow limiting reads.
v10: Introduce changes reported by Tom Rini & Daniel Schwierzeck:
- Fix undefined BE read functions
v9: Introduce changes suggested by Simon Glass:
- Fix defconfig order.
v8: Introduce changes suggested by Jagan Teki & Daniel Schwierzeck:
- Squash wait_bit commits.
- Remove register param castings.
v7: Introduce changes suggested by Jagan Teki & Daniel Schwierzeck:
- Use const void* reg for compatibility with 64 bit systems.
- Remove prefix and use __func__ instead.
- Remove wait_for_bit and update callers to wait_for_bit_le32.
v6: Introduce changes suggested by Jagan Teki:
- Use cmd instead of val to avoid confusions.
- Switch to wait_for_bit instead of infinite loop.
v5: Introduce changes suggested by Jagan Teki:
- Use long structs for registers
v4: Introduce changes suggested by Jagan Teki:
- Add data for each HW controller instead of having two separate configs.
v3: Fix bug introduced in v2: sizeof(cmd) vs len.
Also rename BCM6338 SPI driver to BCM6348 SPI since BCM6338 is a stripped down version of the BCM6348.
Switch to devfdt_get_addr_size_index().
v2: Introduce changes requested by Simon Glass:
- Always include command bytes when determining max write size. Also move SPI aliases from .dts to .dtsi files.
Álvaro Fernández Rojas (12):
wait_bit: add 8/16/32 BE/LE versions of wait_for_bit
wait_bit: use wait_for_bit_le32 and remove wait_for_bit
drivers: spi: allow limiting reads
drivers: spi: consider command bytes when sending transfers
dm: spi: add BCM63xx SPI driver
mips: bmips: add bcm63xx-spi driver support for BCM6338
mips: bmips: add bcm63xx-spi driver support for BCM6348
mips: bmips: add bcm63xx-spi driver support for BCM6358
mips: bmips: add bcm63xx-spi driver support for BCM3380
mips: bmips: add bcm63xx-spi driver support for BCM63268
mips: bmips: enable the SPI flash on the Sagem F at ST1704
mips: bmips: enable the SPI flash on the Netgear CG3100D
arch/arm/mach-imx/mx6/ddr.c | 22 +- arch/arm/mach-socfpga/clock_manager.c | 4 +- arch/arm/mach-socfpga/clock_manager_gen5.c | 6 +- arch/arm/mach-socfpga/reset_manager_arria10.c | 36 +-- arch/mips/dts/brcm,bcm3380.dtsi | 17 + arch/mips/dts/brcm,bcm63268.dtsi | 17 + arch/mips/dts/brcm,bcm6338.dtsi | 17 + arch/mips/dts/brcm,bcm6348.dtsi | 17 + arch/mips/dts/brcm,bcm6358.dtsi | 17 + arch/mips/dts/netgear,cg3100d.dts | 12 + arch/mips/dts/sagem,f at st1704.dts | 12 + arch/mips/mach-ath79/ar934x/clk.c | 2 +- board/samtec/vining_2000/vining_2000.c | 4 +- configs/netgear_cg3100d_ram_defconfig | 8 + configs/sagem_f at st1704_ram_defconfig | 8 + drivers/clk/clk_pic32.c | 12 +- drivers/clk/renesas/clk-rcar-gen3.c | 4 +- drivers/ddr/microchip/ddr2.c | 8 +- drivers/fpga/socfpga_arria10.c | 17 +- drivers/mmc/msm_sdhci.c | 8 +- drivers/mtd/pic32_flash.c | 4 +- drivers/mtd/spi/spi_flash.c | 5 +- drivers/net/ag7xxx.c | 16 +- drivers/net/dwc_eth_qos.c | 17 +- drivers/net/ethoc.c | 8 +- drivers/net/pic32_eth.c | 12 +- drivers/net/pic32_mdio.c | 28 +- drivers/net/ravb.c | 4 +- drivers/net/xilinx_axi_emac.c | 4 +- drivers/net/zynq_gem.c | 12 +- drivers/reset/sti-reset.c | 4 +- drivers/serial/serial_pic32.c | 4 +- drivers/spi/Kconfig | 8 + drivers/spi/Makefile | 1 + drivers/spi/atmel_spi.c | 4 +- drivers/spi/bcm63xx_spi.c | 433 ++++++++++++++++++++++++++ drivers/spi/cadence_qspi_apb.c | 14 +- drivers/spi/fsl_qspi.c | 20 +- drivers/spi/mvebu_a3700_spi.c | 20 +- drivers/usb/host/dwc2.c | 24 +- drivers/usb/host/ehci-msm.c | 3 +- drivers/usb/host/ehci-mx6.c | 5 +- drivers/usb/host/ohci-lpc32xx.c | 12 +- drivers/usb/host/xhci-rcar.c | 12 +- drivers/video/atmel_hlcdfb.c | 64 ++-- include/spi.h | 5 +- include/wait_bit.h | 85 ++--- 47 files changed, 828 insertions(+), 248 deletions(-) create mode 100644 drivers/spi/bcm63xx_spi.c
Signature · 1 line
2.11.0
PATCH v10 1/12 wait_bit: add 8/16/32 BE/LE versions of wait_for_bit
Add 8/16/32 bits and BE/LE versions of wait_for_bit.
This is needed for reading registers that are not aligned to 32 bits, and for Big Endian platforms.
---
v10: Introduce changes reported by Tom Rini & Daniel Schwierzeck:
- Fix undefined BE read functions
v9: no changes.
v8: no changes.
v7: Introduce changes suggested by Daniel Schwierzeck:
- Use const void* reg for compatibility with 64 bit systems.
- Remove prefix and use __func__ instead.
v6: Introduce changes suggested by Jagan Teki:
- Switch to wait_for_bit instead of infinite loop.
include/wait_bit.h | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+)
include/wait_bit.h +65 -0
@@ -69,5 +69,70 @@ static inline int wait_for_bit(const char *prefix, const u32 *reg, return -ETIMEDOUT; } +/** +* wait_for_bit_x() waits for bit set/cleared in register +* +* Function polls register waiting for specific bit(s) change +* (either 0->1 or 1->0). It can fail under two conditions: +* - Timeout +* - User interaction (CTRL-C) +* Function succeeds only if all bits of masked register are set/cleared +* (depending on set option). +* +* @param reg Register that will be read (using read_x()) +* @param mask Bit(s) of register that must be active +* @param set Selects wait condition (bit set or clear) +* @param timeout_ms Timeout (in milliseconds) +* @param breakable Enables CTRL-C interruption +* @return 0 on success, -ETIMEDOUT or -EINTR on failure +*/ + +#define BUILD_WAIT_FOR_BIT (sfx, type, read) \ + \ +static inline int wait_for_bit_##sfx(const void *reg, \ + const type mask, \ + const bool set, \ + const unsigned int timeout_ms, \ + const bool breakable) \ +{ \ + type val; \ + unsigned long start = get_timer(0); \ + \ + while (1) { \ + val = read(reg); \ + \ + if (!set) \ + val = ~val; \ + \ + if ((val & mask) == mask) \ + return 0; \ + \ + if (get_timer(start) > timeout_ms) \ + break; \ + \ + if (breakable && ctrlc()) { \ + puts("Abort\n"); \ + return -EINTR; \ + } \ + \ + udelay(1); \ + WATCHDOG_RESET(); \ + } \ + \ + debug("%s: Timeout (reg=%p mask=%x wait_set=%i)\n", __func__, \ + reg, mask, set); \ + \ + return -ETIMEDOUT; \ +} + +BUILD_WAIT_FOR_BIT(8, u8, readb) +BUILD_WAIT_FOR_BIT(le16, u16, readw) +#ifdef readw_be +BUILD_WAIT_FOR_BIT(be16, u16, readw_be) +#endif +BUILD_WAIT_FOR_BIT(le32, u32, readl) +#ifdef readl_be +BUILD_WAIT_FOR_BIT(be32, u32, readl_be) +#endif #endif
Signature · 1 line
2.11.0
PATCH v10 2/12 wait_bit: use wait_for_bit_le32 and remove wait_for_bit
In reply to Álvaro Fernández Rojaswait_for_bit callers use the 32 bit LE version
---
v10: no changes
v9: no changes
v8: Introduce changes suggested by Jagan Teki & Daniel Schwierzeck:
- Squash wait_bit commits.
- Remove register param castings.
v7: Introduce changes suggested by Jagan Teki:
- Remove wait_for_bit and update callers to wait_for_bit_le32.
arch/arm/mach-imx/mx6/ddr.c | 22 ++++----- arch/arm/mach-socfpga/clock_manager.c | 4 +- arch/arm/mach-socfpga/clock_manager_gen5.c | 6 +-- arch/arm/mach-socfpga/reset_manager_arria10.c | 36 +++++++-------- arch/mips/mach-ath79/ar934x/clk.c | 2 +- board/samtec/vining_2000/vining_2000.c | 4 +- drivers/clk/clk_pic32.c | 12 ++--- drivers/clk/renesas/clk-rcar-gen3.c | 4 +- drivers/ddr/microchip/ddr2.c | 8 ++-- drivers/fpga/socfpga_arria10.c | 17 +++---- drivers/mmc/msm_sdhci.c | 8 ++-- drivers/mtd/pic32_flash.c | 4 +- drivers/net/ag7xxx.c | 16 +++---- drivers/net/dwc_eth_qos.c | 17 +++---- drivers/net/ethoc.c | 8 ++-- drivers/net/pic32_eth.c | 12 ++--- drivers/net/pic32_mdio.c | 28 ++++++------ drivers/net/ravb.c | 4 +- drivers/net/xilinx_axi_emac.c | 4 +- drivers/net/zynq_gem.c | 12 ++--- drivers/reset/sti-reset.c | 4 +- drivers/serial/serial_pic32.c | 4 +- drivers/spi/atmel_spi.c | 4 +- drivers/spi/cadence_qspi_apb.c | 14 +++--- drivers/spi/fsl_qspi.c | 20 ++++----- drivers/spi/mvebu_a3700_spi.c | 20 +++++---- drivers/usb/host/dwc2.c | 24 +++++----- drivers/usb/host/ehci-msm.c | 3 +- drivers/usb/host/ehci-mx6.c | 5 +-- drivers/usb/host/ohci-lpc32xx.c | 12 ++--- drivers/usb/host/xhci-rcar.c | 12 ++--- drivers/video/atmel_hlcdfb.c | 64 +++++++++++++-------------- include/wait_bit.h | 54 ---------------------- 33 files changed, 205 insertions(+), 263 deletions(-)
arch/arm/mach-imx/mx6/ddr.c +11 -11
@@ -21,10 +21,10 @@ static void reset_read_data_fifos(void)/* Reset data FIFOs twice. */ setbits_le32 (&mmdc0->mpdgctrl0,1 <<31 ); -wait_for_bit ("MMDC" , &mmdc0->mpdgctrl0,1 <<31 ,0 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mpdgctrl0,1 <<31 ,0 ,100 ,0 );setbits_le32 (&mmdc0->mpdgctrl0,1 <<31 ); -wait_for_bit ("MMDC" , &mmdc0->mpdgctrl0,1 <<31 ,0 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mpdgctrl0,1 <<31 ,0 ,100 ,0 ); }static void precharge_all (const bool cs0_enable,const bool cs1_enable)
@@ -39,12 +39,12 @@ static void precharge_all(const bool cs0_enable, const bool cs1_enable)*/ if (cs0_enable) {/* CS0 */ writel (0x04008050 , &mmdc0->mdscr); -wait_for_bit ("MMDC" , &mmdc0->mdscr,1 <<14 ,1 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mdscr,1 <<14 ,1 ,100 ,0 ); }if (cs1_enable) {/* CS1 */ writel (0x04008058 , &mmdc0->mdscr); -wait_for_bit ("MMDC" , &mmdc0->mdscr,1 <<14 ,1 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mdscr,1 <<14 ,1 ,100 ,0 ); } }
@@ -146,7 +146,7 @@ int mmdc_do_write_level_calibration(struct mx6_ddr_sysinfo const *sysinfo)* 7. Upon completion of this process the MMDC de-asserts * the MPWLGCR[HW_WL_EN] */ -wait_for_bit ("MMDC" , &mmdc0->mpwlgcr,1 <<0 ,0 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mpwlgcr,1 <<0 ,0 ,100 ,0 );/* * 8. check for any errors: check both PHYs for x64 configuration,
@@ -278,7 +278,7 @@ int mmdc_do_dqs_calibration(struct mx6_ddr_sysinfo const *sysinfo)writel (0x00008028 , &mmdc0->mdscr);/* poll to make sure the con_ack bit was asserted */ -wait_for_bit ("MMDC" , &mmdc0->mdscr,1 <<14 ,1 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mdscr,1 <<14 ,1 ,100 ,0 );/* * Check MDMISC register CALIB_PER_CS to see which CS calibration
@@ -312,7 +312,7 @@ int mmdc_do_dqs_calibration(struct mx6_ddr_sysinfo const *sysinfo)* this bit until it clears to indicate completion of the write access. */ setbits_le32 (&mmdc0->mpswdar0,1 ); -wait_for_bit ("MMDC" , &mmdc0->mpswdar0,1 <<0 ,0 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mpswdar0,1 <<0 ,0 ,100 ,0 );/* Set the RD_DL_ABS# bits to their default values * (will be calibrated later in the read delay-line calibration).
@@ -359,7 +359,7 @@ int mmdc_do_dqs_calibration(struct mx6_ddr_sysinfo const *sysinfo)setbits_le32 (&mmdc0->mpdgctrl0,5 <<28 );/* Poll for completion. MPDGCTRL0[HW_DG_EN] should be 0 */ -wait_for_bit ("MMDC" , &mmdc0->mpdgctrl0,1 <<28 ,0 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mpdgctrl0,1 <<28 ,0 ,100 ,0 );/* * Check to see if any errors were encountered during calibration
@@ -423,7 +423,7 @@ int mmdc_do_dqs_calibration(struct mx6_ddr_sysinfo const *sysinfo)* setting MPRDDLHWCTL[HW_RD_DL_EN] = 0. Also, ensure that * no error bits were set. */ -wait_for_bit ("MMDC" , &mmdc0->mprddlhwctl,1 <<4 ,0 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mprddlhwctl,1 <<4 ,0 ,100 ,0 );/* check both PHYs for x64 configuration, if x32, check only PHY0 */ if (readl (&mmdc0->mprddlhwctl) &0x0000000f )
@@ -477,7 +477,7 @@ int mmdc_do_dqs_calibration(struct mx6_ddr_sysinfo const *sysinfo)* by setting MPWRDLHWCTL[HW_WR_DL_EN] = 0. * Also, ensure that no error bits were set. */ -wait_for_bit ("MMDC" , &mmdc0->mpwrdlhwctl,1 <<4 ,0 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mpwrdlhwctl,1 <<4 ,0 ,100 ,0 );/* Check both PHYs for x64 configuration, if x32, check only PHY0 */ if (readl (&mmdc0->mpwrdlhwctl) &0x0000000f )
@@ -526,7 +526,7 @@ int mmdc_do_dqs_calibration(struct mx6_ddr_sysinfo const *sysinfo)writel (0x0 , &mmdc0->mdscr);/* CS0 */ /* Poll to make sure the con_ack bit is clear */ -wait_for_bit ("MMDC" , &mmdc0->mdscr,1 <<14 ,0 ,100 ,0 ); +wait_for_bit_le32 (&mmdc0->mdscr,1 <<14 ,0 ,100 ,0 );/* * Print out the registers that were updated as a result
arch/arm/mach-socfpga/clock_manager.c +2 -2
@@ -37,8 +37,8 @@ void cm_wait_for_lock(u32 mask)/* function to poll in the fsm busy bit */ int cm_wait_for_fsm (void ) { -return wait_for_bit (__func__, (const u32 *)&clock_manager_base->stat, -CLKMGR_STAT_BUSY , false,20000 , false); +return wait_for_bit_le32 (&clock_manager_base->stat, +CLKMGR_STAT_BUSY , false,20000 , false); }int set_cpu_clk_info (void )
arch/arm/mach-socfpga/clock_manager_gen5.c +2 -4
@@ -37,15 +37,13 @@ static int cm_write_with_phase(u32 value, u32 reg_address, u32 mask)int ret;/* poll until phase is zero */ - ret =wait_for_bit (__func__, (const u32 *)reg_address, mask, - false,20000 , false); + ret =wait_for_bit_le32 (reg_address, mask, false,20000 , false);if (ret)return ret;writel (value, reg_address); -return wait_for_bit (__func__, (const u32 *)reg_address, mask, - false,20000 , false); +return wait_for_bit_le32 (reg_address, mask, false,20000 , false); }/*
arch/arm/mach-socfpga/reset_manager_arria10.c +18 -18
@@ -222,8 +222,8 @@ int socfpga_reset_deassert_bridges_handoff(void)clrbits_le32 (&reset_manager_base->brgmodrst, mask_rstmgr);/* Poll until all idleack to 0, timeout at 1000ms */ -return wait_for_bit (__func__, &sysmgr_regs->noc_idleack, mask_noc, - false,1000 , false); +return wait_for_bit_le32 (&sysmgr_regs->noc_idleack, mask_noc, + false,1000 , false); }void socfpga_reset_assert_fpga_connected_peripherals (void )
@@ -343,26 +343,26 @@ int socfpga_bridges_reset(void)writel (ALT_SYSMGR_NOC_TMO_EN_SET_MSK , &sysmgr_regs->noc_timeout);/* Poll until all idleack to 1 */ - ret =wait_for_bit (__func__, &sysmgr_regs->noc_idleack, -ALT_SYSMGR_NOC_H2F_SET_MSK | -ALT_SYSMGR_NOC_LWH2F_SET_MSK | -ALT_SYSMGR_NOC_F2H_SET_MSK | -ALT_SYSMGR_NOC_F2SDR0_SET_MSK | -ALT_SYSMGR_NOC_F2SDR1_SET_MSK | -ALT_SYSMGR_NOC_F2SDR2_SET_MSK , - true,10000 , false); + ret =wait_for_bit_le32 (&sysmgr_regs->noc_idleack, +ALT_SYSMGR_NOC_H2F_SET_MSK | +ALT_SYSMGR_NOC_LWH2F_SET_MSK | +ALT_SYSMGR_NOC_F2H_SET_MSK | +ALT_SYSMGR_NOC_F2SDR0_SET_MSK | +ALT_SYSMGR_NOC_F2SDR1_SET_MSK | +ALT_SYSMGR_NOC_F2SDR2_SET_MSK , + true,10000 , false);if (ret)return ret;/* Poll until all idlestatus to 1 */ - ret =wait_for_bit (__func__, &sysmgr_regs->noc_idlestatus, -ALT_SYSMGR_NOC_H2F_SET_MSK | -ALT_SYSMGR_NOC_LWH2F_SET_MSK | -ALT_SYSMGR_NOC_F2H_SET_MSK | -ALT_SYSMGR_NOC_F2SDR0_SET_MSK | -ALT_SYSMGR_NOC_F2SDR1_SET_MSK | -ALT_SYSMGR_NOC_F2SDR2_SET_MSK , - true,10000 , false); + ret =wait_for_bit_le32 (&sysmgr_regs->noc_idlestatus, +ALT_SYSMGR_NOC_H2F_SET_MSK | +ALT_SYSMGR_NOC_LWH2F_SET_MSK | +ALT_SYSMGR_NOC_F2H_SET_MSK | +ALT_SYSMGR_NOC_F2SDR0_SET_MSK | +ALT_SYSMGR_NOC_F2SDR1_SET_MSK | +ALT_SYSMGR_NOC_F2SDR2_SET_MSK , + true,10000 , false);if (ret)return ret;
arch/mips/mach-ath79/ar934x/clk.c +1 -1
@@ -90,7 +90,7 @@ static void ar934x_srif_pll_cfg(void __iomem *pll_reg_base, const u32 srif_val)setbits_be32 (pll_reg_base +0x8 ,BIT (30 ));udelay (5 ); -wait_for_bit ("clk" , pll_reg_base +0xc ,BIT (3 ),1 ,10 ,0 ); +wait_for_bit_le32 (pll_reg_base +0xc ,BIT (3 ),1 ,10 ,0 );clrbits_be32 (pll_reg_base +0x8 ,BIT (30 ));udelay (5 );
board/samtec/vining_2000/vining_2000.c +2 -2
@@ -378,7 +378,7 @@ static int read_adc(u32 *val)/* start auto calibration */ setbits_le32 (b + ADCx_GC, ADCx_GC_CAL); - ret =wait_for_bit ("ADC" , b + ADCx_GC, ADCx_GC_CAL, ADCx_GC_CAL,10 ,0 ); + ret =wait_for_bit_le32 (b + ADCx_GC, ADCx_GC_CAL, ADCx_GC_CAL,10 ,0 );if (ret) goto adc_exit;
@@ -386,7 +386,7 @@ static int read_adc(u32 *val)writel (0 , b + ADCx_HC0);/* wait for conversion */ - ret =wait_for_bit ("ADC" , b + ADCx_HS, ADCx_HS_C0, ADCx_HS_C0,10 ,0 ); + ret =wait_for_bit_le32 (b + ADCx_HS, ADCx_HS_C0, ADCx_HS_C0,10 ,0 );if (ret) goto adc_exit;
drivers/clk/clk_pic32.c +6 -6
@@ -197,8 +197,8 @@ static ulong pic32_set_refclk(struct pic32_clk_priv *priv, int periph,writel (REFO_ON |REFO_OE , reg + _CLR_OFFSET);/* wait till previous src change is active */ -wait_for_bit (__func__, reg,REFO_DIVSW_EN |REFO_ACTIVE , - false,CONFIG_SYS_HZ , false); +wait_for_bit_le32 (reg,REFO_DIVSW_EN |REFO_ACTIVE , + false,CONFIG_SYS_HZ , false);/* parent_id */ v =readl (reg);
@@ -223,8 +223,8 @@ static ulong pic32_set_refclk(struct pic32_clk_priv *priv, int periph,writel (REFO_DIVSW_EN , reg + _SET_OFFSET);/* wait for divider switching to complete */ -return wait_for_bit (__func__, reg,REFO_DIVSW_EN , false, -CONFIG_SYS_HZ , false); +return wait_for_bit_le32 (reg,REFO_DIVSW_EN , false, +CONFIG_SYS_HZ , false); }static ulong pic32_get_refclk (struct pic32_clk_priv *priv,int periph)
@@ -311,8 +311,8 @@ static int pic32_mpll_init(struct pic32_clk_priv *priv)/* Wait for ready */ mask =MPLL_RDY |MPLL_VREG_RDY ; -return wait_for_bit (__func__, priv->syscfg_base +CFGMPLL , mask, - true,get_tbclk (), false); +return wait_for_bit_le32 (priv->syscfg_base +CFGMPLL , mask, + true,get_tbclk (), false); }static void pic32_clk_init (struct udevice *dev)
drivers/clk/renesas/clk-rcar-gen3.c +2 -2
@@ -1046,8 +1046,8 @@ static int gen3_clk_endisable(struct clk *clk, bool enable)if (ret)return ret;clrbits_le32 (priv->base +SMSTPCR (reg), bitmask); -return wait_for_bit ("MSTP" , priv->base +MSTPSR (reg), - bitmask,0 ,100 ,0 ); +return wait_for_bit_le32 (priv->base +MSTPSR (reg), + bitmask,0 ,100 ,0 ); }else {setbits_le32 (priv->base +SMSTPCR (reg), bitmask);return 0 ;
drivers/ddr/microchip/ddr2.c +4 -4
@@ -57,8 +57,8 @@ static int ddr2_phy_calib_start(void)writel (SCL_START |SCL_EN , &ddr2_phy->scl_start);/* Wait for SCL for data byte to pass */ -return wait_for_bit (__func__, &ddr2_phy->scl_start,SCL_LUBPASS , - true,CONFIG_SYS_HZ , false); +return wait_for_bit_le32 (&ddr2_phy->scl_start,SCL_LUBPASS , + true,CONFIG_SYS_HZ , false); }/* DDR2 Controller initialization */
@@ -256,8 +256,8 @@ void ddr2_ctrl_init(void)writel (INIT_START , &ctrl->memcon);/* wait for all host cmds to be transmitted */ -wait_for_bit (__func__, &ctrl->cmdissue,CMD_VALID , false, -CONFIG_SYS_HZ , false); +wait_for_bit_le32 (&ctrl->cmdissue,CMD_VALID , false, +CONFIG_SYS_HZ , false);/* inform all cmds issued, ready for normal operation */ writel (INIT_START |INIT_DONE , &ctrl->memcon);
drivers/fpga/socfpga_arria10.c +7 -10
@@ -62,8 +62,7 @@ int is_fpgamgr_user_mode(void)static int wait_for_user_mode (void ) { -return wait_for_bit (__func__, - &fpga_manager_base->imgcfg_stat, +return wait_for_bit_le32 (&fpga_manager_base->imgcfg_stat,ALT_FPGAMGR_IMGCFG_STAT_F2S_USERMODE_SET_MSK ,1 ,FPGA_TIMEOUT_MSEC , false); }
@@ -115,19 +114,17 @@ static int wait_for_nconfig_pin_and_nstatus_pin(void)/* Poll until f2s_nconfig_pin and f2s_nstatus_pin; loop until de-asserted, * timeout at 1000ms */ -return wait_for_bit (__func__, - &fpga_manager_base->imgcfg_stat, - mask, - false,FPGA_TIMEOUT_MSEC , false); +return wait_for_bit_le32 (&fpga_manager_base->imgcfg_stat, + mask, + false,FPGA_TIMEOUT_MSEC , false); }static int wait_for_f2s_nstatus_pin (unsigned long value) {/* Poll until f2s to specific value, timeout at 1000ms */ -return wait_for_bit (__func__, - &fpga_manager_base->imgcfg_stat, -ALT_FPGAMGR_IMGCFG_STAT_F2S_NSTATUS_PIN_SET_MSK , - value,FPGA_TIMEOUT_MSEC , false); +return wait_for_bit_le32 (&fpga_manager_base->imgcfg_stat, +ALT_FPGAMGR_IMGCFG_STAT_F2S_NSTATUS_PIN_SET_MSK , + value,FPGA_TIMEOUT_MSEC , false); }/* set CD ratio */
drivers/mmc/msm_sdhci.c +4 -4
@@ -109,15 +109,15 @@ static int msm_sdc_probe(struct udevice *dev)/* Wait for reset to be written to register */ -if (wait_for_bit (__func__, prv->base +SDCC_MCI_STATUS2 , -SDCC_MCI_STATUS2_MCI_ACT , false,10 , false)) { +if (wait_for_bit_le32 (prv->base +SDCC_MCI_STATUS2 , +SDCC_MCI_STATUS2_MCI_ACT , false,10 , false)) {printf ("msm_sdhci: reset request failed\n" );return -EIO ; }/* SW reset can take upto 10HCLK + 15MCLK cycles. (min 40us) */ -if (wait_for_bit (__func__, prv->base +SDCC_MCI_POWER , -SDCC_MCI_POWER_SW_RST , false,2 , false)) { +if (wait_for_bit_le32 (prv->base +SDCC_MCI_POWER , +SDCC_MCI_POWER_SW_RST , false,2 , false)) {printf ("msm_sdhci: stuck in reset\n" );return -ETIMEDOUT ; }
drivers/mtd/pic32_flash.c +2 -2
@@ -66,8 +66,8 @@ static inline void flash_initiate_operation(u32 nvmop)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); +int ret =wait_for_bit_le32 (&nvm_regs_p->ctrl.raw, +NVM_WR , false, timeout, false);return ret ?ERR_TIMOUT :ERR_OK ; }
drivers/net/ag7xxx.c +8 -8
@@ -164,8 +164,8 @@ static int ag7xxx_switch_read(struct mii_dev *bus, int addr, int reg, u16 *val)writel (AG7XXX_ETH_MII_MGMT_CMD_READ , regs +AG7XXX_ETH_MII_MGMT_CMD ); - ret =wait_for_bit ("ag7xxx" , regs +AG7XXX_ETH_MII_MGMT_IND , -AG7XXX_ETH_MII_MGMT_IND_BUSY ,0 ,1000 ,0 ); + ret =wait_for_bit_le32 (regs +AG7XXX_ETH_MII_MGMT_IND , +AG7XXX_ETH_MII_MGMT_IND_BUSY ,0 ,1000 ,0 );if (ret)return ret;
@@ -185,8 +185,8 @@ static int ag7xxx_switch_write(struct mii_dev *bus, int addr, int reg, u16 val) regs + AG7XXX_ETH_MII_MGMT_ADDRESS);writel (val, regs +AG7XXX_ETH_MII_MGMT_CTRL ); - ret =wait_for_bit ("ag7xxx" , regs +AG7XXX_ETH_MII_MGMT_IND , -AG7XXX_ETH_MII_MGMT_IND_BUSY ,0 ,1000 ,0 ); + ret =wait_for_bit_le32 (regs +AG7XXX_ETH_MII_MGMT_IND , +AG7XXX_ETH_MII_MGMT_IND_BUSY ,0 ,1000 ,0 );return ret; }
@@ -510,13 +510,13 @@ static void ag7xxx_eth_stop(struct udevice *dev)/* Stop the TX DMA. */ writel (0 , priv->regs +AG7XXX_ETH_DMA_TX_CTRL ); -wait_for_bit ("ag7xxx" , priv->regs +AG7XXX_ETH_DMA_TX_CTRL , ~0 ,0 , -1000 ,0 ); +wait_for_bit_le32 (priv->regs +AG7XXX_ETH_DMA_TX_CTRL , ~0 ,0 , +1000 ,0 );/* Stop the RX DMA. */ writel (0 , priv->regs +AG7XXX_ETH_DMA_RX_CTRL ); -wait_for_bit ("ag7xxx" , priv->regs +AG7XXX_ETH_DMA_RX_CTRL , ~0 ,0 , -1000 ,0 ); +wait_for_bit_le32 (priv->regs +AG7XXX_ETH_DMA_RX_CTRL , ~0 ,0 , +1000 ,0 ); }/*
drivers/net/dwc_eth_qos.c +9 -8
@@ -361,8 +361,9 @@ static void eqos_flush_buffer(void *buf, size_t size)static int eqos_mdio_wait_idle (struct eqos_priv *eqos) { -return wait_for_bit (__func__, &eqos->mac_regs->mdio_address, -EQOS_MAC_MDIO_ADDRESS_GB , false,1000000 , true); +return wait_for_bit_le32 (&eqos->mac_regs->mdio_address, +EQOS_MAC_MDIO_ADDRESS_GB , false, +1000000 , true); } static int eqos_mdio_read(struct mii_dev *bus, int mdio_addr, int mdio_devad,
@@ -588,15 +589,15 @@ static int eqos_calibrate_pads_tegra186(struct udevice *dev)setbits_le32 (&eqos->tegra186_regs->auto_cal_config,EQOS_AUTO_CAL_CONFIG_START |EQOS_AUTO_CAL_CONFIG_ENABLE ); - ret =wait_for_bit (__func__, &eqos->tegra186_regs->auto_cal_status, -EQOS_AUTO_CAL_STATUS_ACTIVE , true,10 , false); + ret =wait_for_bit_le32 (&eqos->tegra186_regs->auto_cal_status, +EQOS_AUTO_CAL_STATUS_ACTIVE , true,10 , false);if (ret) {pr_err ("calibrate didn't start" ); goto failed; } - ret =wait_for_bit (__func__, &eqos->tegra186_regs->auto_cal_status, -EQOS_AUTO_CAL_STATUS_ACTIVE , false,10 , false); + ret =wait_for_bit_le32 (&eqos->tegra186_regs->auto_cal_status, +EQOS_AUTO_CAL_STATUS_ACTIVE , false,10 , false);if (ret) {pr_err ("calibrate didn't finish" ); goto failed;
@@ -862,8 +863,8 @@ static int eqos_start(struct udevice *dev) eqos->reg_access_ok = true; - ret =wait_for_bit (__func__, &eqos->dma_regs->mode, -EQOS_DMA_MODE_SWR , false,10 , false); + ret =wait_for_bit_le32 (&eqos->dma_regs->mode, +EQOS_DMA_MODE_SWR , false,10 , false);if (ret) {pr_err ("EQOS_DMA_MODE_SWR stuck" ); goto err_stop_resets;
drivers/net/ethoc.c +4 -4
@@ -548,8 +548,8 @@ static int ethoc_mdio_read(struct mii_dev *bus, int addr, int devad, int reg)ethoc_write (priv,MIIADDRESS ,MIIADDRESS_ADDR (addr, reg));ethoc_write (priv,MIICOMMAND ,MIICOMMAND_READ ); - rc =wait_for_bit (__func__,ethoc_reg (priv,MIISTATUS ), -MIISTATUS_BUSY , false,CONFIG_SYS_HZ , false); + rc =wait_for_bit_le32 (ethoc_reg (priv,MIISTATUS ), +MIISTATUS_BUSY , false,CONFIG_SYS_HZ , false);if (rc ==0 ) {u32 data =ethoc_read (priv,MIIRX_DATA );
@@ -571,8 +571,8 @@ static int ethoc_mdio_write(struct mii_dev *bus, int addr, int devad, int reg,ethoc_write (priv,MIITX_DATA , val);ethoc_write (priv,MIICOMMAND ,MIICOMMAND_WRITE ); - rc =wait_for_bit (__func__,ethoc_reg (priv,MIISTATUS ), -MIISTATUS_BUSY , false,CONFIG_SYS_HZ , false); + rc =wait_for_bit_le32 (ethoc_reg (priv,MIISTATUS ), +MIISTATUS_BUSY , false,CONFIG_SYS_HZ , false);if (rc ==0 ) {/* reset MII command register */
drivers/net/pic32_eth.c +6 -6
@@ -64,8 +64,8 @@ static int pic32_mii_init(struct pic32eth_dev *priv)writel (ETHCON_ON |ETHCON_TXRTS |ETHCON_RXEN , &ectl_p->con1.clr);/* wait till busy */ -wait_for_bit (__func__, &ectl_p->stat.raw,ETHSTAT_BUSY , false, -CONFIG_SYS_HZ , false); +wait_for_bit_le32 (&ectl_p->stat.raw,ETHSTAT_BUSY , false, +CONFIG_SYS_HZ , false);/* turn controller ON to access PHY over MII */ writel (ETHCON_ON , &ectl_p->con1.set);
@@ -239,8 +239,8 @@ static void pic32_ctrl_reset(struct pic32eth_dev *priv)writel (ETHCON_ON |ETHCON_TXRTS |ETHCON_RXEN , &ectl_p->con1.clr);/* wait till busy */ -wait_for_bit (__func__, &ectl_p->stat.raw,ETHSTAT_BUSY , false, -CONFIG_SYS_HZ , false); +wait_for_bit_le32 (&ectl_p->stat.raw,ETHSTAT_BUSY , false, +CONFIG_SYS_HZ , false);/* decrement received buffcnt to zero. */ while (readl (&ectl_p->stat.raw) ÐSTAT_BUFCNT )writel (ETHCON_BUFCDEC , &ectl_p->con1.set);
@@ -375,8 +375,8 @@ static void pic32_eth_stop(struct udevice *dev)mdelay (10 );/* wait until everything is down */ -wait_for_bit (__func__, &ectl_p->stat.raw,ETHSTAT_BUSY , false, -2 *CONFIG_SYS_HZ , false); +wait_for_bit_le32 (&ectl_p->stat.raw,ETHSTAT_BUSY , false, +2 *CONFIG_SYS_HZ , false);/* clear any existing interrupt event */ writel (0xffffffff , &ectl_p->irq.clr);
drivers/net/pic32_mdio.c +14 -14
@@ -22,8 +22,8 @@ static int pic32_mdio_write(struct mii_dev *bus,struct pic32_mii_regs *mii_regs = bus->priv;/* Wait for the previous operation to finish */ -wait_for_bit (__func__, &mii_regs->mind.raw,MIIMIND_BUSY , - false,CONFIG_SYS_HZ , true); +wait_for_bit_le32 (&mii_regs->mind.raw,MIIMIND_BUSY , + false,CONFIG_SYS_HZ , true);/* Put phyaddr and regaddr into MIIMADD */ v = (addr <<MIIMADD_PHYADDR_SHIFT ) | (reg &MIIMADD_REGADDR );
@@ -36,8 +36,8 @@ static int pic32_mdio_write(struct mii_dev *bus,udelay (12 );/* Wait for write to complete */ -wait_for_bit (__func__, &mii_regs->mind.raw,MIIMIND_BUSY , - false,CONFIG_SYS_HZ , true); +wait_for_bit_le32 (&mii_regs->mind.raw,MIIMIND_BUSY , + false,CONFIG_SYS_HZ , true);return 0 ; }
@@ -48,8 +48,8 @@ static int pic32_mdio_read(struct mii_dev *bus, int addr, int devaddr, int reg)struct pic32_mii_regs *mii_regs = bus->priv;/* Wait for the previous operation to finish */ -wait_for_bit (__func__, &mii_regs->mind.raw,MIIMIND_BUSY , - false,CONFIG_SYS_HZ , true); +wait_for_bit_le32 (&mii_regs->mind.raw,MIIMIND_BUSY , + false,CONFIG_SYS_HZ , true);/* Put phyaddr and regaddr into MIIMADD */ v = (addr <<MIIMADD_PHYADDR_SHIFT ) | (reg &MIIMADD_REGADDR );
@@ -62,9 +62,9 @@ static int pic32_mdio_read(struct mii_dev *bus, int addr, int devaddr, int reg)udelay (12 );/* Wait for read to complete */ -wait_for_bit (__func__, &mii_regs->mind.raw, -MIIMIND_NOTVALID |MIIMIND_BUSY , - false,CONFIG_SYS_HZ , false); +wait_for_bit_le32 (&mii_regs->mind.raw, +MIIMIND_NOTVALID |MIIMIND_BUSY , + false,CONFIG_SYS_HZ , false);/* Clear the command register */ writel (0 , &mii_regs->mcmd.raw);
@@ -82,22 +82,22 @@ static int pic32_mdio_reset(struct mii_dev *bus)writel (MIIMCFG_RSTMGMT , &mii_regs->mcfg.raw);/* Wait for the operation to finish */ -wait_for_bit (__func__, &mii_regs->mind.raw,MIIMIND_BUSY , +wait_for_bit_le32 (&mii_regs->mind.raw,MIIMIND_BUSY , false,CONFIG_SYS_HZ , true);/* Clear reset bit */ writel (0 , &mii_regs->mcfg);/* Wait for the operation to finish */ -wait_for_bit (__func__, &mii_regs->mind.raw,MIIMIND_BUSY , - false,CONFIG_SYS_HZ , true); +wait_for_bit_le32 (&mii_regs->mind.raw,MIIMIND_BUSY , + false,CONFIG_SYS_HZ , true);/* Set the MII Management Clock (MDC) - no faster than 2.5 MHz */ writel (MIIMCFG_CLKSEL_DIV40 , &mii_regs->mcfg.raw);/* Wait for the operation to finish */ -wait_for_bit (__func__, &mii_regs->mind.raw,MIIMIND_BUSY , - false,CONFIG_SYS_HZ , true); +wait_for_bit_le32 (&mii_regs->mind.raw,MIIMIND_BUSY , + false,CONFIG_SYS_HZ , true);return 0 ; }
drivers/net/ravb.c +2 -2
@@ -222,8 +222,8 @@ static int ravb_reset(struct udevice *dev)writel (CCC_OPC_CONFIG , eth->iobase +RAVB_REG_CCC );/* Check the operating mode is changed to the config mode. */ -return wait_for_bit (dev->name, (void *)eth->iobase +RAVB_REG_CSR , -CSR_OPS_CONFIG , true,100 , true); +return wait_for_bit_le32 (eth->iobase +RAVB_REG_CSR , +CSR_OPS_CONFIG , true,100 , true); }static void ravb_base_desc_init (struct ravb_priv *eth)
drivers/net/xilinx_axi_emac.c +2 -2
@@ -366,8 +366,8 @@ static int axi_ethernet_init(struct axidma_priv *priv)* processor mode and hence bypass in this mode */ if (!priv->eth_hasnobuf) { - err =wait_for_bit (__func__, (const u32 *)®s->is, -XAE_INT_MGTRDY_MASK , true,200 , false); + err =wait_for_bit_le32 (®s->is,XAE_INT_MGTRDY_MASK , + true,200 , false);if (err) {printf ("%s: Timeout\n" , __func__);return 1 ;
drivers/net/zynq_gem.c +6 -6
@@ -192,8 +192,8 @@ static u32 phy_setup_op(struct zynq_gem_priv *priv, u32 phy_addr, u32 regnum,struct zynq_gem_regs *regs = priv->iobase;int err; - err =wait_for_bit (__func__, ®s->nwsr,ZYNQ_GEM_NWSR_MDIOIDLE_MASK , - true,20000 , false); + err =wait_for_bit_le32 (®s->nwsr,ZYNQ_GEM_NWSR_MDIOIDLE_MASK , + true,20000 , false);if (err)return err;
@@ -205,8 +205,8 @@ static u32 phy_setup_op(struct zynq_gem_priv *priv, u32 phy_addr, u32 regnum,/* Write mgtcr and wait for completion */ writel (mgtcr, ®s->phymntnc); - err =wait_for_bit (__func__, ®s->nwsr,ZYNQ_GEM_NWSR_MDIOIDLE_MASK , - true,20000 , false); + err =wait_for_bit_le32 (®s->nwsr,ZYNQ_GEM_NWSR_MDIOIDLE_MASK , + true,20000 , false);if (err)return err;
@@ -514,8 +514,8 @@ static int zynq_gem_send(struct udevice *dev, void *ptr, int len)if (priv->tx_bd->status &ZYNQ_GEM_TXBUF_EXHAUSTED )printf ("TX buffers exhausted in mid frame\n" ); -return wait_for_bit (__func__, ®s->txsr,ZYNQ_GEM_TSR_DONE , - true,20000 , true); +return wait_for_bit_le32 (®s->txsr,ZYNQ_GEM_TSR_DONE , + true,20000 , true); }/* Do not check frame_recd flag in rx_status register 0x20 - just poll BD */
drivers/reset/sti-reset.c +2 -2
@@ -266,8 +266,8 @@ static int sti_reset_program_hw(struct reset_ctl *reset_ctl, int assert)return 0 ; reg = (void __iomem *)base + ch->ack_offset; -if (wait_for_bit (__func__, reg,BIT (ch->ack_bit), ctrl_val, -1000 , false)) { +if (wait_for_bit_le32 (reg,BIT (ch->ack_bit), ctrl_val, +1000 , false)) {pr_err ("Stuck on waiting ack reset_ctl=%p dev=%p id=%lu\n" , reset_ctl, reset_ctl->dev, reset_ctl->id);
drivers/serial/serial_pic32.c +2 -2
@@ -51,8 +51,8 @@ static int pic32_serial_init(void __iomem *base, ulong clk, u32 baudrate)u32 div =DIV_ROUND_CLOSEST (clk, baudrate *16 );/* wait for TX FIFO to empty */ -wait_for_bit (__func__, base +U_STA ,UART_TX_EMPTY , - true,CONFIG_SYS_HZ , false); +wait_for_bit_le32 (base +U_STA ,UART_TX_EMPTY , + true,CONFIG_SYS_HZ , false);/* send break */ writel (UART_TX_BRK , base +U_STASET );
drivers/spi/atmel_spi.c +2 -2
@@ -394,8 +394,8 @@ out:* Wait until the transfer is completely done before * we deactivate CS. */ -wait_for_bit (__func__, ®_base->sr, -ATMEL_SPI_SR_TXEMPTY , true,1000 , false); +wait_for_bit_le32 (®_base->sr, +ATMEL_SPI_SR_TXEMPTY , true,1000 , false);atmel_spi_cs_deactivate (dev); }
drivers/spi/cadence_qspi_apb.c +7 -7
@@ -675,8 +675,8 @@ int cadence_qspi_apb_indirect_read_execute(struct cadence_spi_platdata *plat, }/* Check indirect done status */ - ret =wait_for_bit ("QSPI" , plat->regbase +CQSPI_REG_INDIRECTRD , -CQSPI_REG_INDIRECTRD_DONE ,1 ,10 ,0 ); + ret =wait_for_bit_le32 (plat->regbase +CQSPI_REG_INDIRECTRD , +CQSPI_REG_INDIRECTRD_DONE ,1 ,10 ,0 );if (ret) {printf ("Indirect read completion error (%i)\n" , ret); goto failrd;
@@ -762,9 +762,9 @@ int cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat, bb_txbuf +rounddown (write_bytes,4 ), write_bytes % 4); - ret =wait_for_bit ("QSPI" , plat->regbase +CQSPI_REG_SDRAMLEVEL , -CQSPI_REG_SDRAMLEVEL_WR_MASK << -CQSPI_REG_SDRAMLEVEL_WR_LSB ,0 ,10 ,0 ); + ret =wait_for_bit_le32 (plat->regbase +CQSPI_REG_SDRAMLEVEL , +CQSPI_REG_SDRAMLEVEL_WR_MASK << +CQSPI_REG_SDRAMLEVEL_WR_LSB ,0 ,10 ,0 );if (ret) {printf ("Indirect write timed out (%i)\n" , ret); goto failwr;
@@ -775,8 +775,8 @@ int cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat, }/* Check indirect done status */ - ret =wait_for_bit ("QSPI" , plat->regbase +CQSPI_REG_INDIRECTWR , -CQSPI_REG_INDIRECTWR_DONE ,1 ,10 ,0 ); + ret =wait_for_bit_le32 (plat->regbase +CQSPI_REG_INDIRECTWR , +CQSPI_REG_INDIRECTWR_DONE ,1 ,10 ,0 );if (ret) {printf ("Indirect write completion error (%i)\n" , ret); goto failwr;
drivers/spi/fsl_qspi.c +10 -10
@@ -1018,11 +1018,11 @@ static int fsl_qspi_probe(struct udevice *bus) priv->num_chipselect = plat->num_chipselect;/* make sure controller is not busy anywhere */ - ret =wait_for_bit (__func__, &priv->regs->sr, -QSPI_SR_BUSY_MASK | -QSPI_SR_AHB_ACC_MASK | -QSPI_SR_IP_ACC_MASK , - false,100 , false); + ret =wait_for_bit_le32 (&priv->regs->sr, +QSPI_SR_BUSY_MASK | +QSPI_SR_AHB_ACC_MASK | +QSPI_SR_IP_ACC_MASK , + false,100 , false);if (ret) {debug ("ERROR : The controller is busy\n" );
@@ -1185,11 +1185,11 @@ static int fsl_qspi_claim_bus(struct udevice *dev) priv =dev_get_priv (bus);/* make sure controller is not busy anywhere */ - ret =wait_for_bit (__func__, &priv->regs->sr, -QSPI_SR_BUSY_MASK | -QSPI_SR_AHB_ACC_MASK | -QSPI_SR_IP_ACC_MASK , - false,100 , false); + ret =wait_for_bit_le32 (&priv->regs->sr, +QSPI_SR_BUSY_MASK | +QSPI_SR_AHB_ACC_MASK | +QSPI_SR_IP_ACC_MASK , + false,100 , false);if (ret) {debug ("ERROR : The controller is busy\n" );
drivers/spi/mvebu_a3700_spi.c +11 -9
@@ -95,8 +95,9 @@ static int spi_legacy_shift_byte(struct spi_reg *reg, unsigned int bytelen, din_8 = din;while (bytelen) { - ret =wait_for_bit (__func__, ®->ctrl, -MVEBU_SPI_A3700_XFER_RDY , true,100 , false); + ret =wait_for_bit_le32 (®->ctrl, +MVEBU_SPI_A3700_XFER_RDY , + true,100 , false);if (ret)return ret;
@@ -109,9 +110,9 @@ static int spi_legacy_shift_byte(struct spi_reg *reg, unsigned int bytelen,writel (pending_dout, ®->dout);if (din) { - ret =wait_for_bit (__func__, ®->ctrl, -MVEBU_SPI_A3700_XFER_RDY , - true,100 , false); + ret =wait_for_bit_le32 (®->ctrl, +MVEBU_SPI_A3700_XFER_RDY , + true,100 , false);if (ret)return ret;
@@ -160,8 +161,9 @@ static int mvebu_spi_xfer(struct udevice *dev, unsigned int bitlen,/* Deactivate CS */ if (flags &SPI_XFER_END ) { - ret =wait_for_bit (__func__, ®->ctrl, -MVEBU_SPI_A3700_XFER_RDY , true,100 , false); + ret =wait_for_bit_le32 (®->ctrl, +MVEBU_SPI_A3700_XFER_RDY , + true,100 , false);if (ret)return ret;
@@ -231,8 +233,8 @@ static int mvebu_spi_probe(struct udevice *bus)/* Flush read/write FIFO */ data =readl (®->cfg);writel (data |MVEBU_SPI_A3700_FIFO_FLUSH , ®->cfg); - ret =wait_for_bit (__func__, ®->cfg,MVEBU_SPI_A3700_FIFO_FLUSH , - false,1000 , false); + ret =wait_for_bit_le32 (®->cfg,MVEBU_SPI_A3700_FIFO_FLUSH , + false,1000 , false);if (ret)return ret;
drivers/usb/host/dwc2.c +12 -12
@@ -108,8 +108,8 @@ static void dwc_otg_flush_tx_fifo(struct dwc2_core_regs *regs, const int num)writel (DWC2_GRSTCTL_TXFFLSH | (num <<DWC2_GRSTCTL_TXFNUM_OFFSET ), ®s->grstctl); - ret =wait_for_bit (__func__, ®s->grstctl,DWC2_GRSTCTL_TXFFLSH , - false,1000 , false); + ret =wait_for_bit_le32 (®s->grstctl,DWC2_GRSTCTL_TXFFLSH , + false,1000 , false);if (ret)printf ("%s: Timeout!\n" , __func__);
@@ -127,8 +127,8 @@ static void dwc_otg_flush_rx_fifo(struct dwc2_core_regs *regs)int ret;writel (DWC2_GRSTCTL_RXFFLSH , ®s->grstctl); - ret =wait_for_bit (__func__, ®s->grstctl,DWC2_GRSTCTL_RXFFLSH , - false,1000 , false); + ret =wait_for_bit_le32 (®s->grstctl,DWC2_GRSTCTL_RXFFLSH , + false,1000 , false);if (ret)printf ("%s: Timeout!\n" , __func__);
@@ -145,15 +145,15 @@ static void dwc_otg_core_reset(struct dwc2_core_regs *regs)int ret;/* Wait for AHB master IDLE state. */ - ret =wait_for_bit (__func__, ®s->grstctl,DWC2_GRSTCTL_AHBIDLE , - true,1000 , false); + ret =wait_for_bit_le32 (®s->grstctl,DWC2_GRSTCTL_AHBIDLE , + true,1000 , false);if (ret)printf ("%s: Timeout!\n" , __func__);/* Core Soft Reset */ writel (DWC2_GRSTCTL_CSFTRST , ®s->grstctl); - ret =wait_for_bit (__func__, ®s->grstctl,DWC2_GRSTCTL_CSFTRST , - false,1000 , false); + ret =wait_for_bit_le32 (®s->grstctl,DWC2_GRSTCTL_CSFTRST , + false,1000 , false);if (ret)printf ("%s: Timeout!\n" , __func__);
@@ -267,8 +267,8 @@ static void dwc_otg_core_host_init(struct udevice *dev,clrsetbits_le32 (®s->hc_regs[i].hcchar,DWC2_HCCHAR_EPDIR ,DWC2_HCCHAR_CHEN |DWC2_HCCHAR_CHDIS ); - ret =wait_for_bit (__func__, ®s->hc_regs[i].hcchar, -DWC2_HCCHAR_CHEN , false,1000 , false); + ret =wait_for_bit_le32 (®s->hc_regs[i].hcchar, +DWC2_HCCHAR_CHEN , false,1000 , false);if (ret)printf ("%s: Timeout!\n" , __func__); }
@@ -783,8 +783,8 @@ int wait_for_chhltd(struct dwc2_hc_regs *hc_regs, uint32_t *sub, u8 *toggle)int ret;uint32_t hcint, hctsiz; - ret =wait_for_bit (__func__, &hc_regs->hcint,DWC2_HCINT_CHHLTD , true, -1000 , false); + ret =wait_for_bit_le32 (&hc_regs->hcint,DWC2_HCINT_CHHLTD , true, +1000 , false);if (ret)return ret;
drivers/usb/host/ehci-msm.c +1 -2
@@ -133,8 +133,7 @@ static int ehci_usb_remove(struct udevice *dev)setbits_le32 (&ehci->usbcmd,CMD_RESET );/* Wait for reset */ -if (wait_for_bit (__func__, &ehci->usbcmd,CMD_RESET , false,30 , - false)) { +if (wait_for_bit_le32 (&ehci->usbcmd,CMD_RESET , false,30 , false)) {printf ("Stuck on USB reset.\n" );return -ETIMEDOUT ; }
drivers/usb/host/ehci-mx6.c +2 -3
@@ -142,13 +142,12 @@ static int usb_phy_enable(int index, struct usb_ehci *ehci)/* Stop then Reset */ clrbits_le32 (usb_cmd,UCMD_RUN_STOP ); - ret =wait_for_bit (__func__, usb_cmd,UCMD_RUN_STOP , false,10000 , - false); + ret =wait_for_bit_le32 (usb_cmd,UCMD_RUN_STOP , false,10000 , false);if (ret)return ret;setbits_le32 (usb_cmd,UCMD_RESET ); - ret =wait_for_bit (__func__, usb_cmd,UCMD_RESET , false,10000 , false); + ret =wait_for_bit_le32 (usb_cmd,UCMD_RESET , false,10000 , false);if (ret)return ret;
drivers/usb/host/ohci-lpc32xx.c +6 -6
@@ -143,8 +143,8 @@ static int usbpll_setup(void)setbits_le32 (&clk_pwr->usb_ctrl,CLK_USBCTRL_POSTDIV_2POW (0x01 ));setbits_le32 (&clk_pwr->usb_ctrl,CLK_USBCTRL_PLL_PWRUP ); - ret =wait_for_bit (__func__, &clk_pwr->usb_ctrl,CLK_USBCTRL_PLL_STS , - true,CONFIG_SYS_HZ , false); + ret =wait_for_bit_le32 (&clk_pwr->usb_ctrl,CLK_USBCTRL_PLL_STS , + true,CONFIG_SYS_HZ , false);if (ret)return ret;
@@ -178,8 +178,8 @@ int usb_cpu_init(void)/* enable I2C clock */ writel (OTG_CLK_I2C_EN , &otg->otg_clk_ctrl); - ret =wait_for_bit (__func__, &otg->otg_clk_sts,OTG_CLK_I2C_EN , true, -CONFIG_SYS_HZ , false); + ret =wait_for_bit_le32 (&otg->otg_clk_sts,OTG_CLK_I2C_EN , true, +CONFIG_SYS_HZ , false);if (ret)return ret;
@@ -199,8 +199,8 @@ int usb_cpu_init(void)OTG_CLK_I2C_EN |OTG_CLK_HOST_EN ;writel (mask, &otg->otg_clk_ctrl); - ret =wait_for_bit (__func__, &otg->otg_clk_sts, mask, true, -CONFIG_SYS_HZ , false); + ret =wait_for_bit_le32 (&otg->otg_clk_sts, mask, true, +CONFIG_SYS_HZ , false);if (ret)return ret;
drivers/usb/host/xhci-rcar.c +6 -6
@@ -55,18 +55,18 @@ static int xhci_rcar_download_fw(struct rcar_xhci *ctx, const u32 *fw_data,setbits_le32 (regs +RCAR_USB3_DL_CTRL ,RCAR_USB3_DL_CTRL_FW_SET_DATA0 ); - ret =wait_for_bit ("xhci-rcar" , regs +RCAR_USB3_DL_CTRL , -RCAR_USB3_DL_CTRL_FW_SET_DATA0 , false, -10 , false); + ret =wait_for_bit_le32 (regs +RCAR_USB3_DL_CTRL , +RCAR_USB3_DL_CTRL_FW_SET_DATA0 , false, +10 , false);if (ret)break ; }clrbits_le32 (regs +RCAR_USB3_DL_CTRL ,RCAR_USB3_DL_CTRL_ENABLE ); - ret =wait_for_bit ("xhci-rcar" , regs +RCAR_USB3_DL_CTRL , -RCAR_USB3_DL_CTRL_FW_SUCCESS , true, -10 , false); + ret =wait_for_bit_le32 (regs +RCAR_USB3_DL_CTRL , +RCAR_USB3_DL_CTRL_FW_SUCCESS , true, +10 , false);return ret; }
drivers/video/atmel_hlcdfb.c +32 -32
136 lines not on this page · raw message
include/wait_bit.h +0 -54
60 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH v10 3/12 drivers: spi: allow limiting reads
In reply to Álvaro Fernández RojasFor some SPI controllers it's not possible to keep the CS active between transfers and they are limited to a known number of bytes. This splits spi_flash reads into different iterations in order to respect the SPI controller limits.
---
v10: no changes
v9: no changes
v8: no changes
v7: no changes
v6: no changes
v5: no changes
v4: no changes
v3: no changes
v2: no changes
drivers/mtd/spi/spi_flash.c | 3 +++ include/spi.h | 3 +++ 2 files changed, 6 insertions(+)
drivers/mtd/spi/spi_flash.c +3 -0
@@ -516,6 +516,9 @@ int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset,else read_len = remain_len; +if (spi->max_read_size) + read_len =min (read_len, spi->max_read_size); +spi_flash_addr (read_addr, cmd); ret =spi_flash_read_common (flash, cmd, cmdsz, data, read_len);
include/spi.h +3 -0
@@ -86,6 +86,8 @@ struct dm_spi_slave_platdata {* @cs: ID of the chip select connected to the slave. * @mode: SPI mode to use for this slave (see SPI mode flags) * @wordlen: Size of SPI word in number of bits +* @max_read_size: If non-zero, the maximum number of bytes which can +* be read at once. * @max_write_size: If non-zero, the maximum number of bytes which can * be written at once, excluding command bytes. * @memory_map: Address of read-only SPI flash access.
@@ -102,6 +104,7 @@ struct spi_slave {#endif uint mode;unsigned int wordlen; +unsigned int max_read_size;unsigned int max_write_size;void *memory_map;
Signature · 1 line
2.11.0
PATCH v10 4/12 drivers: spi: consider command bytes when sending transfers
In reply to Álvaro Fernández RojasCommand bytes are part of the written bytes and they should be taken into account when sending a spi transfer.
---
v10: no changes
v9: no changes
v8: no changes
v7: no changes
v6: no changes
v5: no changes
v4: no changes
v3: Fix bug introduced in v2: sizeof(cmd) vs len
v2: Introduce changes requested by Simon Glass:
- Always include command bytes when determining max write size.
drivers/mtd/spi/spi_flash.c | 2 +- include/spi.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/spi/spi_flash.c +1 -1
@@ -405,7 +405,7 @@ int spi_flash_cmd_write_ops(struct spi_flash *flash, u32 offset,if (spi->max_write_size) chunk_len =min (chunk_len, - (size_t )spi->max_write_size); + spi->max_write_size -sizeof (cmd));spi_flash_addr (write_addr, cmd);
include/spi.h +1 -1
@@ -89,7 +89,7 @@ struct dm_spi_slave_platdata {* @max_read_size: If non-zero, the maximum number of bytes which can * be read at once. * @max_write_size: If non-zero, the maximum number of bytes which can -* be written at once, excluding command bytes. +* be written at once. * @memory_map: Address of read-only SPI flash access. * @flags: Indication of SPI flags. */
Signature · 1 line
2.11.0
PATCH v10 5/12 dm: spi: add BCM63xx SPI driver
In reply to Álvaro Fernández RojasThis driver is a simplified version of linux/drivers/spi/spi-bcm63xx.c
---
v10: no changes
v9: no changes
v8: no changes
v7: Introduce changes suggested by Daniel Schwierzeck:
- Remove prefix and use __func__ instead.
v6: Introduce changes suggested by Jagan Teki:
- Use cmd instead of val to avoid confusions.
- Switch to wait_for_bit instead of infinite loop.
v5: Introduce changes suggested by Jagan Teki:
- Use long structure instead of a custom bmips_spi_hw structure.
- Define constants for each SPI core.
v4: Introduce changes suggested by Jagan Teki:
- Add data for each HW controller instead of having two separate configs.
- Also check clock and reset returns as suggested by Simon Glass for HSSPI.
v3: rename BCM6338 SPI driver to BCM6348
switch to devfdt_get_addr_size_index()
v2: no changes
drivers/spi/Kconfig | 8 + drivers/spi/Makefile | 1 + drivers/spi/bcm63xx_spi.c | 433 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 442 insertions(+) create mode 100644 drivers/spi/bcm63xx_spi.c
drivers/spi/Kconfig +8 -0
@@ -40,6 +40,14 @@ config ATMEL_SPI many AT91 (ARM) chips. This driver can be used to access the SPI Flash, such as AT25DF321. +config BCM63XX_SPI + bool "BCM6348 SPI driver" + depends on ARCH_BMIPS + help + Enable the BCM6348/BCM6358 SPI driver. This driver can be used to + access the SPI NOR flash on platforms embedding these Broadcom + SPI cores. + config CADENCE_QSPI bool "Cadence QSPI driver" help
drivers/spi/Makefile +1 -0
@@ -18,6 +18,7 @@ endif obj-$(CONFIG_ALTERA_SPI) += altera_spi.o obj-$(CONFIG_ATH79_SPI) += ath79_spi.o obj-$(CONFIG_ATMEL_SPI) += atmel_spi.o +obj-$(CONFIG_BCM63XX_SPI) += bcm63xx_spi.o obj-$(CONFIG_CADENCE_QSPI) += cadence_qspi.o cadence_qspi_apb.o obj-$(CONFIG_CF_SPI) += cf_spi.o obj-$(CONFIG_DAVINCI_SPI) += davinci_spi.o
drivers/spi/bcm63xx_spi.c new file +433 -0
433 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH v10 6/12 mips: bmips: add bcm63xx-spi driver support for BCM6338
In reply to Álvaro Fernández RojasThis driver manages the SPI controller present on this SoC.
---
v10: no changes
v9: no changes
v8: no changes
v7: no changes
v6: no changes
v5: no changes
v4: no changes
v3: rename BCM6338 SPI driver to BCM6348
v2: add spi alias
arch/mips/dts/brcm,bcm6338.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/mips/dts/brcm,bcm6338.dtsi +17 -0
@@ -12,6 +12,10 @@ / { compatible = "brcm,bcm6338"; + aliases { + spi0 = &spi; + }; + cpus { reg = <0xfffe0000 0x4>; #address-cells = <1>;
@@ -109,6 +113,19 @@ status = "disabled"; }; + spi: spi at fffe0c00 { + compatible = "brcm,bcm6348-spi"; + reg = <0xfffe0c00 0xc0>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&periph_clk BCM6338_CLK_SPI>; + resets = <&periph_rst BCM6338_RST_SPI>; + spi-max-frequency = <20000000>; + num-cs = <4>; + + status = "disabled"; + }; + memory-controller at fffe3100 { compatible = "brcm,bcm6338-mc"; reg = <0xfffe3100 0x38>;
Signature · 1 line
2.11.0
PATCH v10 7/12 mips: bmips: add bcm63xx-spi driver support for BCM6348
In reply to Álvaro Fernández RojasThis driver manages the SPI controller present on this SoC.
---
v10: no changes
v9: no changes
v8: no changes
v7: no changes
v6: no changes
v5: no changes
v4: no changes
v3: rename BCM6338 SPI driver to BCM6348
v2: add spi alias
arch/mips/dts/brcm,bcm6348.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/mips/dts/brcm,bcm6348.dtsi +17 -0
@@ -12,6 +12,10 @@ / { compatible = "brcm,bcm6348"; + aliases { + spi0 = &spi; + }; + cpus { reg = <0xfffe0000 0x4>; #address-cells = <1>;
@@ -118,6 +122,19 @@ status = "disabled"; }; + spi: spi at fffe0c00 { + compatible = "brcm,bcm6348-spi"; + reg = <0xfffe0c00 0xc0>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&periph_clk BCM6348_CLK_SPI>; + resets = <&periph_rst BCM6348_RST_SPI>; + spi-max-frequency = <20000000>; + num-cs = <4>; + + status = "disabled"; + }; + memory-controller at fffe2300 { compatible = "brcm,bcm6338-mc"; reg = <0xfffe2300 0x38>;
Signature · 1 line
2.11.0
PATCH v10 8/12 mips: bmips: add bcm63xx-spi driver support for BCM6358
In reply to Álvaro Fernández RojasThis driver manages the SPI controller present on this SoC.
---
v10: no changes
v9: no changes
v8: no changes
v7: no changes
v6: no changes
v5: no changes
v4: no changes
v3: no changes
v2: add spi alias
arch/mips/dts/brcm,bcm6358.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/mips/dts/brcm,bcm6358.dtsi +17 -0
@@ -12,6 +12,10 @@ / { compatible = "brcm,bcm6358"; + aliases { + spi0 = &spi; + }; + cpus { reg = <0xfffe0000 0x4>; #address-cells = <1>;
@@ -142,6 +146,19 @@ status = "disabled"; }; + spi: spi at fffe0800 { + compatible = "brcm,bcm6358-spi"; + reg = <0xfffe0800 0x70c>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&periph_clk BCM6358_CLK_SPI>; + resets = <&periph_rst BCM6358_RST_SPI>; + spi-max-frequency = <20000000>; + num-cs = <4>; + + status = "disabled"; + }; + memory-controller at fffe1200 { compatible = "brcm,bcm6358-mc"; reg = <0xfffe1200 0x4c>;
Signature · 1 line
2.11.0
PATCH v10 9/12 mips: bmips: add bcm63xx-spi driver support for BCM3380
In reply to Álvaro Fernández RojasThis driver manages the SPI controller present on this SoC.
---
v10: no changes
v9: no changes
v8: no changes
v7: no changes
v6: no changes
v5: no changes
v4: no changes
v3: no changes
v2: add spi alias
arch/mips/dts/brcm,bcm3380.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/mips/dts/brcm,bcm3380.dtsi +17 -0
@@ -12,6 +12,10 @@ / { compatible = "brcm,bcm3380"; + aliases { + spi0 = &spi; + }; + cpus { reg = <0x14e00000 0x4>; #address-cells = <1>;
@@ -142,6 +146,19 @@ status = "disabled"; }; + spi: spi at 14e02000 { + compatible = "brcm,bcm6358-spi"; + reg = <0x14e02000 0x70c>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&periph_clk0 BCM3380_CLK0_SPI>; + resets = <&periph_rst0 BCM3380_RST0_SPI>; + spi-max-frequency = <25000000>; + num-cs = <6>; + + status = "disabled"; + }; + leds: led-controller at 14e00f00 { compatible = "brcm,bcm6328-leds"; reg = <0x14e00f00 0x1c>;
Signature · 1 line
2.11.0
PATCH v10 10/12 mips: bmips: add bcm63xx-spi driver support for BCM63268
In reply to Álvaro Fernández RojasThis driver manages the low speed SPI controller present on this SoC.
---
v10: no changes
v9: no changes
v8: no changes
v7: no changes
v6: no changes
v5: no changes
v4: no changes
v3: no changes
v2: add spi alias
arch/mips/dts/brcm,bcm63268.dtsi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/mips/dts/brcm,bcm63268.dtsi +17 -0
@@ -13,6 +13,10 @@ / { compatible = "brcm,bcm63268"; + aliases { + spi0 = &lsspi; + }; + cpus { reg = <0x10000000 0x4>; #address-cells = <1>;
@@ -136,6 +140,19 @@ #power-domain-cells = <1>; }; + lsspi: spi at 10000800 { + compatible = "brcm,bcm6358-spi"; + reg = <0x10000800 0x70c>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&periph_clk BCM63268_CLK_SPI>; + resets = <&periph_rst BCM63268_RST_SPI>; + spi-max-frequency = <20000000>; + num-cs = <8>; + + status = "disabled"; + }; + leds: led-controller at 10001900 { compatible = "brcm,bcm6328-leds"; reg = <0x10001900 0x24>;
Signature · 1 line
2.11.0
PATCH v10 11/12 mips: bmips: enable the SPI flash on the Sagem F@ST1704
In reply to Álvaro Fernández RojasIt's a Winbond (w25x32) 4 MB SPI flash.
---
v10: no changes
v9: Introduce changes suggested by Simon Glass:
- Fix defconfig order.
v8: no changes
v7: no changes
v6: no changes
v5: sync with master
v4: switch to CONFIG_BCM63XX_SPI
v3: rename BCM6338 SPI driver to BCM6348
v2: remove spi alias
arch/mips/dts/sagem,f at st1704.dts | 12 ++++++++++++ configs/sagem_f at st1704_ram_defconfig | 8 ++++++++ 2 files changed, 20 insertions(+)
arch/mips/dts/sagem,f at st1704.dts +12 -0
@@ -44,6 +44,18 @@ status = "okay"; }; +&spi { + status = "okay"; + + spi-flash at 0 { + compatible = "spi-flash"; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + spi-max-frequency = <20000000>; + }; +}; + &uart0 { u-boot,dm-pre-reloc; status = "okay";
configs/sagem_f at st1704_ram_defconfig +8 -0
@@ -26,6 +26,8 @@ CONFIG_CMD_MEMINFO=y # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set # CONFIG_CMD_LOADS is not set +CONFIG_CMD_SF=y +CONFIG_CMD_SPI=y # CONFIG_CMD_NET is not set # CONFIG_CMD_NFS is not set # CONFIG_CMD_MISC is not set
@@ -34,8 +36,14 @@ CONFIG_DM_GPIO=y CONFIG_BCM6345_GPIO=y CONFIG_LED=y CONFIG_LED_GPIO=y +CONFIG_DM_SPI_FLASH=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_WINBOND=y +CONFIG_SPI_FLASH_MTD=y CONFIG_DM_RESET=y CONFIG_RESET_BCM6345=y # CONFIG_SPL_SERIAL_PRESENT is not set CONFIG_DM_SERIAL=y CONFIG_BCM6345_SERIAL=y +CONFIG_DM_SPI=y +CONFIG_BCM63XX_SPI=y
Signature · 1 line
2.11.0
PATCH v10 12/12 mips: bmips: enable the SPI flash on the Netgear CG3100D
In reply to Álvaro Fernández RojasIt's a Spansion (s25fl064a) 8 MB SPI flash.
---
v10: no changes
v9: Introduce changes suggested by Simon Glass:
- Fix defconfig order.
v8: no changes
v7: no changes
v6: no changes
v5: sync with master
v4: switch to CONFIG_BCM63XX_SPI
v3: no changes
v2: remove spi alias
arch/mips/dts/netgear,cg3100d.dts | 12 ++++++++++++ configs/netgear_cg3100d_ram_defconfig | 8 ++++++++ 2 files changed, 20 insertions(+)
arch/mips/dts/netgear,cg3100d.dts +12 -0
@@ -90,6 +90,18 @@ status = "okay"; }; +&spi { + status = "okay"; + + spi-flash at 0 { + compatible = "spi-flash"; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + spi-max-frequency = <25000000>; + }; +}; + &uart0 { u-boot,dm-pre-reloc; status = "okay";
configs/netgear_cg3100d_ram_defconfig +8 -0
@@ -25,6 +25,8 @@ CONFIG_CMD_MEMINFO=y # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set # CONFIG_CMD_LOADS is not set +CONFIG_CMD_SF=y +CONFIG_CMD_SPI=y # CONFIG_CMD_NET is not set # CONFIG_CMD_NFS is not set # CONFIG_CMD_MISC is not set
@@ -35,9 +37,15 @@ CONFIG_LED=y CONFIG_LED_BCM6328=y CONFIG_LED_BLINK=y CONFIG_LED_GPIO=y +CONFIG_DM_SPI_FLASH=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SPI_FLASH_MTD=y CONFIG_DM_RESET=y CONFIG_RESET_BCM6345=y # CONFIG_SPL_SERIAL_PRESENT is not set CONFIG_DM_SERIAL=y CONFIG_BCM6345_SERIAL=y +CONFIG_DM_SPI=y +CONFIG_BCM63XX_SPI=y CONFIG_WDT_BCM6345=y
Signature · 1 line
2.11.0
v10 cover mips: bmips: add SPI support
In reply to Álvaro Fernández RojasQuoted 30 lines · Álvaro Fernández Rojas
BCM63xx SPI controller is a bit tricky since it doesn't allow keeping CS active between transfers, so I had to modify the
spi_flashdriver in order to allow limiting reads.v10: Introduce changes reported by Tom Rini & Daniel Schwierzeck:
- Fix undefined BE read functions
v9: Introduce changes suggested by Simon Glass:
- Fix defconfig order.
v8: Introduce changes suggested by Jagan Teki & Daniel Schwierzeck:
- Squashwait_bitcommits.
- Remove register param castings.
v7: Introduce changes suggested by Jagan Teki & Daniel Schwierzeck:
- Use const void* reg for compatibility with 64 bit systems.
- Remove prefix and use__func__instead.
- Removewait_for_bitand update callers towait_for_bit_le32.
v6: Introduce changes suggested by Jagan Teki:
- Use cmd instead of val to avoid confusions.
- Switch towait_for_bitinstead of infinite loop.
v5: Introduce changes suggested by Jagan Teki:
- Use long structs for registers
v4: Introduce changes suggested by Jagan Teki:
- Add data for each HW controller instead of having two separate configs.
v3: Fix bug introduced in v2: sizeof(cmd) vs len.
Also rename BCM6338 SPI driver to BCM6348 SPI since BCM6338 is a stripped down version of the BCM6348.
Switch todevfdt_get_addr_size_index().
v2: Introduce changes requested by Simon Glass:
- Always include command bytes when determining max write size. Also move SPI aliases from .dts to .dtsi files.
Quoted 13 lines
Álvaro Fernández Rojas (12):
wait_bit: add 8/16/32 BE/LE versions ofwait_for_bit
wait_bit: usewait_for_bit_le32and removewait_for_bit
drivers: spi: allow limiting reads
drivers: spi: consider command bytes when sending transfers
dm: spi: add BCM63xx SPI driver
mips: bmips: add bcm63xx-spi driver support for BCM6338
mips: bmips: add bcm63xx-spi driver support for BCM6348
mips: bmips: add bcm63xx-spi driver support for BCM6358
mips: bmips: add bcm63xx-spi driver support for BCM3380
mips: bmips: add bcm63xx-spi driver support for BCM63268
mips: bmips: enable the SPI flash on the Sagem F at ST1704
mips: bmips: enable the SPI flash on the Netgear CG3100D
Applied to u-boot-spi/master, thanks!