All of lore.kernel.org
 help / color / mirror / Atom feed
From: boris.brezillon@free-electrons.com (Boris Brezillon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 05/11] memory: add Atmel EBI (External Bus Interface) driver
Date: Wed, 5 Nov 2014 17:59:51 +0100	[thread overview]
Message-ID: <20141105175951.71ad792a@bbrezillon> (raw)
In-Reply-To: <CACh+v5MP4XecA_fKrg=W2Xs8gkkEXaoEnFt_c8sC=wdUQg4HFw@mail.gmail.com>

On Wed, 5 Nov 2014 17:53:42 +0100
Jean-Jacques Hiblot <jjhiblot@traphandler.com> wrote:

> 2014-11-05 17:01 GMT+01:00 Boris Brezillon <boris.brezillon@free-electrons.com>:
> > The EBI (External Bus Interface) is used to access external peripherals
> > (NOR, SRAM, NAND, and other specific devices like ethernet controllers).
> > Each device is assigned a CS line and an address range and can have its
> > own configuration (timings, access mode, bus width, ...).
> > This driver provides a generic DT binding to configure a device according
> > to its requirements.
> > For specific device controllers (like the NAND one) the SMC timings
> > should be configured by the controller driver through the matrix and
> > smc syscon regmaps.
> >
> > Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
> > Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> > ---
> >  drivers/memory/Kconfig     |  11 +
> >  drivers/memory/Makefile    |   1 +
> >  drivers/memory/atmel-ebi.c | 615 +++++++++++++++++++++++++++++++++++++++++++++
> >  3 files changed, 627 insertions(+)
> >  create mode 100644 drivers/memory/atmel-ebi.c
> >
> > diff --git a/drivers/memory/Kconfig b/drivers/memory/Kconfig
> > index 6d91c27..dfe24a2 100644
> > --- a/drivers/memory/Kconfig
> > +++ b/drivers/memory/Kconfig
> > @@ -17,6 +17,17 @@ config ATMEL_SDRAMC
> >           Starting with the at91sam9g45, this controller supports SDR, DDR and
> >           LP-DDR memories.
> >
> > +config ATMEL_EBI
> > +       bool "Atmel EBI driver"
> > +       default y
> > +       depends on ARCH_AT91 && OF
> > +       select MFD_SYSCON
> > +       help
> > +         Driver for Atmel EBI controller.
> > +         Used to configure the EBI (external bus interface) when the device-
> > +         tree is used. This bus supports NANDs, external ethernet controller,
> > +         SRAMs, ATA devices, etc.
> > +
> >  config TI_AEMIF
> >         tristate "Texas Instruments AEMIF driver"
> >         depends on (ARCH_DAVINCI || ARCH_KEYSTONE) && OF
> > diff --git a/drivers/memory/Makefile b/drivers/memory/Makefile
> > index c32d319..7ca2c19 100644
> > --- a/drivers/memory/Makefile
> > +++ b/drivers/memory/Makefile
> > @@ -6,6 +6,7 @@ ifeq ($(CONFIG_DDR),y)
> >  obj-$(CONFIG_OF)               += of_memory.o
> >  endif
> >  obj-$(CONFIG_ATMEL_SDRAMC)     += atmel-sdramc.o
> > +obj-$(CONFIG_ATMEL_EBI)                += atmel-ebi.o
> >  obj-$(CONFIG_TI_AEMIF)         += ti-aemif.o
> >  obj-$(CONFIG_TI_EMIF)          += emif.o
> >  obj-$(CONFIG_FSL_CORENET_CF)   += fsl-corenet-cf.o
> > diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c
> > new file mode 100644
> > index 0000000..41bc893
> > --- /dev/null
> > +++ b/drivers/memory/atmel-ebi.c
> > @@ -0,0 +1,615 @@
> > +/*
> > + * EBI driver for Atmel SAM9 chips
> > + * inspired by the fsl weim bus driver
> > + *
> > + * Copyright (C) 2013 JJ Hiblot.
> > + *
> > + * This file is licensed under the terms of the GNU General Public
> > + * License version 2. This program is licensed "as is" without any
> > + * warranty of any kind, whether express or implied.
> > + */
> > +
> > +#include <linux/clk.h>
> > +#include <linux/io.h>
> > +#include <linux/mfd/syscon.h>
> > +#include <linux/mfd/syscon/atmel-matrix.h>
> > +#include <linux/mfd/syscon/atmel-smc.h>
> > +#include <linux/module.h>
> > +#include <linux/of_device.h>
> > +#include <linux/regmap.h>
> > +
> > +#define AT91SAM9_SMC_READ_MODE_MSK     BIT(0)
> > +#define AT91SAM9_SMC_READ_NCS_MODE     0
> > +#define AT91SAM9_SMC_READ_NRD_MODE     1
> > +#define AT91SAM9_SMC_WRITE_MODE_MSK    BIT(1)
> > +#define AT91SAM9_SMC_WRITE_NCS_MODE    (0 << 1)
> > +#define AT91SAM9_SMC_WRITE_NWE_MODE    (1 << 1)
> > +#define AT91SAM9_SMC_EXNW_MODE_MSK     GENMASK(5, 4)
> > +#define AT91SAM9_SMC_EXNW_DIS          (0 << 4)
> > +#define AT91SAM9_SMC_EXNW_FROZEN       (2 << 4)
> > +#define AT91SAM9_SMC_EXNW_READY                (3 << 4)
> > +#define AT91SAM9_SMC_BAT_MSK           BIT(8)
> > +#define AT91SAM9_SMC_BAT_SELECT                (0 << 8)
> > +#define AT91SAM9_SMC_BAT_WRITE         (1 << 8)
> > +#define AT91SAM9_SMC_DBW_MSK           GENMASK(13, 12)
> > +#define AT91SAM9_SMC_DBW(x)            ((((x) / 16) & 0x3) << 12)
> > +#define AT91SAM9_SMC_TDF_CYCLES_MSK    GENMASK(19, 16)
> > +#define AT91SAM9_SMC_TDF_CYCLES(x)     (((x) & 0xf) << 16)
> > +#define AT91SAM9_SMC_TDF_MODE_MSK      BIT(20)
> > +#define AT91SAM9_SMC_TDF_OPTIMIZED     (1 << 20)
> > +#define AT91SAM9_SMC_PMEN              BIT(24)
> > +#define AT91SAM9_SMC_PS(x)             ((((x) / 4) & 0x3) << 28)
> 
> Those definitions are now also available in
> linux/mfd/syscon/atmel-smc.h.For consistency sake, this driver should
> probably use the new ones.

That was my intention, I just forgot to cleanup this part...

> BTW this patch should probably be applied after patch 3 "mfd: syscon:
> Add atmel-smc registers definition" and patch 1 "mfd: syscon: Add
> atmel-matrix registers definition"
> 

And it is: patch 05/11 :-)

-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

WARNING: multiple messages have this Message-ID (diff)
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>,
	Lee Jones <lee.jones@linaro.org>,
	Nicolas Ferre <nicolas.ferre@atmel.com>,
	Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
	Alexandre Belloni <alexandre.belloni@free-electrons.com>,
	Andrew Victor <linux@maxim.org.za>,
	Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	devicetree <devicetree@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 05/11] memory: add Atmel EBI (External Bus Interface) driver
Date: Wed, 5 Nov 2014 17:59:51 +0100	[thread overview]
Message-ID: <20141105175951.71ad792a@bbrezillon> (raw)
In-Reply-To: <CACh+v5MP4XecA_fKrg=W2Xs8gkkEXaoEnFt_c8sC=wdUQg4HFw@mail.gmail.com>

On Wed, 5 Nov 2014 17:53:42 +0100
Jean-Jacques Hiblot <jjhiblot@traphandler.com> wrote:

> 2014-11-05 17:01 GMT+01:00 Boris Brezillon <boris.brezillon@free-electrons.com>:
> > The EBI (External Bus Interface) is used to access external peripherals
> > (NOR, SRAM, NAND, and other specific devices like ethernet controllers).
> > Each device is assigned a CS line and an address range and can have its
> > own configuration (timings, access mode, bus width, ...).
> > This driver provides a generic DT binding to configure a device according
> > to its requirements.
> > For specific device controllers (like the NAND one) the SMC timings
> > should be configured by the controller driver through the matrix and
> > smc syscon regmaps.
> >
> > Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
> > Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> > ---
> >  drivers/memory/Kconfig     |  11 +
> >  drivers/memory/Makefile    |   1 +
> >  drivers/memory/atmel-ebi.c | 615 +++++++++++++++++++++++++++++++++++++++++++++
> >  3 files changed, 627 insertions(+)
> >  create mode 100644 drivers/memory/atmel-ebi.c
> >
> > diff --git a/drivers/memory/Kconfig b/drivers/memory/Kconfig
> > index 6d91c27..dfe24a2 100644
> > --- a/drivers/memory/Kconfig
> > +++ b/drivers/memory/Kconfig
> > @@ -17,6 +17,17 @@ config ATMEL_SDRAMC
> >           Starting with the at91sam9g45, this controller supports SDR, DDR and
> >           LP-DDR memories.
> >
> > +config ATMEL_EBI
> > +       bool "Atmel EBI driver"
> > +       default y
> > +       depends on ARCH_AT91 && OF
> > +       select MFD_SYSCON
> > +       help
> > +         Driver for Atmel EBI controller.
> > +         Used to configure the EBI (external bus interface) when the device-
> > +         tree is used. This bus supports NANDs, external ethernet controller,
> > +         SRAMs, ATA devices, etc.
> > +
> >  config TI_AEMIF
> >         tristate "Texas Instruments AEMIF driver"
> >         depends on (ARCH_DAVINCI || ARCH_KEYSTONE) && OF
> > diff --git a/drivers/memory/Makefile b/drivers/memory/Makefile
> > index c32d319..7ca2c19 100644
> > --- a/drivers/memory/Makefile
> > +++ b/drivers/memory/Makefile
> > @@ -6,6 +6,7 @@ ifeq ($(CONFIG_DDR),y)
> >  obj-$(CONFIG_OF)               += of_memory.o
> >  endif
> >  obj-$(CONFIG_ATMEL_SDRAMC)     += atmel-sdramc.o
> > +obj-$(CONFIG_ATMEL_EBI)                += atmel-ebi.o
> >  obj-$(CONFIG_TI_AEMIF)         += ti-aemif.o
> >  obj-$(CONFIG_TI_EMIF)          += emif.o
> >  obj-$(CONFIG_FSL_CORENET_CF)   += fsl-corenet-cf.o
> > diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c
> > new file mode 100644
> > index 0000000..41bc893
> > --- /dev/null
> > +++ b/drivers/memory/atmel-ebi.c
> > @@ -0,0 +1,615 @@
> > +/*
> > + * EBI driver for Atmel SAM9 chips
> > + * inspired by the fsl weim bus driver
> > + *
> > + * Copyright (C) 2013 JJ Hiblot.
> > + *
> > + * This file is licensed under the terms of the GNU General Public
> > + * License version 2. This program is licensed "as is" without any
> > + * warranty of any kind, whether express or implied.
> > + */
> > +
> > +#include <linux/clk.h>
> > +#include <linux/io.h>
> > +#include <linux/mfd/syscon.h>
> > +#include <linux/mfd/syscon/atmel-matrix.h>
> > +#include <linux/mfd/syscon/atmel-smc.h>
> > +#include <linux/module.h>
> > +#include <linux/of_device.h>
> > +#include <linux/regmap.h>
> > +
> > +#define AT91SAM9_SMC_READ_MODE_MSK     BIT(0)
> > +#define AT91SAM9_SMC_READ_NCS_MODE     0
> > +#define AT91SAM9_SMC_READ_NRD_MODE     1
> > +#define AT91SAM9_SMC_WRITE_MODE_MSK    BIT(1)
> > +#define AT91SAM9_SMC_WRITE_NCS_MODE    (0 << 1)
> > +#define AT91SAM9_SMC_WRITE_NWE_MODE    (1 << 1)
> > +#define AT91SAM9_SMC_EXNW_MODE_MSK     GENMASK(5, 4)
> > +#define AT91SAM9_SMC_EXNW_DIS          (0 << 4)
> > +#define AT91SAM9_SMC_EXNW_FROZEN       (2 << 4)
> > +#define AT91SAM9_SMC_EXNW_READY                (3 << 4)
> > +#define AT91SAM9_SMC_BAT_MSK           BIT(8)
> > +#define AT91SAM9_SMC_BAT_SELECT                (0 << 8)
> > +#define AT91SAM9_SMC_BAT_WRITE         (1 << 8)
> > +#define AT91SAM9_SMC_DBW_MSK           GENMASK(13, 12)
> > +#define AT91SAM9_SMC_DBW(x)            ((((x) / 16) & 0x3) << 12)
> > +#define AT91SAM9_SMC_TDF_CYCLES_MSK    GENMASK(19, 16)
> > +#define AT91SAM9_SMC_TDF_CYCLES(x)     (((x) & 0xf) << 16)
> > +#define AT91SAM9_SMC_TDF_MODE_MSK      BIT(20)
> > +#define AT91SAM9_SMC_TDF_OPTIMIZED     (1 << 20)
> > +#define AT91SAM9_SMC_PMEN              BIT(24)
> > +#define AT91SAM9_SMC_PS(x)             ((((x) / 4) & 0x3) << 28)
> 
> Those definitions are now also available in
> linux/mfd/syscon/atmel-smc.h.For consistency sake, this driver should
> probably use the new ones.

That was my intention, I just forgot to cleanup this part...

> BTW this patch should probably be applied after patch 3 "mfd: syscon:
> Add atmel-smc registers definition" and patch 1 "mfd: syscon: Add
> atmel-matrix registers definition"
> 

And it is: patch 05/11 :-)

-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  reply	other threads:[~2014-11-05 16:59 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-05 16:01 [PATCH v2 00/11] memory: add Atmel EBI (External Bus Interface) driver Boris Brezillon
2014-11-05 16:01 ` Boris Brezillon
2014-11-05 16:01 ` [PATCH v2 01/11] mfd: syscon: Add atmel-matrix registers definition Boris Brezillon
2014-11-05 16:01   ` Boris Brezillon
2014-11-05 16:01   ` Boris Brezillon
2014-11-07 13:45   ` Alexandre Belloni
2014-11-07 13:45     ` Alexandre Belloni
2014-11-07 13:45     ` Alexandre Belloni
2014-11-07 14:14     ` Boris Brezillon
2014-11-07 14:14       ` Boris Brezillon
2014-11-07 14:14       ` Boris Brezillon
2014-11-10  9:47   ` Lee Jones
2014-11-10  9:47     ` Lee Jones
2014-11-05 16:01 ` [PATCH v2 02/11] mfd: syscon: Add Atmel Matrix bus DT binding documentation Boris Brezillon
2014-11-05 16:01   ` Boris Brezillon
2014-11-05 16:01   ` Boris Brezillon
2014-11-10  9:55   ` Lee Jones
2014-11-10  9:55     ` Lee Jones
2014-11-05 16:01 ` [PATCH v2 03/11] mfd: syscon: Add atmel-smc registers definition Boris Brezillon
2014-11-05 16:01   ` Boris Brezillon
2014-11-05 16:01   ` Boris Brezillon
2014-11-10  9:57   ` Lee Jones
2014-11-10  9:57     ` Lee Jones
2014-11-10  9:57     ` Lee Jones
2014-12-01  9:38     ` Boris Brezillon
2014-12-01  9:38       ` Boris Brezillon
2014-12-01  9:38       ` Boris Brezillon
2014-12-01  9:43       ` Nicolas Ferre
2014-12-01  9:43         ` Nicolas Ferre
2014-12-01  9:43         ` Nicolas Ferre
2014-11-05 16:01 ` [PATCH v2 04/11] mfd: syscon: Add Atmel SMC binding doc Boris Brezillon
2014-11-05 16:01   ` Boris Brezillon
2014-11-05 16:01   ` Boris Brezillon
2014-11-10  9:55   ` Lee Jones
2014-11-10  9:55     ` Lee Jones
2014-11-05 16:01 ` [PATCH v2 05/11] memory: add Atmel EBI (External Bus Interface) driver Boris Brezillon
2014-11-05 16:01   ` Boris Brezillon
2014-11-05 16:01   ` Boris Brezillon
2014-11-05 16:53   ` Jean-Jacques Hiblot
2014-11-05 16:53     ` Jean-Jacques Hiblot
2014-11-05 16:53     ` Jean-Jacques Hiblot
2014-11-05 16:59     ` Boris Brezillon [this message]
2014-11-05 16:59       ` Boris Brezillon
2014-11-05 17:05       ` Jean-Jacques Hiblot
2014-11-05 17:05         ` Jean-Jacques Hiblot
2014-11-05 17:05         ` Jean-Jacques Hiblot
2014-11-05 16:01 ` [PATCH v2 06/11] memory: atmel-ebi: add DT bindings documentation Boris Brezillon
2014-11-05 16:01   ` Boris Brezillon
2014-11-05 16:01   ` Boris Brezillon
2014-11-05 16:22   ` Jean-Jacques Hiblot
2014-11-05 16:22     ` Jean-Jacques Hiblot
2014-11-05 16:22     ` Jean-Jacques Hiblot
2014-11-05 16:39     ` Boris Brezillon
2014-11-05 16:39       ` Boris Brezillon
2014-11-07 13:55   ` Alexandre Belloni
2014-11-07 13:55     ` Alexandre Belloni
2014-11-07 13:55     ` Alexandre Belloni
2014-11-07 15:21   ` Rob Herring
2014-11-07 15:21     ` Rob Herring
2014-11-07 15:49     ` Boris Brezillon
2014-11-07 15:49       ` Boris Brezillon
2014-11-07 16:19       ` Tomeu Vizoso
2014-11-07 16:19         ` Tomeu Vizoso
2014-11-07 19:39       ` Rob Herring
2014-11-05 16:01 ` [PATCH v2 07/11] ARM: at91: select ATMEL_EBI when compiling a kernel for at91sam9 or sama5d3 Boris Brezillon
2014-11-05 16:01   ` Boris Brezillon
2014-11-05 16:01   ` Boris Brezillon
2014-11-05 16:01 ` [PATCH v2 08/11] ARM: at91/dt: add HSMC (Static Memory Controller) node in sama5d3 dtsi Boris Brezillon
2014-11-05 16:01   ` Boris Brezillon
2014-11-05 16:01   ` Boris Brezillon
2014-11-05 16:01 ` [PATCH v2 09/11] ARM: at91/dt: add matrix " Boris Brezillon
2014-11-05 16:01   ` Boris Brezillon
2014-11-05 16:01   ` Boris Brezillon
2014-11-05 16:01 ` [PATCH v2 10/11] ARM: at91/dt: add EBI (External Bus Interface) " Boris Brezillon
2014-11-05 16:01   ` Boris Brezillon
2014-11-05 16:01   ` Boris Brezillon
2014-11-05 16:01 ` [PATCH v2 11/11] ARM: at91/dt: add NOR definition in sama5d3xcm dtsi Boris Brezillon
2014-11-05 16:01   ` Boris Brezillon
2014-11-05 16:01   ` Boris Brezillon
2014-11-07 13:41 ` [PATCH v2 00/11] memory: add Atmel EBI (External Bus Interface) driver Alexandre Belloni
2014-11-07 13:41   ` Alexandre Belloni
2014-11-07 13:41   ` Alexandre Belloni
2014-11-07 14:19   ` Boris Brezillon
2014-11-07 14:19     ` Boris Brezillon
2014-11-07 14:19     ` Boris Brezillon

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=20141105175951.71ad792a@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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.