public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] arm, at91: add spi dataflash support for the taurus board
Date: Thu, 02 Oct 2014 07:48:21 +0200	[thread overview]
Message-ID: <542CE725.2010909@denx.de> (raw)
In-Reply-To: <CAD6G_RQjmkoaUb2Z_702W6Z71VE6E99j2N6n7nWpjrAA73n5sA@mail.gmail.com>

Hello Jagan,

Am 01.10.2014 16:30, schrieb Jagan Teki:
> On 1 October 2014 10:56, Heiko Schocher<hs@denx.de>  wrote:
>> Signed-off-by: Heiko Schocher<hs@denx.de>
>> Cc: Andreas Bie?mann<andreas.devel@googlemail.com>
>> Cc: Bo Shen<voice.shen@atmel.com>
>> ---
>>   board/siemens/taurus/taurus.c | 22 ++++++++++++++++++++++
>>   include/configs/taurus.h      | 11 +++++++++++
>>   2 files changed, 33 insertions(+)
>>
>> diff --git a/board/siemens/taurus/taurus.c b/board/siemens/taurus/taurus.c
>> index 673b302..98ce441 100644
>> --- a/board/siemens/taurus/taurus.c
>> +++ b/board/siemens/taurus/taurus.c
>> @@ -22,6 +22,8 @@
>>   #include<asm/arch/gpio.h>
>>   #include<asm/arch/at91sam9_sdramc.h>
>>   #include<atmel_mci.h>
>> +#include<asm/arch/at91_spi.h>
>> +#include<spi.h>
>>
>>   #include<net.h>
>>   #include<netdev.h>
>> @@ -127,6 +129,25 @@ int board_early_init_f(void)
>>          return 0;
>>   }
>>
>> +int spi_cs_is_valid(unsigned int bus, unsigned int cs)
>> +{
>> +       return bus == 0&&  cs == 0;
>> +}
>> +
>> +void spi_cs_activate(struct spi_slave *slave)
>> +{
>> +       at91_set_gpio_value(TAURUS_SPI_CS_PIN, 0);
>> +}
>> +
>> +void spi_cs_deactivate(struct spi_slave *slave)
>> +{
>> +       at91_set_gpio_value(TAURUS_SPI_CS_PIN, 1);
>> +}
>> +
>> +void spi_init_f(void)
>> +{
>> +       /* everything done in board_init */
>> +}
>
> Please don't hold spi variant calls on board files, I guess most of
> the atmel boards does
> the same but try to add them on driver itself.

Heh, good catch ... I did this like the

board/calao/tny_a9260/spi.c
board/calao/sbc35_a9g20/spi.c

boards ... I greped for this function, and it turned out, I did
not need it! So, I remove it in v2.... thanks!

>>   int board_init(void)
>>   {
>>          /* adress of boot parameters */
>> @@ -139,6 +160,7 @@ int board_init(void)
>>   #ifdef CONFIG_MACB
>>          taurus_macb_hw_init();
>>   #endif
>> +       at91_spi0_hw_init(TAURUS_SPI_MASK);
>>
>>          return 0;
>>   }
>> diff --git a/include/configs/taurus.h b/include/configs/taurus.h
>> index aadf4cd..e30542d 100644
>> --- a/include/configs/taurus.h
>> +++ b/include/configs/taurus.h
>> @@ -127,6 +127,17 @@
>>   #define CONFIG_USB_STORAGE
>>   #endif
>>
>> +/* SPI EEPROM */
>> +#define CONFIG_SPI
>> +#define CONFIG_CMD_SPI
>> +#define CONFIG_CMD_SF
>> +#define CONFIG_SPI_FLASH
>> +#define CONFIG_ATMEL_SPI
>> +#define CONFIG_SPI_FLASH_STMICRO
>> +#define CONFIG_SYS_SPI_WRITE_TOUT              (5 * CONFIG_SYS_HZ)
>
> Don't make this as a config option instead define it on driver file.

Ah, I see, this is defined in more than 10 at91 board config files,
and all with the same value ... Ok, I add in drivers/spi/atmel_spi.h

#if !defined(CONFIG_SYS_SPI_WRITE_TOUT)
#define CONFIG_SYS_SPI_WRITE_TOUT (5 * CONFIG_SYS_HZ)
#endif

and remove this define from the board files ...

>> +#define TAURUS_SPI_MASK (1<<  4)
>> +#define TAURUS_SPI_CS_PIN      AT91_PIN_PA3
>> +
>>   /* load address */
>>   #define CONFIG_SYS_LOAD_ADDR                   0x22000000

Thanks!

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

      reply	other threads:[~2014-10-02  5:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-01  5:26 [U-Boot] [PATCH] arm, at91: add spi dataflash support for the taurus board Heiko Schocher
2014-10-01 14:30 ` Jagan Teki
2014-10-02  5:48   ` Heiko Schocher [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=542CE725.2010909@denx.de \
    --to=hs@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox