linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: hdegoede@redhat.com (Hans de Goede)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/5] drivers: soc: sunxi: Introduce SoC driver to map SRAMs
Date: Thu, 26 Mar 2015 15:37:57 +0100	[thread overview]
Message-ID: <551419C5.2010100@redhat.com> (raw)
In-Reply-To: <20150324151944.GA4951@lukather>

Hi,

On 24-03-15 16:19, Maxime Ripard wrote:
> Hi,
>
> On Fri, Mar 20, 2015 at 07:52:45PM +0100, Hans de Goede wrote:
>> From: Maxime Ripard <maxime.ripard@free-electrons.com>
>>
>> The Allwinner SoCs have a handful of SRAM that can be either mapped to be
>> accessible by devices or the CPU.
>>
>> That mapping is controlled by an SRAM controller, and that mapping might not be
>> set by the bootloader, for example if the device wasn't used at all, or if
>> we're using solutions like the U-Boot's Falcon Boot.
>>
>> We could also imagine changing this at runtime for example to change the
>> mapping of these SRAMs to use them for suspend/resume or runtime memory rate
>> change, if that ever happens.
>>
>> These use cases require some API in the kernel to control that mapping,
>> exported through a drivers/soc driver.
>>
>> This driver also implement a debugfs file that shows the SRAM found in the
>> system, the current mapping and the SRAM that have been claimed by some drivers
>> in the kernel.
>>
>> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
>> [hdegoede at redhat.com: Changed compat string to sun4i-a10-sram-controller, as
>>   the sram controller is identical on sun4i, sun5i & sun7i, added devicetree
>>   binding documentation, fixed some checkpatch warnings]
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>>   .../devicetree/bindings/soc/sunxi/sram.txt         |  64 ++++++
>>   drivers/soc/Kconfig                                |   1 +
>>   drivers/soc/Makefile                               |   1 +
>>   drivers/soc/sunxi/Kconfig                          |  12 ++
>>   drivers/soc/sunxi/Makefile                         |   1 +
>>   drivers/soc/sunxi/sunxi_sram.c                     | 235 +++++++++++++++++++++
>>   include/linux/soc/sunxi/sunxi_sram.h               |  24 +++
>>   7 files changed, 338 insertions(+)
>>   create mode 100644 Documentation/devicetree/bindings/soc/sunxi/sram.txt
>>   create mode 100644 drivers/soc/sunxi/Kconfig
>>   create mode 100644 drivers/soc/sunxi/Makefile
>>   create mode 100644 drivers/soc/sunxi/sunxi_sram.c
>>   create mode 100644 include/linux/soc/sunxi/sunxi_sram.h
>>
>> diff --git a/Documentation/devicetree/bindings/soc/sunxi/sram.txt b/Documentation/devicetree/bindings/soc/sunxi/sram.txt
>> new file mode 100644
>> index 0000000..6e1bc80
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/soc/sunxi/sram.txt
>> @@ -0,0 +1,64 @@
>> +Allwinnner sun4i / sun5i / sun7i SoC SRAM controllers
>> +-----------------------------------------------------
>> +
>> +Required properties:
>> +- compatible : "allwinner,sun4i-a10-sram-controller"
>> +- reg : sram controller register offset + length
>> +
>> +SRAM nodes
>> +----------
>> +
>> +Besides a node for the SRAM controller the devicetree must also contain a
>> +node for each SRAM block controlled by the controller.
>> +
>> +Required sram node properties:
>> +- compatible : "allwinner,sun4i-a10-sram"
>> +- allwinner,sram-name : should be one of
>> +  * "A1"
>> +  * "A2"
>> +  * "A3-A4"
>> +  * "D"
>> +
>> +Example
>> +-------
>> +
>> +/*
>> + * Note we use the address were mmio register start, not where
>                                ^ where
>
>> + * the SRAM blocks starts, this cannot be changed because doing
>                        ^ start
>
>> + * doing so would be a devicetree ABI change.
>
> One doing too many ? :)

Both fixed.

>> + */
>> +soc at 01c00000 {
>> +	compatible = "simple-bus";
>> +	#address-cells = <1>;
>> +	#size-cells = <1>;
>> +	ranges;
>> +
>> +	sram at 00000000 {
>> +		compatible = "allwinner,sun4i-a10-sram";
>> +		reg = <0x00000000 0x4000>;
>> +		allwinner,sram-name = "A1";
>> +	};
>> +
>> +	sram at 00004000 {
>> +		compatible = "allwinner,sun4i-a10-sram";
>> +		reg = <0x00004000 0x4000>;
>> +		allwinner,sram-name = "A2";
>> +	};
>> +
>> +	sram at 00008000 {
>> +		compatible = "allwinner,sun4i-a10-sram";
>> +		reg = <0x00008000 0x4000>;
>> +		allwinner,sram-name = "A3-A4";
>> +	};
>> +
>> +	sram at 00010000 {
>> +		compatible = "allwinner,sun4i-a10-sram";
>> +		reg = <0x00010000 0x1000>;
>> +		allwinner,sram-name = "D";
>> +	};
>> +
>> +	sram-controller at 01c00000 {
>> +		compatible = "allwinner,sun4i-a10-sram-controller";
>> +		reg = <0x01c00000 0x30>;
>> +	};
>> +};
>> diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig
>> index 76d6bd4..5d0f55d 100644
>> --- a/drivers/soc/Kconfig
>> +++ b/drivers/soc/Kconfig
>> @@ -1,6 +1,7 @@
>>   menu "SOC (System On Chip) specific Drivers"
>>
>>   source "drivers/soc/qcom/Kconfig"
>> +source "drivers/soc/sunxi/Kconfig"
>>   source "drivers/soc/ti/Kconfig"
>>   source "drivers/soc/versatile/Kconfig"
>>
>> diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile
>> index 063113d..170bba3 100644
>> --- a/drivers/soc/Makefile
>> +++ b/drivers/soc/Makefile
>> @@ -3,6 +3,7 @@
>>   #
>>
>>   obj-$(CONFIG_ARCH_QCOM)		+= qcom/
>> +obj-$(CONFIG_ARCH_SUNXI)	+= sunxi/
>>   obj-$(CONFIG_ARCH_TEGRA)	+= tegra/
>>   obj-$(CONFIG_SOC_TI)		+= ti/
>>   obj-$(CONFIG_PLAT_VERSATILE)	+= versatile/
>> diff --git a/drivers/soc/sunxi/Kconfig b/drivers/soc/sunxi/Kconfig
>> new file mode 100644
>> index 0000000..212c634
>> --- /dev/null
>> +++ b/drivers/soc/sunxi/Kconfig
>> @@ -0,0 +1,12 @@
>> +#
>> +# Allwinner sunXi SoC drivers
>> +#
>> +config SUNXI_SRAM
>> +        tristate "Allwinner sunXi SRAM Controller"
>> +        depends on ARCH_SUNXI
>> +	default y
>
> The indentation is off.

That is because your original patch used 8 spaces instead of tabs,
fixed.

> Also, that could probably be turned into an hidden option, with a
> default y, so that we are sure that it's always going to be there.

Also done / fixed.

Regards,

Hans

  reply	other threads:[~2015-03-26 14:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-20 18:52 [PATCH 0/5] ARM: sunxi: SRAM mapping support Hans de Goede
2015-03-20 18:52 ` [PATCH 1/5] drivers: soc: sunxi: Introduce SoC driver to map SRAMs Hans de Goede
2015-03-24 15:19   ` Maxime Ripard
2015-03-26 14:37     ` Hans de Goede [this message]
2015-03-20 18:52 ` [PATCH 2/5] ARM: dts: sun4i: Add A10 SRAM and SRAM controller Hans de Goede
2015-03-24 15:20   ` Maxime Ripard
2015-03-26 14:42     ` Hans de Goede
2015-03-20 18:52 ` [PATCH 3/5] ARM: dts: sun5i: Add A13 and A10s " Hans de Goede
2015-03-20 18:52 ` [PATCH 4/5] ARM: dts: sun7i: Add A20 " Hans de Goede
2015-03-20 18:52 ` [PATCH 5/5] net: allwinner: emac: Claim our SRAM Hans de Goede
2015-03-20 18:53   ` Hans de Goede
2015-03-24 15:22   ` Maxime Ripard
2015-03-26 14:44     ` Hans de Goede

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=551419C5.2010100@redhat.com \
    --to=hdegoede@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).