public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v0 5/5] spi: Add support for Armada 38x second controller
Date: Wed, 28 Oct 2015 17:39:20 +0100	[thread overview]
Message-ID: <5630FA38.5090000@denx.de> (raw)
In-Reply-To: <CAD6G_RQos2Bq3McVCabvATGk1hk11x46LpAn=bANEotb57zBHw@mail.gmail.com>

Hi Dirk,

On 28.10.2015 17:29, Jagan Teki wrote:
> On 28 October 2015 at 21:14,  <dirk.eibach@gdsys.cc> wrote:
>> From: Dirk Eibach <dirk.eibach@gdsys.cc>
>>
>> Armada 38x has two spi controllers.
>>
>> Signed-off-by: Dirk Eibach <dirk.eibach@gdsys.cc>
>> ---
>>
>>   drivers/spi/kirkwood_spi.c | 52 +++++++++++++++++++++++++++++++++++++++-------
>>   1 file changed, 45 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/spi/kirkwood_spi.c b/drivers/spi/kirkwood_spi.c
>> index e7b0982..200c391 100644
>> --- a/drivers/spi/kirkwood_spi.c
>> +++ b/drivers/spi/kirkwood_spi.c
>> @@ -18,17 +18,25 @@
>>   #endif
>>   #include <asm/arch-mvebu/spi.h>
>>
>> -static struct kwspi_registers *spireg =
>> -       (struct kwspi_registers *)MVEBU_SPI_BASE;
>> -
>>   #ifdef CONFIG_KIRKWOOD
>>   static u32 cs_spi_mpp_back[2];
>>   #endif
>>
>> +struct kwspi_slave {
>> +       struct spi_slave slave;
>> +       struct kwspi_registers *spireg;
>> +};
>> +
>> +static inline struct kwspi_slave *to_kwspi(struct spi_slave *slave)
>> +{
>> +       return container_of(slave, struct kwspi_slave, slave);
>> +}
>> +
>>   struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
>>                                  unsigned int max_hz, unsigned int mode)
>>   {
>> -       struct spi_slave *slave;
>> +       struct kwspi_slave *kwspi_slave;
>> +       struct kwspi_registers *spireg;
>>          u32 data;
>>   #ifdef CONFIG_KIRKWOOD
>>          static const u32 kwspi_mpp_config[2][2] = {
>> @@ -40,10 +48,27 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
>>          if (!spi_cs_is_valid(bus, cs))
>>                  return NULL;
>>
>> -       slave = spi_alloc_slave_base(bus, cs);
>> -       if (!slave)
>> +       kwspi_slave = spi_alloc_slave(struct kwspi_slave, bus, cs);
>> +       if (!kwspi_slave)
>>                  return NULL;
>>
>> +       switch (bus) {
>> +       case 0:
>> +               kwspi_slave->spireg = (struct kwspi_registers *)MVEBU_SPI_BASE;
>> +               break;
>> +#ifdef CONFIG_ARMADA_38X
>> +       /* Armada 38x has two SPI controllers */
>
> Can you please add this through driver-model, I understand it's bit
> big task but I can help you at any moment.

Yes, please do. I know this is additional work. But we really need to
get there at some time. And please note that you can use the
runtime SoC detection for this:

	if (mvebu_soc_family() == MVEBU_SOC_A38X)

So no new #idefs are needed in such places.

Thanks,
Stefan

  reply	other threads:[~2015-10-28 16:39 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-28 15:44 [U-Boot] [PATCH v0 0/5] Some improvements for mvebu/a38x dirk.eibach at gdsys.cc
2015-10-28 15:44 ` [U-Boot] [PATCH v0 1/5] pci: mvebu: Fix Armada 38x support dirk.eibach at gdsys.cc
2015-10-28 16:24   ` Stefan Roese
2015-11-17 12:55   ` Anton Schubert
2015-11-18 12:48     ` Dirk Eibach
2015-11-18 13:23       ` Anton Schubert
2015-11-18 14:51         ` Dirk Eibach
2015-10-28 15:44 ` [U-Boot] [PATCH v0 2/5] arm: mvebu: Add gpio support dirk.eibach at gdsys.cc
2015-10-28 16:41   ` Stefan Roese
2015-10-28 15:44 ` [U-Boot] [PATCH v0 3/5] arm: mvebu: Fix SAR1_CPU_CORE_MASK dirk.eibach at gdsys.cc
2015-10-28 16:34   ` Stefan Roese
2015-10-29  9:41     ` Dirk Eibach
2015-10-29  9:45   ` Luka Perkov
2015-10-28 15:44 ` [U-Boot] [PATCH v0 4/5] arm: mvebu: Fix ddr3_init() cpu config dirk.eibach at gdsys.cc
2015-10-28 16:35   ` Stefan Roese
2015-10-29  9:51     ` Dirk Eibach
2015-10-29 10:03       ` Stefan Roese
2016-03-24  8:37   ` Stefan Roese
2015-10-28 15:44 ` [U-Boot] [PATCH v0 5/5] spi: Add support for Armada 38x second controller dirk.eibach at gdsys.cc
2015-10-28 16:29   ` Jagan Teki
2015-10-28 16:39     ` Stefan Roese [this message]
2015-10-29  9:54       ` Dirk Eibach
2015-10-29 10:02         ` Stefan Roese
2015-10-29 10:31           ` Dirk Eibach

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=5630FA38.5090000@denx.de \
    --to=sr@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