From: Jagan Teki <jagannadh.teki@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 05/10] SPI: Add Dove SPI driver
Date: Thu, 13 Jun 2013 00:28:02 +0530 [thread overview]
Message-ID: <51B8C4BA.2020708@gmail.com> (raw)
In-Reply-To: <CAD6G_RSJhGse-g=vqwpE+bbF-tTpHZJ7iLUdj9omXRKD5kj-8A@mail.gmail.com>
Hi,
On 03-06-2013 23:50, Jagan Teki wrote:
> Hi,
>
> Looks ok to me as per coding style after a quick look.
>
> On Mon, May 27, 2013 at 12:06 AM, Sascha Silbe <t-uboot@infra-silbe.de> wrote:
>> From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
>>
>> This adds an SPI driver for Marvell Dove SoCs. This driver is taken
>> from kirkwood_spi but removes mpp configuration as dove has dedicated
>> spi pins.
>>
>> As a future clean-up step, the code for orion5x, kirkwood and dove
>> could be merged, with MPP configuration being be handled as part of
>> cpu/board-specific setup.
>>
>> Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
>> Signed-off-by: Sascha Silbe <t-uboot@infra-silbe.de>
>> ---
>> v3->v4: renamed to dove, adjusted description, removed unused
>> variable, made checkpatch clean
>>
>> drivers/spi/Makefile | 1 +
>> drivers/spi/dove_spi.c | 212 +++++++++++++++++++++++++++++++++++++++++++++++++
>> 2 files changed, 213 insertions(+)
>> create mode 100644 drivers/spi/dove_spi.c
>>
>> diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
>> index d08609e..62ad970 100644
>> --- a/drivers/spi/Makefile
>> +++ b/drivers/spi/Makefile
>> @@ -38,6 +38,7 @@ COBJS-$(CONFIG_BFIN_SPI6XX) += bfin_spi6xx.o
>> COBJS-$(CONFIG_CF_SPI) += cf_spi.o
>> COBJS-$(CONFIG_CF_QSPI) += cf_qspi.o
>> COBJS-$(CONFIG_DAVINCI_SPI) += davinci_spi.o
>> +COBJS-$(CONFIG_DOVE_SPI) += dove_spi.o
>> COBJS-$(CONFIG_EXYNOS_SPI) += exynos_spi.o
>> COBJS-$(CONFIG_ICH_SPI) += ich.o
>> COBJS-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o
>> diff --git a/drivers/spi/dove_spi.c b/drivers/spi/dove_spi.c
>> new file mode 100644
>> index 0000000..c61ba89
>> --- /dev/null
>> +++ b/drivers/spi/dove_spi.c
>> @@ -0,0 +1,212 @@
>> +/*
>> + * Marvell Dove SoCs common spi driver
>> + *
>> + * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
>> + * based on kirkwood_spi.c written by
>> + * Prafulla Wadaskar <prafulla@marvell.com>
>> + *
>> + * See file CREDITS for list of people who contributed to this
>> + * project.
>> + *
>> + * This program is free software; you can redistribute it and/or
>> + * modify it under the terms of the GNU General Public License as
>> + * published by the Free Software Foundation; either version 2 of
>> + * the License, or (at your option) any later version.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> + * GNU General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU General Public License
>> + * along with this program; if not, write to the Free Software
>> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
>> + * MA 02110-1301 USA
>> + */
>> +
>> +#include <common.h>
>> +#include <malloc.h>
>> +#include <spi.h>
>> +#include <asm/io.h>
>> +#include <asm/arch/config.h>
>> +
>> +/* SPI Registers on dove SOC */
>> +struct dovespi_registers {
>> + u32 ctrl; /* 0x00 */
>> + u32 cfg; /* 0x04 */
>> + u32 dout; /* 0x08 */
>> + u32 din; /* 0x0c */
>> + u32 irq_cause; /* 0x10 */
>> + u32 irq_mask; /* 0x14 */
>> +};
>> +
>> +#define DOVESPI_CLKPRESCL_MASK 0x1f
>> +#define DOVESPI_CLKPRESCL_MIN 0x12
>> +#define DOVESPI_CSN_ACT 1 /* Activates serial memory interface */
>> +#define DOVESPI_SMEMRDY (1 << 1) /* SerMem Data xfer ready */
>> +#define DOVESPI_IRQUNMASK 1 /* unmask SPI interrupt */
>> +#define DOVESPI_IRQMASK 0 /* mask SPI interrupt */
>> +#define DOVESPI_SMEMRDIRQ 1 /* SerMem data xfer ready irq */
>> +#define DOVESPI_XFERLEN_1BYTE 0
>> +#define DOVESPI_XFERLEN_2BYTE (1 << 5)
>> +#define DOVESPI_XFERLEN_MASK (1 << 5)
>> +#define DOVESPI_ADRLEN_1BYTE 0
>> +#define DOVESPI_ADRLEN_2BYTE (1 << 8)
>> +#define DOVESPI_ADRLEN_3BYTE (2 << 8)
>> +#define DOVESPI_ADRLEN_4BYTE (3 << 8)
>> +#define DOVESPI_ADRLEN_MASK (3 << 8)
>> +#define DOVESPI_TIMEOUT 10000
>> +
>> +static struct dovespi_registers *spireg =
>> + (struct dovespi_registers *)DOVE_SPI_BASE;
>> +
>> +struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
>> + unsigned int max_hz, unsigned int mode)
>> +{
>> + struct spi_slave *slave;
>> + u32 data;
>> +
>> + if (!spi_cs_is_valid(bus, cs))
>> + return NULL;
>> +
>
> Done use the below tag code instead go for spi_alloc_slave()
> see the sample code on "drivers/spi/exynos_spi.c"
>
> ----------------------- TAG+
>> + slave = malloc(sizeof(struct spi_slave));
>> + if (!slave)
>> + return NULL;
>> +
>> + slave->bus = bus;
>> + slave->cs = cs;
>> +
> --------------------- TAG-
>
>> + writel(~DOVESPI_CSN_ACT | DOVESPI_SMEMRDY, &spireg->ctrl);
>> +
>> + /* calculate spi clock prescaller using max_hz */
>> + data = ((CONFIG_SYS_TCLK / 2) / max_hz) + 0x10;
>> + data = data < DOVESPI_CLKPRESCL_MIN ? DOVESPI_CLKPRESCL_MIN : data;
>> + data = data > DOVESPI_CLKPRESCL_MASK ? DOVESPI_CLKPRESCL_MASK : data;
>> +
>> + /* program spi clock prescaller using max_hz */
>> + writel(DOVESPI_ADRLEN_3BYTE | data, &spireg->cfg);
>> + debug("data = 0x%08x\n", data);
>> +
>> + writel(DOVESPI_SMEMRDIRQ, &spireg->irq_cause);
>> + writel(DOVESPI_IRQMASK, &spireg->irq_mask);
>> +
>> + return slave;
>> +}
>> +
>> +void spi_free_slave(struct spi_slave *slave)
>> +{
>> + free(slave);
>> +}
>> +
>> +__attribute__((weak)) int board_spi_claim_bus(struct spi_slave *slave)
>
> Why your using __attribute__((weak)) here, may be use to pre-load the
> symbol library
> but what is the use case here?
>
> --
> Thanks,
> Jagan.
>
Any update on this.
Thanks,
Jagan.
next prev parent reply other threads:[~2013-06-12 18:58 UTC|newest]
Thread overview: 124+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-02 14:36 [U-Boot] [PATCH 00/10] Add Marvell Dove and SolidRun CuBox Sebastian Hesselbarth
2012-12-02 14:36 ` [U-Boot] [PATCH 01/10] ARM: dove: add support for Marvell Dove SoC Sebastian Hesselbarth
2012-12-02 19:03 ` Luka Perkov
2012-12-02 14:36 ` [U-Boot] [PATCH 02/10] GPIO: add gpio driver for Orion SoCs Sebastian Hesselbarth
2012-12-02 14:36 ` [U-Boot] [PATCH 03/10] MMC: sdhci: Add support for dove sdhci Sebastian Hesselbarth
2012-12-02 14:36 ` [U-Boot] [PATCH 04/10] SPI: Add Orion SPI driver Sebastian Hesselbarth
2012-12-02 14:36 ` [U-Boot] [PATCH 05/10] block: mvsata: add dove include Sebastian Hesselbarth
2012-12-02 14:36 ` [U-Boot] [PATCH 06/10] NET: phy: add 88E1310 PHY initialization Sebastian Hesselbarth
2012-12-02 14:36 ` [U-Boot] [PATCH 07/10] NET: mvgbe: add phylib support Sebastian Hesselbarth
2012-12-02 14:36 ` [U-Boot] [PATCH 08/10] NET: mvgbe: add support for Dove Sebastian Hesselbarth
2012-12-02 14:36 ` [U-Boot] [PATCH 09/10] Boards: Add support for SolidRun CuBox Sebastian Hesselbarth
2012-12-02 19:12 ` Luka Perkov
2012-12-02 14:36 ` [U-Boot] [PATCH 10/10] tools: Add support for Dove to kwboot Sebastian Hesselbarth
2012-12-02 19:15 ` Luka Perkov
2012-12-05 22:15 ` Daniel Stodden
2012-12-06 10:59 ` Sebastian Hesselbarth
2012-12-06 18:18 ` Daniel Stodden
2012-12-06 20:18 ` Sebastian Hesselbarth
2012-12-04 8:31 ` [U-Boot] [PATCH v2 00/10] Add Marvell Dove and SolidRun CuBox Sebastian Hesselbarth
2012-12-04 8:31 ` [U-Boot] [PATCH v2 01/10] ARM: dove: add support for Marvell Dove SoC Sebastian Hesselbarth
2013-02-11 3:39 ` Prafulla Wadaskar
2013-03-03 11:31 ` Sebastian Hesselbarth
2013-03-11 7:27 ` Prafulla Wadaskar
2012-12-04 8:31 ` [U-Boot] [PATCH v2 02/10] GPIO: add gpio driver for Orion SoCs Sebastian Hesselbarth
2012-12-04 8:31 ` [U-Boot] [PATCH v2 03/10] MMC: sdhci: Add support for dove sdhci Sebastian Hesselbarth
2012-12-04 8:31 ` [U-Boot] [PATCH v2 04/10] SPI: Add Orion SPI driver Sebastian Hesselbarth
2012-12-04 8:31 ` [U-Boot] [PATCH v2 05/10] block: mvsata: add dove include Sebastian Hesselbarth
2012-12-04 8:31 ` [U-Boot] [PATCH v2 06/10] NET: phy: add 88E1310 PHY initialization Sebastian Hesselbarth
2012-12-04 8:32 ` [U-Boot] [PATCH v2 07/10] NET: mvgbe: add phylib support Sebastian Hesselbarth
2012-12-04 8:32 ` [U-Boot] [PATCH v2 08/10] NET: mvgbe: add support for Dove Sebastian Hesselbarth
2013-07-08 16:00 ` Joe Hershberger
2012-12-04 8:32 ` [U-Boot] [PATCH v2 09/10] Boards: Add support for SolidRun CuBox Sebastian Hesselbarth
2012-12-04 8:32 ` [U-Boot] [PATCH v2 10/10] tools: Add support for Dove to kwboot Sebastian Hesselbarth
2012-12-10 9:39 ` [U-Boot] [PATCH v2 00/10] Add Marvell Dove and SolidRun CuBox Prafulla Wadaskar
2013-01-16 19:25 ` [U-Boot] [PATCH v3 " Sebastian Hesselbarth
2013-01-16 19:25 ` [U-Boot] [PATCH v3 01/10] ARM: dove: add support for Marvell Dove SoC Sebastian Hesselbarth
2013-01-16 19:25 ` [U-Boot] [PATCH v3 02/10] GPIO: add gpio driver for Orion SoCs Sebastian Hesselbarth
2013-02-11 3:39 ` Prafulla Wadaskar
2013-03-03 11:36 ` Sebastian Hesselbarth
2013-03-11 7:12 ` Prafulla Wadaskar
2013-01-16 19:25 ` [U-Boot] [PATCH v3 03/10] MMC: sdhci: Add support for dove sdhci Sebastian Hesselbarth
2013-01-16 19:25 ` [U-Boot] [PATCH v3 04/10] SPI: Add Orion SPI driver Sebastian Hesselbarth
2013-02-11 3:39 ` Prafulla Wadaskar
2013-06-02 19:14 ` Jagan Teki
2013-06-03 17:31 ` Sascha Silbe
2013-06-03 17:35 ` Jagan Teki
2013-06-03 18:03 ` Sascha Silbe
2013-06-03 19:46 ` Sebastian Hesselbarth
2013-01-16 19:25 ` [U-Boot] [PATCH v3 05/10] block: mvsata: add dove include Sebastian Hesselbarth
2013-02-11 3:39 ` Prafulla Wadaskar
2013-01-16 19:25 ` [U-Boot] [PATCH v3 06/10] NET: phy: add 88E1310 PHY initialization Sebastian Hesselbarth
2013-02-11 3:39 ` Prafulla Wadaskar
2013-01-16 19:25 ` [U-Boot] [PATCH v3 07/10] NET: mvgbe: add phylib support Sebastian Hesselbarth
2013-02-11 3:39 ` Prafulla Wadaskar
2013-01-16 19:25 ` [U-Boot] [PATCH v3 08/10] NET: mvgbe: add support for Dove Sebastian Hesselbarth
2013-02-11 3:39 ` Prafulla Wadaskar
2013-03-03 11:43 ` Sebastian Hesselbarth
2013-03-11 7:02 ` Prafulla Wadaskar
2013-01-16 19:25 ` [U-Boot] [PATCH v3 09/10] Boards: Add support for SolidRun CuBox Sebastian Hesselbarth
2013-02-11 3:39 ` Prafulla Wadaskar
2013-01-16 19:25 ` [U-Boot] [PATCH v3 10/10] tools: Add support for Dove to kwboot Sebastian Hesselbarth
2013-02-11 3:39 ` Prafulla Wadaskar
2013-02-11 3:39 ` [U-Boot] [PATCH v3 00/10] Add Marvell Dove and SolidRun CuBox Prafulla Wadaskar
2013-02-11 9:43 ` Sebastian Hesselbarth
2013-02-11 10:08 ` Luka Perkov
2013-02-11 22:46 ` Prafulla Wadaskar
2013-02-14 18:38 ` Jason Cooper
2013-02-14 21:35 ` Daniel Stodden
2013-02-14 21:44 ` Jason Cooper
2013-02-15 19:08 ` Prafulla Wadaskar
2013-05-14 19:38 ` Sascha Silbe
2013-05-26 18:36 ` [U-Boot] [PATCH v4 00/10] Add Marvell Dove and SolidRun CuBox support Sascha Silbe
2013-05-26 18:36 ` [U-Boot] [PATCH v4 01/10] ARM: dove: add support for Marvell Dove SoC Sascha Silbe
2013-05-26 18:36 ` [U-Boot] [PATCH v4 02/10] usb: ehci-marvell: add support for second USB controller Sascha Silbe
2013-05-26 18:36 ` [U-Boot] [PATCH v4 03/10] GPIO: add gpio driver for Dove SoCs Sascha Silbe
2013-05-26 18:36 ` [U-Boot] [PATCH v4 04/10] MMC: sdhci: Add support for dove sdhci Sascha Silbe
2013-05-26 18:36 ` [U-Boot] [PATCH v4 05/10] SPI: Add Dove SPI driver Sascha Silbe
2013-06-03 18:20 ` Jagan Teki
2013-06-12 18:58 ` Jagan Teki [this message]
2013-06-12 19:26 ` Sebastian Hesselbarth
2013-06-12 19:30 ` Jagan Teki
2013-06-12 19:33 ` Sebastian Hesselbarth
2013-06-25 19:33 ` Sascha Silbe
2013-06-25 19:58 ` Sebastian Hesselbarth
2013-06-25 20:38 ` Sascha Silbe
2013-06-25 20:50 ` Sebastian Hesselbarth
2013-06-25 21:27 ` [U-Boot] [PATCH v5 0/8] Add Marvell Dove and SolidRun CuBox support Sascha Silbe
2013-06-25 21:27 ` [U-Boot] [PATCH v5 1/8] ARM: dove: add support for Marvell Dove SoC Sascha Silbe
2013-06-25 22:34 ` Sebastian Hesselbarth
2013-06-26 14:00 ` Wolfgang Denk
2013-06-25 21:27 ` [U-Boot] [PATCH v5 2/8] usb: ehci-marvell: add support for second USB controller Sascha Silbe
2013-06-26 14:04 ` Wolfgang Denk
2013-06-28 22:34 ` Sascha Silbe
2013-06-28 22:34 ` [U-Boot] [PATCH] usb: ehci-marvell: use structs for registers Sascha Silbe
2013-06-29 22:28 ` Marek Vasut
2013-06-29 22:26 ` [U-Boot] [PATCH v5 2/8] usb: ehci-marvell: add support for second USB controller Marek Vasut
2013-06-25 21:27 ` [U-Boot] [PATCH v5 3/8] GPIO: add Dove support to Kirkwood GPIO driver Sascha Silbe
2013-06-25 22:39 ` Sebastian Hesselbarth
2013-06-26 14:09 ` Wolfgang Denk
2013-06-25 21:27 ` [U-Boot] [PATCH v5 4/8] MMC: sdhci: Add support for dove sdhci Sascha Silbe
2013-07-03 15:31 ` Jagan Teki
2013-06-25 21:27 ` [U-Boot] [PATCH v5 5/8] SPI: add Dove support to Kirkwood SPI driver Sascha Silbe
2013-06-25 22:45 ` Sebastian Hesselbarth
2013-06-26 14:11 ` Wolfgang Denk
2013-12-20 19:05 ` Jagan Teki
2014-01-08 12:50 ` Jagan Teki
2013-06-25 21:27 ` [U-Boot] [PATCH v5 6/8] block: mvsata: add dove include Sascha Silbe
2013-06-26 14:11 ` Wolfgang Denk
2013-06-25 21:27 ` [U-Boot] [PATCH v5 7/8] NET: mvgbe: avoid unused variable warning when used without phylib support Sascha Silbe
2013-06-25 21:27 ` [U-Boot] [PATCH v5 8/8] Boards: Add support for SolidRun CuBox Sascha Silbe
2013-06-25 22:53 ` Sebastian Hesselbarth
2013-06-26 14:15 ` Wolfgang Denk
2014-03-03 22:43 ` [U-Boot] Dove / Cubox support patch series (was: Re: [PATCH v4 05/10] SPI: Add Dove SPI driver) Sascha Silbe
2014-03-03 23:48 ` Otavio Salvador
2013-06-25 20:09 ` [U-Boot] [PATCH v4 05/10] SPI: Add Dove SPI driver Sascha Silbe
2013-05-26 18:36 ` [U-Boot] [PATCH v4 06/10] block: mvsata: add dove include Sascha Silbe
2013-05-26 18:37 ` [U-Boot] [PATCH v4 07/10] NET: phy: add 88E1310 PHY initialization Sascha Silbe
2013-07-08 15:53 ` Joe Hershberger
2013-05-26 18:37 ` [U-Boot] [PATCH v4 08/10] NET: mvgbe: add phylib support Sascha Silbe
2013-05-27 3:48 ` Prafulla Wadaskar
2013-07-08 15:55 ` Joe Hershberger
2013-05-26 18:37 ` [U-Boot] [PATCH v4 09/10] NET: mvgbe: add support for Dove Sascha Silbe
2013-05-26 18:37 ` [U-Boot] [PATCH v4 10/10] Boards: Add support for SolidRun CuBox Sascha Silbe
2012-12-21 9:35 ` [U-Boot] [PATCH 00/10] Add Marvell Dove and " Albert ARIBAUD
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=51B8C4BA.2020708@gmail.com \
--to=jagannadh.teki@gmail.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.