diff mbox

[6/8] spi: sirf: set default spi frequency if it is not set

Message ID 1409648557-5470-2-git-send-email-Barry.Song@csr.com (mailing list archive)
State New, archived
Headers show

Commit Message

Barry Song Sept. 2, 2014, 9:02 a.m. UTC
From: Qipan Li <Qipan.Li@csr.com>

give spi a default frequence if it is not set and the value is 0.

Signed-off-by: Qipan Li <Qipan.Li@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
---
 drivers/spi/spi-sirf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Mark Brown Sept. 4, 2014, 10:39 p.m. UTC | #1
On Tue, Sep 02, 2014 at 05:02:35PM +0800, Barry Song wrote:
> From: Qipan Li <Qipan.Li@csr.com>
> 
> give spi a default frequence if it is not set and the value is 0.

I think this is a good idea but I think we should do this in the SPI
core rather than this driver since the same thing is going to apply to
many drivers.  Can you do a patch for that?
Barry Song Sept. 5, 2014, 7:57 a.m. UTC | #2
2014-09-05 6:39 GMT+08:00 Mark Brown <broonie@kernel.org>:
> On Tue, Sep 02, 2014 at 05:02:35PM +0800, Barry Song wrote:
>> From: Qipan Li <Qipan.Li@csr.com>
>>

sorry, this patch actually has no effect now as it is outdated.

>> give spi a default frequence if it is not set and the value is 0.
>
> I think this is a good idea but I think we should do this in the SPI
> core rather than this driver since the same thing is going to apply to
> many drivers.  Can you do a patch for that?
>

this has been done by commit 052eb2d49,  sorry for making noise.

-barry
diff mbox

Patch

diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c
index 7499076..74835c2 100644
--- a/drivers/spi/spi-sirf.c
+++ b/drivers/spi/spi-sirf.c
@@ -134,6 +134,7 @@ 
 	ALIGNED(x->len) && (x->len < 2 * PAGE_SIZE))
 
 #define SIRFSOC_MAX_CMD_BYTES	4
+#define SIRFSOC_SPI_DEFAULT_FREQ 1000000
 
 struct sirfsoc_spi {
 	struct spi_bitbang bitbang;
@@ -630,7 +631,7 @@  static int spi_sirfsoc_setup(struct spi_device *spi)
 	struct sirfsoc_spi *sspi;
 	int ret = 0;
 	if (!spi->max_speed_hz)
-		return -EINVAL;
+		spi->max_speed_hz = SIRFSOC_SPI_DEFAULT_FREQ;
 
 	sspi = spi_master_get_devdata(spi->master);