public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 3/4] mips: ath79: add spi driver
Date: Thu, 24 Dec 2015 12:55:55 +0100	[thread overview]
Message-ID: <201512241255.55314.marex@denx.de> (raw)
In-Reply-To: <BLU436-SMTP2255D7946F07BC82409191FFE70@phx.gbl>

On Thursday, December 24, 2015 at 12:22:02 PM, Wills Wang wrote:
> Signed-off-by: Wills Wang <wills.wang@live.com>
> ---
[...]

> diff --git a/drivers/spi/ath79_spi.c b/drivers/spi/ath79_spi.c
> new file mode 100644
> index 0000000..ddfc807
> --- /dev/null
> +++ b/drivers/spi/ath79_spi.c
> @@ -0,0 +1,211 @@
> +/*
> + * (C) Copyright 2015
> + * Wills Wang, <wills.wang@live.com>
> + *
> + * SPDX-License-Identifier:	GPL-2.0+
> + */
> +
> +#include <common.h>
> +#include <spi.h>
> +#include <dm.h>
> +#include <errno.h>
> +#include <asm/io.h>
> +#include <asm/addrspace.h>
> +#include <asm/types.h>
> +#include <asm/arch/ar71xx_regs.h>
> +
> +/* CLOCK_DIVIDER = 3 (SPI clock = 200 / 8 ~ 25 MHz) */
> +#define SPI_CLK_DIV(x)     ((x >> 1) - 1)

The x needs parenthesis ... (((x) >> 1) - 1)

> +
> +struct ath79_spi_platdata {
> +	void __iomem *regs;
> +};
> +
> +struct ath79_spi_priv {
> +	void __iomem *regs;
> +};
> +
> +static inline u32 ath79_spi_read(struct udevice *bus, u32 offset)
> +{
> +	struct ath79_spi_priv *priv = dev_get_priv(bus);
> +	const void __iomem *base = (void __iomem *)KSEG1ADDR(priv->regs);
> +	return readl(base + offset);

Just make this readl(KSEG1ADDR(...)) ?

> +}
> +
> +static inline void ath79_spi_write(struct udevice *bus, u32 val,
> +									u32 
offset)
> +{
> +	struct ath79_spi_priv *priv = dev_get_priv(bus);
> +	const void __iomem *base = (void __iomem *)KSEG1ADDR(priv->regs);
> +	writel(val, base + offset);

DTTO here.

[...]

  reply	other threads:[~2015-12-24 11:55 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1450956123-17606-1-git-send-email-wills.wang@live.com>
2015-12-24 11:22 ` [U-Boot] [PATCH v3 1/4] mips: add base support for atheros ath79 based SOCs Wills Wang
2015-12-24 11:52   ` Marek Vasut
2015-12-24 13:51     ` Wills Wang
2015-12-24 15:12       ` Marek Vasut
2015-12-25 11:38         ` Wills Wang
2015-12-26  6:02           ` Marek Vasut
2015-12-26 15:48             ` Wills Wang
2015-12-26 17:35               ` Marek Vasut
2015-12-26 18:17                 ` Marek Vasut
2015-12-26 18:29                   ` Wills Wang
2015-12-26 18:37                     ` Marek Vasut
2015-12-27  7:33                       ` Wills Wang
2015-12-27  7:38                         ` Marek Vasut
2015-12-27  8:07                           ` Wills Wang
2015-12-27 10:09                             ` Marek Vasut
2015-12-27 10:18                               ` Wills Wang
2015-12-27 11:04                                 ` Marek Vasut
2015-12-27 11:37                                   ` Wills Wang
2015-12-27 12:27                                     ` Marek Vasut
2015-12-28 11:17                                       ` Wills Wang
2015-12-28 13:47                                         ` Marek Vasut
2015-12-28 15:36                                           ` Wills Wang
2015-12-28 15:48                                           ` Wills Wang
2015-12-28 15:52                                             ` Marek Vasut
2015-12-28 17:08                                               ` Daniel Schwierzeck
2015-12-28 17:33                                                 ` Marek Vasut
2015-12-27 11:37                                   ` Daniel Schwierzeck
2015-12-27 12:25                                     ` Marek Vasut
2015-12-27 13:17                                     ` Wills Wang
2015-12-24 11:22 ` [U-Boot] [PATCH v3 2/4] mips: ath79: add serial driver for ar933x SOC Wills Wang
2015-12-25  2:39   ` Thomas Chou
2015-12-25  6:05     ` Wills Wang
2015-12-25  6:48       ` Thomas Chou
2015-12-25  2:49   ` Thomas Chou
2016-01-06  0:25   ` Simon Glass
2016-01-06  2:58     ` Wills Wang
2015-12-24 11:22 ` [U-Boot] [PATCH v3 3/4] mips: ath79: add spi driver Wills Wang
2015-12-24 11:55   ` Marek Vasut [this message]
2015-12-24 11:22 ` [U-Boot] [PATCH v3 4/4] mips: ath79: add AP121 reference board Wills Wang

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=201512241255.55314.marex@denx.de \
    --to=marex@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