Re: [U-Boot] [PATCH 07/15] iMX28: Add SPI driver
On Monday, September 12, 2011 00:06:41 Marek Vasut wrote: +struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, + unsigned int max_hz, unsigned int mode) +{ + + mx28_reset_block(ssp_regs-hw_ssp_ctrl0_reg); + + writel(SSP_CTRL0_BUS_WIDTH_ONE_BIT, ssp_regs-hw_ssp_ctrl0); + + reg = SSP_CTRL1_SSP_MODE_SPI | SSP_CTRL1_WORD_LENGTH_EIGHT_BITS; + reg |= (mode SPI_CPOL) ? SSP_CTRL1_POLARITY : 0; + reg |= (mode SPI_CPHA) ? SSP_CTRL1_PHASE : 0; + writel(reg, ssp_regs-hw_ssp_ctrl1); + + writel(0, ssp_regs-hw_ssp_cmd0); + + mx28_set_ssp_busclock(bus, max_hz / 1000); these steps should be done in the claim_bus func +void mxs_spi_start_xfer(struct spi_slave *slave) +void mxs_spi_end_xfer(struct spi_slave *slave) both should be static -mike signature.asc Description: This is a digitally signed message part. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 07/15] iMX28: Add SPI driver
On Monday, September 12, 2011 06:35:10 PM Mike Frysinger wrote: On Monday, September 12, 2011 00:06:41 Marek Vasut wrote: +struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, + unsigned int max_hz, unsigned int mode) +{ + + mx28_reset_block(ssp_regs-hw_ssp_ctrl0_reg); + + writel(SSP_CTRL0_BUS_WIDTH_ONE_BIT, ssp_regs-hw_ssp_ctrl0); + + reg = SSP_CTRL1_SSP_MODE_SPI | SSP_CTRL1_WORD_LENGTH_EIGHT_BITS; + reg |= (mode SPI_CPOL) ? SSP_CTRL1_POLARITY : 0; + reg |= (mode SPI_CPHA) ? SSP_CTRL1_PHASE : 0; + writel(reg, ssp_regs-hw_ssp_ctrl1); + + writel(0, ssp_regs-hw_ssp_cmd0); + + mx28_set_ssp_busclock(bus, max_hz / 1000); these steps should be done in the claim_bus func I don't think so ... I need to access max_hz and mode. This seems more fitting to me. +void mxs_spi_start_xfer(struct spi_slave *slave) +void mxs_spi_end_xfer(struct spi_slave *slave) both should be static -mike ACK Cheers ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 07/15] iMX28: Add SPI driver
On Monday, September 12, 2011 13:42:22 Marek Vasut wrote: On Monday, September 12, 2011 06:35:10 PM Mike Frysinger wrote: On Monday, September 12, 2011 00:06:41 Marek Vasut wrote: +struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, + unsigned int max_hz, unsigned int mode) +{ + + mx28_reset_block(ssp_regs-hw_ssp_ctrl0_reg); + + writel(SSP_CTRL0_BUS_WIDTH_ONE_BIT, ssp_regs-hw_ssp_ctrl0); + + reg = SSP_CTRL1_SSP_MODE_SPI | SSP_CTRL1_WORD_LENGTH_EIGHT_BITS; + reg |= (mode SPI_CPOL) ? SSP_CTRL1_POLARITY : 0; + reg |= (mode SPI_CPHA) ? SSP_CTRL1_PHASE : 0; + writel(reg, ssp_regs-hw_ssp_ctrl1); + + writel(0, ssp_regs-hw_ssp_cmd0); + + mx28_set_ssp_busclock(bus, max_hz / 1000); these steps should be done in the claim_bus func I don't think so ... I need to access max_hz and mode. This seems more fitting to me. that's not how the API works. you create clients, then you acquire the bus for a specific client, do a transfer, and then release it. your bus breaks with the trivial case: - setup slave A - setup slave B - claim bus for slave A - transfer with slave A - uses settings from slave B -mike signature.asc Description: This is a digitally signed message part. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 07/15] iMX28: Add SPI driver
On Monday, September 12, 2011 10:26:11 PM Mike Frysinger wrote: On Monday, September 12, 2011 13:42:22 Marek Vasut wrote: On Monday, September 12, 2011 06:35:10 PM Mike Frysinger wrote: On Monday, September 12, 2011 00:06:41 Marek Vasut wrote: +struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, + unsigned int max_hz, unsigned int mode) +{ + + mx28_reset_block(ssp_regs-hw_ssp_ctrl0_reg); + + writel(SSP_CTRL0_BUS_WIDTH_ONE_BIT, ssp_regs-hw_ssp_ctrl0); + + reg = SSP_CTRL1_SSP_MODE_SPI | SSP_CTRL1_WORD_LENGTH_EIGHT_BITS; + reg |= (mode SPI_CPOL) ? SSP_CTRL1_POLARITY : 0; + reg |= (mode SPI_CPHA) ? SSP_CTRL1_PHASE : 0; + writel(reg, ssp_regs-hw_ssp_ctrl1); + + writel(0, ssp_regs-hw_ssp_cmd0); + + mx28_set_ssp_busclock(bus, max_hz / 1000); these steps should be done in the claim_bus func I don't think so ... I need to access max_hz and mode. This seems more fitting to me. that's not how the API works. you create clients, then you acquire the bus for a specific client, do a transfer, and then release it. your bus breaks with the trivial case: - setup slave A - setup slave B - claim bus for slave A - transfer with slave A - uses settings from slave B -mike Thanks for clearing this, fixed in V3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot