* Re: [PATCH 1/7] mmc: sh-mmcif: provide default allowed voltage
From: Simon Horman @ 2012-11-26 4:39 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <CANqRtoT8yFx8fe0Fkmh6F91NxajgcPYmheSwpqKk4HtQkX6_pw@mail.gmail.com>
On Mon, Nov 26, 2012 at 01:06:26PM +0900, Magnus Damm wrote:
> Hi Simon,
>
> On Mon, Nov 26, 2012 at 9:16 AM, Simon Horman <horms@verge.net.au> wrote:
> > Use MMC_VDD_165_195 as the allowed voltages in the absence of
> > platform data. This should allow device tree to initialise MMCIF
> > for a number of boards.
> >
> > A more complete solution would be to provide either MMCIF or MMC device
> > try bindings to set the allowed voltages.
> >
> > Tested on the KZM-A9-GT board
> >
> > Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> > Signed-off-by: Simon Horman <horms@verge.net.au>
> > ---
> > drivers/mmc/host/sh_mmcif.c | 7 ++-----
> > 1 file changed, 2 insertions(+), 5 deletions(-)
>
> Thanks for your patch!
>
> > diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
> > index 11d2bc3..88d6866 100644
> > --- a/drivers/mmc/host/sh_mmcif.c
> > +++ b/drivers/mmc/host/sh_mmcif.c
> > @@ -1293,12 +1293,9 @@ static void sh_mmcif_init_ocr(struct sh_mmcif_host *host)
> >
> > mmc_regulator_get_supply(mmc);
> >
> > - if (!pd)
> > - return;
> > -
> > if (!mmc->ocr_avail)
> > - mmc->ocr_avail = pd->ocr;
> > - else if (pd->ocr)
> > + mmc->ocr_avail = pd ? pd->ocr : MMC_VDD_165_195;
> > + else if (pd && pd->ocr)
> > dev_warn(mmc_dev(mmc), "Platform OCR mask is ignored\n");
> > }
>
> I may be mistaken, but I somehow thought that the code in
> mmc_regulator_get_supply() would take care of this automatically for
> us already. So this kind of patch isn't really needed as long as you
> tie in regulators via DT as expected.
Thanks, I'll check that. I did write this patch before hooking
up the regulators correctly.
^ permalink raw reply
* Re: [PATCH 6/7] ARM: mach-shmobile: sh73a0: Minimal setup using DT
From: Magnus Damm @ 2012-11-26 4:23 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1353889014-17142-7-git-send-email-horms@verge.net.au>
Hi Simon,
Thanks for your efforts.
On Mon, Nov 26, 2012 at 9:16 AM, Simon Horman <horms@verge.net.au> wrote:
> Allow a minimal setup of the sh73a0 SoC using a flattened device tree.
>
> * Allow configuration of the i2c controllers using a flattened device tree.
>
> * SCI serial controller and CMT clock source, whose drivers do not yet
> support configuration using a flattened device tree, are still configured
> using C code in order to allow booting of a board with this SoC.
>
> An example dts snuppet follows:
>
> i2c0: i2c@0xe6820000 {
> #address-cells = <1>;
> #size-cells = <0>;
> compatible = "renesas,rmobile-iic";
> reg = <0xe6820000 0x425>;
> interrupt-parent = <&gic>;
> interrupts = <0 167 0x4
> 0 170 0x4>;
> };
>
> i2c1: i2c@0xe6822000 {
> #address-cells = <1>;
> #size-cells = <0>;
> compatible = "renesas,rmobile-iic";
> reg = <0xe6822000 0x425>;
> interrupt-parent = <&gic>;
> interrupts = <0 51 0x4
> 0 44 0x4>;
>
> touchscreen@55 {
> compatible = "sitronix,st1232";
> reg = <0x55>;
> interrupt-parent = <&gic>;
> interrupts = <0 9 0x4>;
> };
> };
>
> i2c2: i2c@0xe6824000 {
> #address-cells = <1>;
> #size-cells = <0>;
> compatible = "renesas,rmobile-iic";
> reg = <0xe6824000 0x425>;
> interrupt-parent = <&gic>;
> interrupts = <0 171 0x4
> 0 174 0x4>;
> };
>
> i2c3: i2c@0xe6826000 {
> #address-cells = <1>;
> #size-cells = <0>;
> compatible = "renesas,rmobile-iic";
> reg = <0xe6826000 0x425>;
> interrupt-parent = <&gic>;
> interrupts = <0 183 0x4
> 0 186 0x4>;
> };
>
> i2c4: i2c@0xe6828000 {
> #address-cells = <1>;
> #size-cells = <0>;
> compatible = "renesas,rmobile-iic";
> reg = <0xe6828000 0x425>;
> interrupt-parent = <&gic>;
> interrupts = <0 187 0x4
> 0 190 0x4>;
> };
Uhm, doesn't the above want to go into sh73a0.dtsi?
> Signed-off-by: Simon Horman <horms@verge.net.au>
> ---
> arch/arm/mach-shmobile/include/mach/common.h | 2 ++
> arch/arm/mach-shmobile/setup-sh73a0.c | 41 ++++++++++++++++++++++----
> 2 files changed, 38 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
> index b50447e..06b905e 100644
> --- a/arch/arm/mach-shmobile/include/mach/common.h
> +++ b/arch/arm/mach-shmobile/include/mach/common.h
> @@ -52,7 +52,9 @@ extern void sh73a0_init_irq(void);
> extern void sh73a0_init_irq_dt(void);
> extern void sh73a0_map_io(void);
> extern void sh73a0_add_early_devices(void);
> +extern void sh73a0_add_early_devices_dt(void);
> extern void sh73a0_add_standard_devices(void);
> +extern void sh73a0_add_standard_devices_dt(void);
> extern void sh73a0_clock_init(void);
> extern void sh73a0_pinmux_init(void);
> extern struct clk sh73a0_extal1_clk;
> diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
> index db99a4a..9096caa 100644
> --- a/arch/arm/mach-shmobile/setup-sh73a0.c
> +++ b/arch/arm/mach-shmobile/setup-sh73a0.c
> @@ -23,6 +23,7 @@
> #include <linux/interrupt.h>
> #include <linux/irq.h>
> #include <linux/platform_device.h>
> +#include <linux/of_platform.h>
> #include <linux/delay.h>
> #include <linux/input.h>
> #include <linux/io.h>
> @@ -754,7 +755,7 @@ static struct platform_device pmu_device = {
> .resource = pmu_resources,
> };
>
> -static struct platform_device *sh73a0_early_devices[] __initdata = {
> +static struct platform_device *sh73a0_early_devices_dt[] __initdata = {
> &scif0_device,
> &scif1_device,
> &scif2_device,
> @@ -765,6 +766,9 @@ static struct platform_device *sh73a0_early_devices[] __initdata = {
> &scif7_device,
> &scif8_device,
> &cmt10_device,
> +};
> +
> +static struct platform_device *sh73a0_early_devices[] __initdata = {
> &tmu00_device,
> &tmu01_device,
> };
> @@ -782,11 +786,18 @@ static struct platform_device *sh73a0_late_devices[] __initdata = {
>
> #define SRCR2 IOMEM(0xe61580b0)
>
> -void __init sh73a0_add_standard_devices(void)
> +void __init sh73a0_add_standard_devices_dt(void)
> {
> /* Clear software reset bit on SY-DMAC module */
> __raw_writel(__raw_readl(SRCR2) & ~(1 << 18), SRCR2);
>
> + platform_add_devices(sh73a0_early_devices_dt,
> + ARRAY_SIZE(sh73a0_early_devices_dt));
> +}
> +
> +void __init sh73a0_add_standard_devices(void)
> +{
> + sh73a0_add_standard_devices_dt();
> platform_add_devices(sh73a0_early_devices,
> ARRAY_SIZE(sh73a0_early_devices));
> platform_add_devices(sh73a0_late_devices,
> @@ -803,14 +814,34 @@ static void __init sh73a0_earlytimer_init(void)
> sh73a0_register_twd();
> }
>
> -void __init sh73a0_add_early_devices(void)
> +static void __init
> +sh73a0_add_early_devices_start(void)
> {
> - early_platform_add_devices(sh73a0_early_devices,
> - ARRAY_SIZE(sh73a0_early_devices));
> + early_platform_add_devices(sh73a0_early_devices_dt,
> + ARRAY_SIZE(sh73a0_early_devices_dt));
> +}
>
> +static void __init
> +sh73a0_add_early_devices_finish(void)
> +{
> /* setup early console here as well */
> shmobile_setup_console();
>
> /* override timer setup with soc-specific code */
> shmobile_timer.init = sh73a0_earlytimer_init;
> }
> +
> +void __init sh73a0_add_early_devices_dt(void)
> +{
> + sh73a0_add_early_devices_start();
> + sh73a0_add_early_devices_finish();
> +}
What's the reason behind using sh73a0_earlytimer_init() for the sh73a0
DT case instead of using shmobile_setup_delay() as the DT code for
sh7372 does?
For the DT case on sh7372 we don't really use early platform driver
timers at all, instead we use timers as regular platform devices. For
this to work as expected we need to setup a worst case udelay
calculation via shmobile_setup_delay(). I suggest using the same style
for sh73a0.
> +void __init sh73a0_add_early_devices(void)
> +{
> + sh73a0_add_early_devices_start();
> + early_platform_add_devices(sh73a0_early_devices,
> + ARRAY_SIZE(sh73a0_early_devices));
> + sh73a0_add_early_devices_finish();
> +}
> +
Hm, without sh73a0_earlytimer_init() the functions
sh73a0_add_early_devices_start() and sh73a0_add_early_devices_finish()
look overly complicated compared to the sh7372 DT implementation.
However, I have not checked your code in detail but if your DT code
for sh73a0 happens to be shorter than the DT code for sh7372 then
please adjust the sh7372 code to be as short and simple as possible.
Thanks,
/ magnus
^ permalink raw reply
* Re: [PATCH 1/7] mmc: sh-mmcif: provide default allowed voltage
From: Magnus Damm @ 2012-11-26 4:06 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1353889014-17142-2-git-send-email-horms@verge.net.au>
Hi Simon,
On Mon, Nov 26, 2012 at 9:16 AM, Simon Horman <horms@verge.net.au> wrote:
> Use MMC_VDD_165_195 as the allowed voltages in the absence of
> platform data. This should allow device tree to initialise MMCIF
> for a number of boards.
>
> A more complete solution would be to provide either MMCIF or MMC device
> try bindings to set the allowed voltages.
>
> Tested on the KZM-A9-GT board
>
> Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> Signed-off-by: Simon Horman <horms@verge.net.au>
> ---
> drivers/mmc/host/sh_mmcif.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
Thanks for your patch!
> diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
> index 11d2bc3..88d6866 100644
> --- a/drivers/mmc/host/sh_mmcif.c
> +++ b/drivers/mmc/host/sh_mmcif.c
> @@ -1293,12 +1293,9 @@ static void sh_mmcif_init_ocr(struct sh_mmcif_host *host)
>
> mmc_regulator_get_supply(mmc);
>
> - if (!pd)
> - return;
> -
> if (!mmc->ocr_avail)
> - mmc->ocr_avail = pd->ocr;
> - else if (pd->ocr)
> + mmc->ocr_avail = pd ? pd->ocr : MMC_VDD_165_195;
> + else if (pd && pd->ocr)
> dev_warn(mmc_dev(mmc), "Platform OCR mask is ignored\n");
> }
I may be mistaken, but I somehow thought that the code in
mmc_regulator_get_supply() would take care of this automatically for
us already. So this kind of patch isn't really needed as long as you
tie in regulators via DT as expected.
Thanks,
/ magnus
^ permalink raw reply
* Re: [PATCH v5 00/15] shmobile DT initialisation of INTC and GIC
From: Kuninori Morimoto @ 2012-11-26 3:06 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1353571213-26006-1-git-send-email-nobuhiro.iwamatsu.yj@renesas.com>
Hi Iwamatsu-san
> Hi, simon and Magnus.
>
> I updated patch series for shmobile DT support.
> This version fixes definition of interrupt-controller. By this, I fixed
> external interrupt issuse on sh7372.
> And update r8a7740 and sh73a0 DT INTC init code to reduce the number of #ifdefs.
>
> ---
>
> The aims of this series are:
>
> * Adding DT support to INTC
> * Allowing relevant ARM shmobile SoCs to use DT to initialise INTC
> * Allowing relevant ARM shmobile boards to use DT to initialise INTC
> * Allowing the sh73a0 SoC use DT to initialise GIC
> * Allowing the sh73a0 SoC use DT to initialise GIC, which in
> turn allows the kzm9g board to use DT to initialise GIC
>
> Nobuhiro Iwamatsu (12):
> ARM: mach-shmobile: Add support OF for INTC of shmobile
> SH: intc: Add support OF of IRQ
> ARM: mach-shmobile: Add support OF of INTC for r8a7740
> ARM: mach-shmobile: Add support OF of INTC for sh73a0
> ARM: mach-shmobile: Add support OF of INTC for sh7372
> ARM: mach-shmobile: Add DT table of INTC for sh73a0
> ARM: mach-shmobile: Add DT table of INTC for sh7372
> ARM: mach-shmobile: Add DT table of INTC for r8a7740
> ARM: shmobile: Include DTSI of r8a7740 to armadillo800eva
> ARM: shmobile: Include DTSI of sh73a0 to kzm9g board
> ARM: shmobile: r8a7740: Use DT initialisation of INTC
> ARM: shmobile: sh7372: Use DT initialisation of INTC
>
> Simon Horman (3):
> ARM: shmobile: kzm9g: Use DT initialisation of INTC
> ARM: shmobile: Add DT table of GIC for sh73a0
> ARM: shmobile: sh73a0: Use DT for GIC
This is not super important, but
did you check your patch by ./scripts/checkpatch.pl ?
Occasionally it may be unavoidable, but this type of patches can be.
Best regards
---
Kuninori Morimoto
^ permalink raw reply
* Re: [PATCH 3/5] ARM: mach-shmobile: mackerel: Use gpio-backlight
From: Simon Horman @ 2012-11-26 1:10 UTC (permalink / raw)
To: linux-fbdev
In-Reply-To: <1353688515-30458-4-git-send-email-laurent.pinchart+renesas@ideasonboard.com>
On Fri, Nov 23, 2012 at 05:35:13PM +0100, Laurent Pinchart wrote:
> Replace the backlight callback with a gpio-backlight platform device.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Simon Horman <horms@verge.net.au>
^ permalink raw reply
* [PATCH 7/7] ARM: mach-shmobile: kzm9g: Reference DT implementation
From: Simon Horman @ 2012-11-26 0:16 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1353889014-17142-1-git-send-email-horms@verge.net.au>
Provide alternate board code for the kzm9g to demonstrate
how DT may be used given the current state of driver
device tree support. This is intended to act as a reference
for mach-shmobile developers.
Some notes:
* Brings up the GIC interrupt handler using device tree
* Brings up the following devices using device tree
- ST1232 (Touchscreen)
- MMCIF (MMC)
- SDHI (MMC)
* Does not bring up the INTC interrupt controller at all,
thus external devices may not be used
* Uses existing C code and not device tree to initialise the following,
which are needed for a working board:
- SCIF (Serial)
- CMT (Clock)
- PFC (GPIO)
To use this alternate board code instead of the normal board code,
CONFIG_MACH_KZM9G_REFERENCE should be selected in the kernel config.
And the sh73a0-kzm9g-reference.dtb flattened device tree blob should be used.
Signed-off-by: Simon Horman <horms@verge.net.au>
---
arch/arm/boot/dts/Makefile | 3 +-
arch/arm/boot/dts/sh73a0-kzm9g-reference.dts | 153 ++++++++++++++++++++++++
arch/arm/mach-shmobile/Kconfig | 10 ++
arch/arm/mach-shmobile/Makefile | 8 +-
arch/arm/mach-shmobile/board-kzm9g-reference.c | 142 ++++++++++++++++++++++
5 files changed, 314 insertions(+), 2 deletions(-)
create mode 100644 arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
create mode 100644 arch/arm/mach-shmobile/board-kzm9g-reference.c
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index c1ce813..b6c4fa2 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -75,7 +75,8 @@ dtb-$(CONFIG_ARCH_PRIMA2) += prima2-evb.dtb
dtb-$(CONFIG_ARCH_U8500) += snowball.dtb
dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \
r8a7740-armadillo800eva.dtb \
- sh73a0-kzm9g.dtb
+ sh73a0-kzm9g.dtb \
+ sh73a0-kzm9g-reference.dtb
dtb-$(CONFIG_ARCH_SPEAR13XX) += spear1310-evb.dtb \
spear1340-evb.dtb
dtb-$(CONFIG_ARCH_SPEAR3XX)+= spear300-evb.dtb \
diff --git a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
new file mode 100644
index 0000000..978892a
--- /dev/null
+++ b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
@@ -0,0 +1,153 @@
+/*
+ * Device Tree Source for the KZM-A9-GT board
+ *
+ * Copyright (C) 2012 Horms Solutions Ltd.
+ *
+ * Based on sh73a0-kzm9g.dts
+ * Copyright (C) 2012 Renesas Solutions Corp.
+ *
+ * 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.
+ */
+
+/dts-v1/;
+/include/ "skeleton.dtsi"
+
+/ {
+ model = "KZM-A9-GT";
+ compatible = "renesas,kzm9g-reference", "renesas,sh73a0";
+
+ memory {
+ device_type = "memory";
+ reg = <0x41000000 0x1e800000>;
+ };
+
+ gic: interrupt-controller@f0001000 {
+ compatible = "arm,cortex-a9-gic";
+ #interrupt-cells = <3>;
+ #address-cells = <1>;
+ interrupt-controller;
+ reg = <0xf0001000 0x1000>,
+ <0xf0000100 0x100>;
+ };
+
+ i2c0: i2c@0xe6820000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "renesas,rmobile-iic";
+ reg = <0xe6820000 0x425>;
+ interrupt-parent = <&gic>;
+ interrupts = <0 167 0x4
+ 0 170 0x4>;
+ };
+
+ i2c1: i2c@0xe6822000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "renesas,rmobile-iic";
+ reg = <0xe6822000 0x425>;
+ interrupt-parent = <&gic>;
+ interrupts = <0 51 0x4
+ 0 44 0x4>;
+
+ touchscreen@55 {
+ compatible = "sitronix,st1232";
+ reg = <0x55>;
+ interrupt-parent = <&gic>;
+ interrupts = <0 9 0x4>;
+ };
+ };
+
+ i2c2: i2c@0xe6824000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "renesas,rmobile-iic";
+ reg = <0xe6824000 0x425>;
+ interrupt-parent = <&gic>;
+ interrupts = <0 171 0x4
+ 0 174 0x4>;
+ };
+
+ i2c3: i2c@0xe6826000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "renesas,rmobile-iic";
+ reg = <0xe6826000 0x425>;
+ interrupt-parent = <&gic>;
+ interrupts = <0 183 0x4
+ 0 186 0x4>;
+ };
+
+ i2c4: i2c@0xe6828000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "renesas,rmobile-iic";
+ reg = <0xe6828000 0x425>;
+ interrupt-parent = <&gic>;
+ interrupts = <0 187 0x4
+ 0 190 0x4>;
+ };
+
+ gpio: gpio@0 {
+ compatible = "renesas,sh_pfc-sh73a0";
+ gpio-controller;
+ #gpio-cells = <2>;
+ };
+
+ fixedregulator1v8: fixedregulator@0 {
+ compatible = "regulator-fixed";
+ regulator-name = "fixed-1.8V";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ };
+
+ fixedregulator2v8: fixedregulator@1 {
+ compatible = "regulator-fixed";
+ regulator-name = "fixed-2.8V";
+ regulator-min-microvolt = <2800000>;
+ regulator-max-microvolt = <2800000>;
+ };
+
+ mmcif@0x10010000 {
+ compatible = "renesas,sh-mmcif";
+ reg = <0xe6bd0000 0x100>;
+ interrupt-parent = <&gic>;
+ interrupts = <0 140 0x4
+ 0 141 0x4>;
+ reg-io-width = <4>;
+ vmmc-supply = <&fixedregulator1v8>;
+ vqmmc-supply = <&fixedregulator1v8>;
+ };
+
+ sdhi0@0xee100000 {
+ compatible = "renesas,shmobile-sdhi";
+ reg = <0xee100000 0x100>;
+ interrupt-parent = <&gic>;
+ interrupts = <0 83 0x4
+ 0 84 0x4
+ 0 85 0x4>;
+ interrupt-names = "card_detect", "sdcard", "sdio";
+ reg-io-width = <2>;
+ vmmc-supply = <&fixedregulator2v8>;
+ vqmmc-supply = <&fixedregulator2v8>;
+ renesas,shmobile-sdhi-has-idle-wait;
+ };
+
+ sdhi2@0xee140000 {
+ compatible = "renesas,shmobile-sdhi";
+ reg = <0xee140000 0x100>;
+ interrupt-parent = <&gic>;
+ interrupts = <0 103 0x4
+ 0 104 0x4
+ 0 105 0x4>;
+ interrupt-names = "card_detect", "sdcard", "sdio";
+ reg-io-width = <2>;
+ vmmc-supply = <&fixedregulator2v8>;
+ vqmmc-supply = <&fixedregulator2v8>;
+ renesas,shmobile-sdhi-has-idle-wait;
+ renesas,shmobile-sdhi-use-gpio-cd;
+ renesas,shmobile-sdhi-wrprotect-disable;
+ cd-gpios = <&gpio 13 1>;
+ };
+};
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 8ae100c..ca95c2b 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -136,6 +136,16 @@ config MACH_KZM9G
select SND_SOC_AK4642 if SND_SIMPLE_CARD
select USE_OF
+config MACH_KZM9G_REFERENCE
+ bool "KZM-A9-GT board - Reference Device Tree Implementation"
+ depends on MACH_KZM9G
+ ---help---
+ Use reference implementation of KZM-A9-GT board support
+ which makes as greater use of device tree at the expense
+ of not supporting a number of devices.
+
+ This is intended to aid developers
+
comment "SH-Mobile System Configuration"
config CPU_HAS_INTEVT
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index fe2c97c..87f50fa 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -55,7 +55,13 @@ obj-$(CONFIG_MACH_BONITO) += board-bonito.o
obj-$(CONFIG_MACH_MARZEN) += board-marzen.o
obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o
obj-$(CONFIG_MACH_KZM9D) += board-kzm9d.o
-obj-$(CONFIG_MACH_KZM9G) += board-kzm9g.o
+ifeq ($(CONFIG_MACH_KZM9G),y)
+ifeq ($(CONFIG_MACH_KZM9G_REFERENCE),y)
+obj-y += board-kzm9g-reference.o
+else
+obj-y += board-kzm9g.o
+endif
+endif
# Framework support
obj-$(CONFIG_SMP) += $(smp-y)
diff --git a/arch/arm/mach-shmobile/board-kzm9g-reference.c b/arch/arm/mach-shmobile/board-kzm9g-reference.c
new file mode 100644
index 0000000..a3bee425
--- /dev/null
+++ b/arch/arm/mach-shmobile/board-kzm9g-reference.c
@@ -0,0 +1,142 @@
+/*
+ * KZM-A9-GT board support - Reference Device Tree Implementation
+ *
+ * Copyright (C) 2012 Horms Solutions Ltd.
+ *
+ * Based on board-kzm9g.c
+ * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+ *
+ * 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; version 2 of the License.
+ *
+ * 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 St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <linux/delay.h>
+#include <linux/gpio.h>
+#include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/input.h>
+#include <linux/of_platform.h>
+#include <mach/sh73a0.h>
+#include <mach/common.h>
+#include <asm/hardware/cache-l2x0.h>
+#include <asm/hardware/gic.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+
+static const struct of_dev_auxdata kzm_auxdata_lookup[] __initconst = {
+ OF_DEV_AUXDATA("renesas,rmobile-iic", 0xe6820000,
+ "i2c-sh_mobile.0", NULL),
+ OF_DEV_AUXDATA("renesas,rmobile-iic", 0xe6822000,
+ "i2c-sh_mobile.1", NULL),
+ OF_DEV_AUXDATA("renesas,rmobile-iic", 0xe6824000,
+ "i2c-sh_mobile.2", NULL),
+ OF_DEV_AUXDATA("renesas,rmobile-iic", 0xe6826000,
+ "i2c-sh_mobile.3", NULL),
+ OF_DEV_AUXDATA("renesas,rmobile-iic", 0xe6828000,
+ "i2c-sh_mobile.4", NULL),
+ OF_DEV_AUXDATA("renesas,shmobile-sdhi", 0xee100000,
+ "sh_mobile_sdhi.0", NULL),
+ OF_DEV_AUXDATA("renesas,shmobile-sdhi", 0xee140000,
+ "sh_mobile_sdhi.2", NULL),
+ OF_DEV_AUXDATA("renesas,sh-mmcif", 0xe6bd0000, "sh_mmcif.0", NULL),
+ {},
+};
+
+static void __init kzm_init(void)
+{
+ sh73a0_pinmux_init();
+
+ /* enable SCIFA4 */
+ gpio_request(GPIO_FN_SCIFA4_TXD, NULL);
+ gpio_request(GPIO_FN_SCIFA4_RXD, NULL);
+ gpio_request(GPIO_FN_SCIFA4_RTS_, NULL);
+ gpio_request(GPIO_FN_SCIFA4_CTS_, NULL);
+
+ /* Touchscreen */
+ gpio_request(GPIO_PORT223, NULL); /* IRQ8 */
+ gpio_direction_input(GPIO_PORT223);
+
+ /* enable MMCIF */
+ gpio_request(GPIO_FN_MMCCLK0, NULL);
+ gpio_request(GPIO_FN_MMCCMD0_PU, NULL);
+ gpio_request(GPIO_FN_MMCD0_0_PU, NULL);
+ gpio_request(GPIO_FN_MMCD0_1_PU, NULL);
+ gpio_request(GPIO_FN_MMCD0_2_PU, NULL);
+ gpio_request(GPIO_FN_MMCD0_3_PU, NULL);
+ gpio_request(GPIO_FN_MMCD0_4_PU, NULL);
+ gpio_request(GPIO_FN_MMCD0_5_PU, NULL);
+ gpio_request(GPIO_FN_MMCD0_6_PU, NULL);
+ gpio_request(GPIO_FN_MMCD0_7_PU, NULL);
+
+ /* enable SD */
+ gpio_request(GPIO_FN_SDHIWP0, NULL);
+ gpio_request(GPIO_FN_SDHICD0, NULL);
+ gpio_request(GPIO_FN_SDHICMD0, NULL);
+ gpio_request(GPIO_FN_SDHICLK0, NULL);
+ gpio_request(GPIO_FN_SDHID0_3, NULL);
+ gpio_request(GPIO_FN_SDHID0_2, NULL);
+ gpio_request(GPIO_FN_SDHID0_1, NULL);
+ gpio_request(GPIO_FN_SDHID0_0, NULL);
+ gpio_request(GPIO_FN_SDHI0_VCCQ_MC0_ON, NULL);
+ gpio_request(GPIO_PORT15, NULL);
+ gpio_direction_output(GPIO_PORT15, 1); /* power */
+
+ /* enable Micro SD */
+ gpio_request(GPIO_FN_SDHID2_0, NULL);
+ gpio_request(GPIO_FN_SDHID2_1, NULL);
+ gpio_request(GPIO_FN_SDHID2_2, NULL);
+ gpio_request(GPIO_FN_SDHID2_3, NULL);
+ gpio_request(GPIO_FN_SDHICMD2, NULL);
+ gpio_request(GPIO_FN_SDHICLK2, NULL);
+ gpio_request(GPIO_PORT14, NULL);
+ gpio_direction_output(GPIO_PORT14, 1); /* power */
+
+ /* I2C 3 */
+ gpio_request(GPIO_FN_PORT27_I2C_SCL3, NULL);
+ gpio_request(GPIO_FN_PORT28_I2C_SDA3, NULL);
+
+#ifdef CONFIG_CACHE_L2X0
+ /* Early BRESP enable, Shared attribute override enable, 64K*8way */
+ l2x0_init(IOMEM(0xf0100000), 0x40460000, 0x82000fff);
+#endif
+
+ sh73a0_add_standard_devices_dt();
+ of_platform_populate(NULL, of_default_bus_match_table,
+ kzm_auxdata_lookup, NULL);
+}
+
+static void kzm9g_restart(char mode, const char *cmd)
+{
+#define RESCNT2 IOMEM(0xe6188020)
+ /* Do soft power on reset */
+ writel((1 << 31), RESCNT2);
+}
+
+static const char *kzm9g_boards_compat_dt[] __initdata = {
+ "renesas,kzm9g-reference",
+ NULL,
+};
+
+DT_MACHINE_START(KZM9G_DT, "kzm9g-reference")
+ .smp = smp_ops(sh73a0_smp_ops),
+ .map_io = sh73a0_map_io,
+ .init_early = sh73a0_add_early_devices_dt,
+ .nr_irqs = NR_IRQS_LEGACY,
+ .init_irq = sh73a0_init_irq_dt,
+ .handle_irq = gic_handle_irq,
+ .init_machine = kzm_init,
+ .init_late = shmobile_init_late,
+ .timer = &shmobile_timer,
+ .restart = kzm9g_restart,
+ .dt_compat = kzm9g_boards_compat_dt,
+MACHINE_END
--
1.7.10.4
^ permalink raw reply related
* [PATCH 6/7] ARM: mach-shmobile: sh73a0: Minimal setup using DT
From: Simon Horman @ 2012-11-26 0:16 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1353889014-17142-1-git-send-email-horms@verge.net.au>
Allow a minimal setup of the sh73a0 SoC using a flattened device tree.
* Allow configuration of the i2c controllers using a flattened device tree.
* SCI serial controller and CMT clock source, whose drivers do not yet
support configuration using a flattened device tree, are still configured
using C code in order to allow booting of a board with this SoC.
An example dts snuppet follows:
i2c0: i2c@0xe6820000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "renesas,rmobile-iic";
reg = <0xe6820000 0x425>;
interrupt-parent = <&gic>;
interrupts = <0 167 0x4
0 170 0x4>;
};
i2c1: i2c@0xe6822000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "renesas,rmobile-iic";
reg = <0xe6822000 0x425>;
interrupt-parent = <&gic>;
interrupts = <0 51 0x4
0 44 0x4>;
touchscreen@55 {
compatible = "sitronix,st1232";
reg = <0x55>;
interrupt-parent = <&gic>;
interrupts = <0 9 0x4>;
};
};
i2c2: i2c@0xe6824000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "renesas,rmobile-iic";
reg = <0xe6824000 0x425>;
interrupt-parent = <&gic>;
interrupts = <0 171 0x4
0 174 0x4>;
};
i2c3: i2c@0xe6826000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "renesas,rmobile-iic";
reg = <0xe6826000 0x425>;
interrupt-parent = <&gic>;
interrupts = <0 183 0x4
0 186 0x4>;
};
i2c4: i2c@0xe6828000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "renesas,rmobile-iic";
reg = <0xe6828000 0x425>;
interrupt-parent = <&gic>;
interrupts = <0 187 0x4
0 190 0x4>;
};
Signed-off-by: Simon Horman <horms@verge.net.au>
---
arch/arm/mach-shmobile/include/mach/common.h | 2 ++
arch/arm/mach-shmobile/setup-sh73a0.c | 41 ++++++++++++++++++++++----
2 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index b50447e..06b905e 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -52,7 +52,9 @@ extern void sh73a0_init_irq(void);
extern void sh73a0_init_irq_dt(void);
extern void sh73a0_map_io(void);
extern void sh73a0_add_early_devices(void);
+extern void sh73a0_add_early_devices_dt(void);
extern void sh73a0_add_standard_devices(void);
+extern void sh73a0_add_standard_devices_dt(void);
extern void sh73a0_clock_init(void);
extern void sh73a0_pinmux_init(void);
extern struct clk sh73a0_extal1_clk;
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index db99a4a..9096caa 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -23,6 +23,7 @@
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/platform_device.h>
+#include <linux/of_platform.h>
#include <linux/delay.h>
#include <linux/input.h>
#include <linux/io.h>
@@ -754,7 +755,7 @@ static struct platform_device pmu_device = {
.resource = pmu_resources,
};
-static struct platform_device *sh73a0_early_devices[] __initdata = {
+static struct platform_device *sh73a0_early_devices_dt[] __initdata = {
&scif0_device,
&scif1_device,
&scif2_device,
@@ -765,6 +766,9 @@ static struct platform_device *sh73a0_early_devices[] __initdata = {
&scif7_device,
&scif8_device,
&cmt10_device,
+};
+
+static struct platform_device *sh73a0_early_devices[] __initdata = {
&tmu00_device,
&tmu01_device,
};
@@ -782,11 +786,18 @@ static struct platform_device *sh73a0_late_devices[] __initdata = {
#define SRCR2 IOMEM(0xe61580b0)
-void __init sh73a0_add_standard_devices(void)
+void __init sh73a0_add_standard_devices_dt(void)
{
/* Clear software reset bit on SY-DMAC module */
__raw_writel(__raw_readl(SRCR2) & ~(1 << 18), SRCR2);
+ platform_add_devices(sh73a0_early_devices_dt,
+ ARRAY_SIZE(sh73a0_early_devices_dt));
+}
+
+void __init sh73a0_add_standard_devices(void)
+{
+ sh73a0_add_standard_devices_dt();
platform_add_devices(sh73a0_early_devices,
ARRAY_SIZE(sh73a0_early_devices));
platform_add_devices(sh73a0_late_devices,
@@ -803,14 +814,34 @@ static void __init sh73a0_earlytimer_init(void)
sh73a0_register_twd();
}
-void __init sh73a0_add_early_devices(void)
+static void __init
+sh73a0_add_early_devices_start(void)
{
- early_platform_add_devices(sh73a0_early_devices,
- ARRAY_SIZE(sh73a0_early_devices));
+ early_platform_add_devices(sh73a0_early_devices_dt,
+ ARRAY_SIZE(sh73a0_early_devices_dt));
+}
+static void __init
+sh73a0_add_early_devices_finish(void)
+{
/* setup early console here as well */
shmobile_setup_console();
/* override timer setup with soc-specific code */
shmobile_timer.init = sh73a0_earlytimer_init;
}
+
+void __init sh73a0_add_early_devices_dt(void)
+{
+ sh73a0_add_early_devices_start();
+ sh73a0_add_early_devices_finish();
+}
+
+void __init sh73a0_add_early_devices(void)
+{
+ sh73a0_add_early_devices_start();
+ early_platform_add_devices(sh73a0_early_devices,
+ ARRAY_SIZE(sh73a0_early_devices));
+ sh73a0_add_early_devices_finish();
+}
+
--
1.7.10.4
^ permalink raw reply related
* [PATCH 5/7] ARM: mach-shmobile: sh73a0: Allow initialisation of GIC by DT
From: Simon Horman @ 2012-11-26 0:16 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1353889014-17142-1-git-send-email-horms@verge.net.au>
This allows the GIC interrupt controller of the sh73a0 SoC to be
initialised using a flattened device tree blob.
It does not allow the INTC interrupt controller which is also present on
the sh73a0 SoC to be enabled via device tree. Nor does it handle sharing
of interrupts between the GIC and INTC interrupt controllers.
This limits the usefulness of this code to applications which only wish to
access devices which use interrupts that can be handled by the GIC
interrupt controller. Other applications should, for now, continue using
non-device tree initialisation of the sh72a0 interrupt controllers.
An example dts snippet follows:
gic: interrupt-controller@f0001000 {
compatible = "arm,cortex-a9-gic";
#interrupt-cells = <3>;
#address-cells = <1>;
interrupt-controller;
reg = <0xf0001000 0x1000>,
<0xf0000100 0x100>;
};
Signed-off-by: Simon Horman <horms@verge.net.au>
---
arch/arm/mach-shmobile/include/mach/common.h | 1 +
arch/arm/mach-shmobile/intc-sh73a0.c | 14 ++++++++++++++
2 files changed, 15 insertions(+)
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index d47e215..b50447e 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -49,6 +49,7 @@ extern struct clk sh7372_extal1_clk;
extern struct clk sh7372_extal2_clk;
extern void sh73a0_init_irq(void);
+extern void sh73a0_init_irq_dt(void);
extern void sh73a0_map_io(void);
extern void sh73a0_add_early_devices(void);
extern void sh73a0_add_standard_devices(void);
diff --git a/arch/arm/mach-shmobile/intc-sh73a0.c b/arch/arm/mach-shmobile/intc-sh73a0.c
index f0c5e51..e492350 100644
--- a/arch/arm/mach-shmobile/intc-sh73a0.c
+++ b/arch/arm/mach-shmobile/intc-sh73a0.c
@@ -21,6 +21,7 @@
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/irq.h>
+#include <linux/of_irq.h>
#include <linux/io.h>
#include <linux/sh_intc.h>
#include <mach/intc.h>
@@ -464,3 +465,16 @@ void __init sh73a0_init_irq(void)
sh73a0_pint1_cascade.handler = sh73a0_pint1_demux;
setup_irq(gic_spi(34), &sh73a0_pint1_cascade);
}
+
+#ifdef CONFIG_OF
+static const struct of_device_id irq_of_match[] __initconst = {
+ { .compatible = "arm,cortex-a9-gic", .data = gic_of_init, },
+ { },
+};
+
+void __init sh73a0_init_irq_dt(void)
+{
+ of_irq_init(irq_of_match);
+ gic_arch_extn.irq_set_wake = sh73a0_set_wake;
+}
+#endif
--
1.7.10.4
^ permalink raw reply related
* [PATCH 4/7] ARM: shmobile: pfc-sh73a0: Register device tree
From: Simon Horman @ 2012-11-26 0:16 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1353889014-17142-1-git-send-email-horms@verge.net.au>
Register the pfc with sh73a0_init_gpio_dt() to allow
gpios provided by pfc to be accessed by devices which
are registered using device tree.
The motivation of this is to allow the gpio used for carrier detect
but the Micro SD SDHI port of the KZM-9A-GT board to be accessed
using device tree. Thus, allowing the SDHI device of the KZM-9A-GT
board to be registered using device tree.
Signed-off-by: Simon Horman <horms@verge.net.au>
---
arch/arm/mach-shmobile/pfc-sh73a0.c | 45 +++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/arch/arm/mach-shmobile/pfc-sh73a0.c b/arch/arm/mach-shmobile/pfc-sh73a0.c
index b442f9d..d1a04c0b 100644
--- a/arch/arm/mach-shmobile/pfc-sh73a0.c
+++ b/arch/arm/mach-shmobile/pfc-sh73a0.c
@@ -2797,7 +2797,52 @@ static struct pinmux_info sh73a0_pinmux_info = {
.gpio_irq_size = ARRAY_SIZE(pinmux_irqs),
};
+#ifdef CONFIG_OF_GPIO
+static int sh73a0_gpio_xlate(struct gpio_chip *gc,
+ const struct of_phandle_args *gpiospec,
+ u32 *flags)
+{
+ if (WARN_ON(gc->of_gpio_n_cells < 2))
+ return -EINVAL;
+
+ if (WARN_ON(gpiospec->args_count < gc->of_gpio_n_cells))
+ return -EINVAL;
+
+ if (gpiospec->args[0] > gc->ngpio)
+ return -EINVAL;
+
+ if (flags)
+ *flags = gpiospec->args[1];
+
+ return gpiospec->args[0];
+}
+
+static const struct of_device_id sh73a0_gpio_dt_match[] __initdata = {
+ { .compatible = "renesas,sh_pfc-sh73a0", },
+ {}
+};
+
+static inline void sh73a0_init_gpio_dt(void)
+{
+ struct device_node *of_node;
+
+ if (!of_have_populated_dt())
+ return;
+
+ of_node = of_find_matching_node(NULL, sh73a0_gpio_dt_match);
+ sh73a0_pinmux_info.of_node = of_node;
+ sh73a0_pinmux_info.of_gpio_n_cells = 2;
+ sh73a0_pinmux_info.of_xlate = sh73a0_gpio_xlate;
+}
+
+#else
+
+static inline void sh73a0_init_gpio_dt(void) {}
+
+#endif
+
void sh73a0_pinmux_init(void)
{
+ sh73a0_init_gpio_dt();
register_pinmux(&sh73a0_pinmux_info);
}
--
1.7.10.4
^ permalink raw reply related
* [PATCH 3/7] sh: pfc: Allow device tree registration
From: Simon Horman @ 2012-11-26 0:16 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1353889014-17142-1-git-send-email-horms@verge.net.au>
This is a crude mechanism to allow the pfc driver to
be registered through device tree. The mofication of this
is to provide a way for pfc gpios to be looked up by
device tree for devices which use pfc gpios.
More specifically, the motivation is to allow the registration
of the card-detect gpio for the Micro-SD SDHI slot of the KZM9G board.
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
drivers/sh/pfc/gpio.c | 15 +++++++++++++++
include/linux/sh_pfc.h | 7 +++++++
2 files changed, 22 insertions(+)
diff --git a/drivers/sh/pfc/gpio.c b/drivers/sh/pfc/gpio.c
index 038fa07..322b927 100644
--- a/drivers/sh/pfc/gpio.c
+++ b/drivers/sh/pfc/gpio.c
@@ -136,6 +136,19 @@ static void sh_pfc_gpio_setup(struct sh_pfc_chip *chip)
gc->ngpio = (pfc->last_gpio - pfc->first_gpio) + 1;
}
+#ifdef CONFIG_OF_GPIO
+static void
+sh_pfc_register_gpiochip_dt(struct sh_pfc *pfc, struct gpio_chip *chip)
+{
+ chip->of_node = pfc->of_node;
+ chip->of_gpio_n_cells = pfc->of_gpio_n_cells;
+ chip->of_xlate = pfc->of_xlate;
+}
+#else
+static void sh_pfc_register_gpiochip_dt(struct sh_pfc *pfc,
+ struct gpio_chip *chip) {}
+#endif
+
int sh_pfc_register_gpiochip(struct sh_pfc *pfc)
{
struct sh_pfc_chip *chip;
@@ -153,6 +166,8 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc)
if (unlikely(ret < 0))
kfree(chip);
+ sh_pfc_register_gpiochip_dt(pfc, &chip->gpio_chip);
+
pr_info("%s handling gpio %d -> %d\n",
pfc->name, pfc->first_gpio, pfc->last_gpio);
diff --git a/include/linux/sh_pfc.h b/include/linux/sh_pfc.h
index c19a092..9963370 100644
--- a/include/linux/sh_pfc.h
+++ b/include/linux/sh_pfc.h
@@ -124,6 +124,13 @@ struct sh_pfc {
struct pfc_window *window;
unsigned long unlock_reg;
+
+#ifdef CONFIG_OF_GPIO
+ struct device_node *of_node;
+ int of_gpio_n_cells;
+ int (*of_xlate)(struct gpio_chip *gc,
+ const struct of_phandle_args *gpiospec, u32 *flags);
+#endif
};
/* XXX compat for now */
--
1.7.10.4
^ permalink raw reply related
* [PATCH 2/7] mmc: sdhi: enchance OF support for flags and cd-gpios
From: Simon Horman @ 2012-11-26 0:16 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1353889014-17142-1-git-send-email-horms@verge.net.au>
Enhance the OF support for SDHI by adding the following bindings:
* renesas,shmobile-sdhi-has-idle-wait:
Equivalent to setting TMIO_MMC_HAS_IDLE_WAIT in
the flags of platform data
* renesas,shmobile-sdhi-use-gpio-cd:
Equivalent to setting TMIO_MMC_USE_GPIO_CD in
the flags of platform data
* renesas,shmobile-sdhi-wrprotect-disable:
Equivalent to setting TMIO_MMC_WRPROTECT_DISABLE in
the flags of platform data
* cd-gpios:
Equivalent to setting cd_gpio in platform data
This patch also requests the clock based on the device tree
node name if the platform data is absent.
The motivation for this is to allow registration of the SDHI
device of the KZM-A9-GT board through device tree.
The following device tree snippet illustrates the use of the bindings
described above.
sdhi0@0xee100000 {
compatible = "renesas,shmobile-sdhi";
reg = <0xee100000 0x100>;
interrupt-parent = <&gic>;
interrupts = <0 83 0x4
0 84 0x4
0 85 0x4>;
interrupt-names = "card_detect", "sdcard", "sdio";
reg-io-width = <2>;
vmmc-supply = <&fixedregulator2v8>;
vqmmc-supply = <&fixedregulator2v8>;
renesas,shmobile-sdhi-has-idle-wait;
};
sdhi2@0xee140000 {
compatible = "renesas,shmobile-sdhi";
reg = <0xee140000 0x100>;
interrupt-parent = <&gic>;
interrupts = <0 103 0x4
0 104 0x4
0 105 0x4>;
interrupt-names = "card_detect", "sdcard", "sdio";
reg-io-width = <2>;
vmmc-supply = <&fixedregulator2v8>;
vqmmc-supply = <&fixedregulator2v8>;
renesas,shmobile-sdhi-has-idle-wait;
renesas,shmobile-sdhi-use-gpio-cd;
renesas,shmobile-sdhi-wrprotect-disable;
cd-gpios = <&gpio 13 1>;
};
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
drivers/mmc/host/sh_mobile_sdhi.c | 76 +++++++++++++++++++++++++++++++------
1 file changed, 65 insertions(+), 11 deletions(-)
diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index 0bdc146..8c7e658 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -29,6 +29,7 @@
#include <linux/mfd/tmio.h>
#include <linux/sh_dma.h>
#include <linux/delay.h>
+#include <linux/of_gpio.h>
#include "tmio_mmc.h"
@@ -117,13 +118,64 @@ static const struct sh_mobile_sdhi_ops sdhi_ops = {
.cd_wakeup = sh_mobile_sdhi_cd_wakeup,
};
+static int __devinit
+sh_mobile_sdhi_probe_clk(struct platform_device *pdev,
+ struct sh_mobile_sdhi *priv,
+ const char *clk_name)
+{
+ priv->clk = clk_get(&pdev->dev, clk_name);
+ if (IS_ERR(priv->clk)) {
+ dev_err(&pdev->dev, "cannot get clock \"%s\"\n", clk_name);
+ return PTR_ERR(priv->clk);
+ }
+
+ return 0;
+}
+
+#ifdef CONFIG_OF
+static int __devinit
+sh_mobile_sdhi_probe_config_dt(struct platform_device *pdev,
+ struct sh_mobile_sdhi *priv)
+{
+ struct tmio_mmc_data *mmc_data = &priv->mmc_data;
+ struct device_node *np = pdev->dev.of_node;
+ int ret;
+
+ BUG_ON(!np);
+
+ ret = sh_mobile_sdhi_probe_clk(pdev, priv, np->name);
+ if (ret)
+ return ret;
+
+ ret = of_get_named_gpio(np, "cd-gpios", 0);
+ if (gpio_is_valid(ret))
+ mmc_data->cd_gpio = ret;
+
+ if (of_get_property(np, "renesas,shmobile-sdhi-has-idle-wait", NULL))
+ mmc_data->flags |= TMIO_MMC_HAS_IDLE_WAIT;
+ if (of_get_property(np, "renesas,shmobile-sdhi-use-gpio-cd", NULL))
+ mmc_data->flags |= TMIO_MMC_USE_GPIO_CD;
+ if (of_get_property(np, "renesas,shmobile-sdhi-wrprotect-disable",
+ NULL))
+ mmc_data->flags |= TMIO_MMC_WRPROTECT_DISABLE;
+
+ return 0;
+}
+#else
+static int __devinit
+sh_mobile_sdhi_probe_config_dt(struct platform_device *pdev,
+ struct sh_mobile_sdhi *priv)
+{
+ return 0;
+}
+#endif
+
static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev)
{
struct sh_mobile_sdhi *priv;
struct tmio_mmc_data *mmc_data;
struct sh_mobile_sdhi_info *p = pdev->dev.platform_data;
struct tmio_mmc_host *host;
- char clk_name[8];
int irq, ret, i = 0;
bool multiplexed_isr = true;
@@ -144,21 +196,17 @@ static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev)
}
}
- snprintf(clk_name, sizeof(clk_name), "sdhi%d", pdev->id);
- priv->clk = clk_get(&pdev->dev, clk_name);
- if (IS_ERR(priv->clk)) {
- dev_err(&pdev->dev, "cannot get clock \"%s\"\n", clk_name);
- ret = PTR_ERR(priv->clk);
- goto eclkget;
- }
-
mmc_data->clk_enable = sh_mobile_sdhi_clk_enable;
mmc_data->clk_disable = sh_mobile_sdhi_clk_disable;
mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
if (p) {
+ char clk_name[8];
+ snprintf(clk_name, sizeof(clk_name), "sdhi%d", pdev->id);
+ ret = sh_mobile_sdhi_probe_clk(pdev, priv, clk_name);
+ if (ret)
+ goto eclkget;
+
mmc_data->flags = p->tmio_flags;
- if (mmc_data->flags & TMIO_MMC_HAS_IDLE_WAIT)
- mmc_data->write16_hook = sh_mobile_sdhi_write16_hook;
mmc_data->ocr_mask = p->tmio_ocr_mask;
mmc_data->capabilities |= p->tmio_caps;
mmc_data->capabilities2 |= p->tmio_caps2;
@@ -176,7 +224,13 @@ static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev)
priv->dma_priv.alignment_shift = 1; /* 2-byte alignment */
mmc_data->dma = &priv->dma_priv;
}
+ } else {
+ ret = sh_mobile_sdhi_probe_config_dt(pdev, priv);
+ if (ret)
+ goto eclkget;
}
+ if (mmc_data->flags & TMIO_MMC_HAS_IDLE_WAIT)
+ mmc_data->write16_hook = sh_mobile_sdhi_write16_hook;
/*
* All SDHI blocks support 2-byte and larger block sizes in 4-bit
--
1.7.10.4
^ permalink raw reply related
* [PATCH 1/7] mmc: sh-mmcif: provide default allowed voltage
From: Simon Horman @ 2012-11-26 0:16 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1353889014-17142-1-git-send-email-horms@verge.net.au>
Use MMC_VDD_165_195 as the allowed voltages in the absence of
platform data. This should allow device tree to initialise MMCIF
for a number of boards.
A more complete solution would be to provide either MMCIF or MMC device
try bindings to set the allowed voltages.
Tested on the KZM-A9-GT board
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
drivers/mmc/host/sh_mmcif.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index 11d2bc3..88d6866 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -1293,12 +1293,9 @@ static void sh_mmcif_init_ocr(struct sh_mmcif_host *host)
mmc_regulator_get_supply(mmc);
- if (!pd)
- return;
-
if (!mmc->ocr_avail)
- mmc->ocr_avail = pd->ocr;
- else if (pd->ocr)
+ mmc->ocr_avail = pd ? pd->ocr : MMC_VDD_165_195;
+ else if (pd && pd->ocr)
dev_warn(mmc_dev(mmc), "Platform OCR mask is ignored\n");
}
--
1.7.10.4
^ permalink raw reply related
* [PATCH 0/7] ARM: mach-shmobile: kzm9g: Reference DT implementation
From: Simon Horman @ 2012-11-26 0:16 UTC (permalink / raw)
To: linux-arm-kernel
Hi Magnus, Hi all,
this series is a first pass at providing a refernce DT implementation
for the kzm9g baord which is intended to act as a guide for mach-shmobile
developers.
The first two patches of the series make minor modifications to the mmcif
and sdhi drivers to allow registration of those devices using device
tree on the KZM9G board.
The following three patches enhance sh77a0 SoC support to allow minimal
registratioj using device tree.
The final patch adds a fresh board and dts file which initialises the
kfm9g board using device tree as much as possible.
Simon Horman (7):
mmc: sh-mmcif: provide default allowed voltage
mmc: sdhi: enchance OF support for flags and cd-gpios
sh: pfc: Allow device tree registration
ARM: shmobile: pfc-sh73a0: Register device tree
ARM: mach-shmobile: sh73a0: Allow initialisation of GIC by DT
ARM: mach-shmobile: sh73a0: Minimal setup using DT
ARM: mach-shmobile: kzm9g: Reference DT implementation
arch/arm/boot/dts/Makefile | 3 +-
arch/arm/boot/dts/sh73a0-kzm9g-reference.dts | 153 ++++++++++++++++++++++++
arch/arm/mach-shmobile/Kconfig | 10 ++
arch/arm/mach-shmobile/Makefile | 8 +-
arch/arm/mach-shmobile/board-kzm9g-reference.c | 142 ++++++++++++++++++++++
arch/arm/mach-shmobile/include/mach/common.h | 3 +
arch/arm/mach-shmobile/intc-sh73a0.c | 14 +++
arch/arm/mach-shmobile/pfc-sh73a0.c | 45 +++++++
arch/arm/mach-shmobile/setup-sh73a0.c | 41 ++++++-
drivers/mmc/host/sh_mmcif.c | 7 +-
drivers/mmc/host/sh_mobile_sdhi.c | 76 ++++++++++--
drivers/sh/pfc/gpio.c | 15 +++
include/linux/sh_pfc.h | 7 ++
13 files changed, 501 insertions(+), 23 deletions(-)
create mode 100644 arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
create mode 100644 arch/arm/mach-shmobile/board-kzm9g-reference.c
--
1.7.10.4
^ permalink raw reply
* Re: [PATCH v2] media: V4L2: add temporary clock helpers
From: Sakari Ailus @ 2012-11-25 11:04 UTC (permalink / raw)
To: Sylwester Nawrocki
Cc: Laurent Pinchart, Guennadi Liakhovetski, Linux Media Mailing List,
Hans Verkuil, Sylwester Nawrocki, Magnus Damm, linux-sh
In-Reply-To: <50AEACA5.1010805@gmail.com>
Hi Sylwester,
Sylwester Nawrocki wrote:
> Hi All,
>
> On 11/14/2012 02:06 PM, Laurent Pinchart wrote:
> ...
>>>>>>>> +
>>>>>>>> +static DEFINE_MUTEX(clk_lock);
>>>>>>>> +static LIST_HEAD(v4l2_clk);
>>>>>>>
>>>>>>> As Sylwester mentioned, what about s/v4l2_clk/v4l2_clks/ ?
>>>>>>
>>>>>> Don't you think naming of a static variable isn't important enough?
>>>>>> ;-) I think code authors should have enough freedom to at least pick
>>>>>> up single vs. plural form:-) "clks" is too many consonants for my
>>>>>> taste, if it were anything important I'd rather agree to
>>>>>> "clk_head" or
>>>>>> "clk_list" or something similar.
>>>>>
>>>>> clk_list makes sense IMO since the clk_ prefis is the same.
>
> FWIW, clk_list looks fine for me as well.
>
>>>>>>>> +void v4l2_clk_put(struct v4l2_clk *clk)
>>>>>>>> +{
>>>>>>>> + if (!IS_ERR(clk))
>>>>>>>> + module_put(clk->ops->owner);
>>>>>>>> +}
>>>>>>>> +EXPORT_SYMBOL(v4l2_clk_put);
>>>>>>>> +
>>>>>>>> +int v4l2_clk_enable(struct v4l2_clk *clk)
>>>>>>>> +{
>>>>>>>> + if (atomic_inc_return(&clk->enable) = 1&&
>>>>>>>> clk->ops->enable) {
>>>>>>>> + int ret = clk->ops->enable(clk);
>>>>>>>> + if (ret< 0)
>>>>>>>> + atomic_dec(&clk->enable);
>>>>>>>> + return ret;
>>>>>>>> + }
>>>>>>>
>>>>>>> I think you need a spinlock here instead of atomic operations. You
>>>>>>> could get preempted after atomic_inc_return() and before
>>>>>>> clk->ops->enable() by another process that would call
>>>>>>> v4l2_clk_enable(). The function would return with enabling the
>>>>>>> clock.
>>>>>>
>>>>>> Sorry, what's the problem then? "Our" instance will succeed and call
>>>>>> ->enable() and the preempting instance will see the enable count> 1
>>>>>> and just return.
>>>>>
>>>>> The clock is guaranteed to be enabled only after the call has
>>>>> returned.
>>>>> The second caller of v4lw_clk_enable() thus may proceed without the
>>>>> clock being enabled.
>>>>>
>>>>> In principle enable() might also want to sleep, so how about using a
>>>>> mutex for the purpose instead of a spinlock?
>>>>
>>>> If enable() needs to sleep we should split the enable call into prepare
>>>> and enable, like the common clock framework did.
>>>
>>> I'm pretty sure we won't need to toggle this from interrupt context
>>> which is
>>> what the clock framework does, AFAIU. Accessing i2c subdevs mandates
>>> sleeping already.
>>>
>>> We might not need to have a mutex either if no driver needs to sleep for
>>> this, still I guess this is more likely. I'm ok with both; just
>>> thought to
>>> mention this.
>>
>> Right, I'm fine with a mutex for now, we'll split enable into enable and
>> prepare later if needed.
>
> How about just dropping reference counting from this code entirely ?
> What would be use cases for multiple users of a single clock ? E.g.
> multiple
> sensors case where each one uses same clock provided by a host interface ?
> If we allow the sensor subdev drivers to be setting the clock frequency and
> each sensor uses different frequency, then I can't see how this can work
> reliably. I mean it's the clock's provider that should coordinate and
> reference count the clock users. If a clock is enabled for one sensor and
> some other sensor is attempting to set different frequency then the
> set_rate
> callback should return an error. The clock provider will need use
> internally
> a lock for the clock anyway, and to track the clock reference count too.
> So I'm inclined to leave all this refcounting bits out to individual clock
> providers.
The common clock framework achieves this through notifiers. That'd be
probably overkill in this case.
What comes to the implementation now, would it be enough if changing the
clock rate would work once after the clock first had users, with this
capability renewed once all users are gone?
I wonder if enabling the clock should be allowed at all if the rate
hasn't been explicitly set. I don't know of a sensor driver which would
be able to use a non-predefined clock frequency.
--
Kind regards,
Sakari Ailus
sakari.ailus@iki.fi
^ permalink raw reply
* [PATCH 9/9] tile: dma_debug: add debug_dma_mapping_error support
From: Shuah Khan @ 2012-11-23 21:37 UTC (permalink / raw)
To: linux-arm-kernel
Add dma-debug interface debug_dma_mapping_error() to debug drivers that fail
to check dma mapping errors on addresses returned by dma_map_single() and
dma_map_page() interfaces.
Signed-off-by: Shuah Khan <shuah.khan@hp.com>
---
arch/tile/include/asm/dma-mapping.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/tile/include/asm/dma-mapping.h b/arch/tile/include/asm/dma-mapping.h
index 4b6247d..f2ff191 100644
--- a/arch/tile/include/asm/dma-mapping.h
+++ b/arch/tile/include/asm/dma-mapping.h
@@ -72,6 +72,7 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
static inline int
dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
{
+ debug_dma_mapping_error(dev, dma_addr);
return get_dma_ops(dev)->mapping_error(dev, dma_addr);
}
--
1.7.9.5
^ permalink raw reply related
* [PATCH 8/9] sparc: dma_debug: add debug_dma_mapping_error support
From: Shuah Khan @ 2012-11-23 21:37 UTC (permalink / raw)
To: linux-arm-kernel
Add dma-debug interface debug_dma_mapping_error() to debug drivers that fail
to check dma mapping errors on addresses returned by dma_map_single() and
dma_map_page() interfaces.
Signed-off-by: Shuah Khan <shuah.khan@hp.com>
Acked-by: David S. Miller <davem@davemloft.net>
---
arch/sparc/include/asm/dma-mapping.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h
index 8493fd3..05fe53f 100644
--- a/arch/sparc/include/asm/dma-mapping.h
+++ b/arch/sparc/include/asm/dma-mapping.h
@@ -59,6 +59,7 @@ static inline void dma_free_attrs(struct device *dev, size_t size,
static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
{
+ debug_dma_mapping_error(dev, dma_addr);
return (dma_addr = DMA_ERROR_CODE);
}
--
1.7.9.5
^ permalink raw reply related
* [PATCH 7/9] sh: dma_debug: add debug_dma_mapping_error support
From: Shuah Khan @ 2012-11-23 21:36 UTC (permalink / raw)
To: linux-arm-kernel
Add dma-debug interface debug_dma_mapping_error() to debug drivers that fail
to check dma mapping errors on addresses returned by dma_map_single() and
dma_map_page() interfaces.
Signed-off-by: Shuah Khan <shuah.khan@hp.com>
---
arch/sh/include/asm/dma-mapping.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h
index 8bd965e..b437f2c 100644
--- a/arch/sh/include/asm/dma-mapping.h
+++ b/arch/sh/include/asm/dma-mapping.h
@@ -46,6 +46,7 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
{
struct dma_map_ops *ops = get_dma_ops(dev);
+ debug_dma_mapping_error(dev, dma_addr);
if (ops->mapping_error)
return ops->mapping_error(dev, dma_addr);
--
1.7.9.5
^ permalink raw reply related
* [PATCH 6/9] powerpc: dma_debug: add debug_dma_mapping_error support
From: Shuah Khan @ 2012-11-23 21:35 UTC (permalink / raw)
To: linux-arm-kernel
Add dma-debug interface debug_dma_mapping_error() to debug drivers that fail
to check dma mapping errors on addresses returned by dma_map_single() and
dma_map_page() interfaces.
Signed-off-by: Shuah Khan <shuah.khan@hp.com>
---
arch/powerpc/include/asm/dma-mapping.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h
index 7816087..e27e9ad 100644
--- a/arch/powerpc/include/asm/dma-mapping.h
+++ b/arch/powerpc/include/asm/dma-mapping.h
@@ -172,6 +172,7 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
{
struct dma_map_ops *dma_ops = get_dma_ops(dev);
+ debug_dma_mapping_error(dev, dma_addr);
if (dma_ops->mapping_error)
return dma_ops->mapping_error(dev, dma_addr);
--
1.7.9.5
^ permalink raw reply related
* [PATCH 5/9] mips: dma_debug: add debug_dma_mapping_error support
From: Shuah Khan @ 2012-11-23 21:34 UTC (permalink / raw)
To: linux-arm-kernel
Add dma-debug interface debug_dma_mapping_error() to debug drivers that fail
to check dma mapping errors on addresses returned by dma_map_single() and
dma_map_page() interfaces.
Signed-off-by: Shuah Khan <shuah.khan@hp.com>
---
arch/mips/include/asm/dma-mapping.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/mips/include/asm/dma-mapping.h b/arch/mips/include/asm/dma-mapping.h
index be39a12..006b43e 100644
--- a/arch/mips/include/asm/dma-mapping.h
+++ b/arch/mips/include/asm/dma-mapping.h
@@ -40,6 +40,8 @@ static inline int dma_supported(struct device *dev, u64 mask)
static inline int dma_mapping_error(struct device *dev, u64 mask)
{
struct dma_map_ops *ops = get_dma_ops(dev);
+
+ debug_dma_mapping_error(dev, mask);
return ops->mapping_error(dev, mask);
}
--
1.7.9.5
^ permalink raw reply related
* [PATCH 4/9] microblaze: dma-mapping: support debug_dma_mapping_error
From: Shuah Khan @ 2012-11-23 21:33 UTC (permalink / raw)
To: linux-arm-kernel
Add support for debug_dma_mapping_error() call to avoid warning from
debug_dma_unmap() interface when it checks for mapping error checked
status. Without this patch, device driver failed to check map error
warning is generated.
Signed-off-by: Shuah Khan <shuah.khan@hp.com>
Acked-by: Michal Simek <monstr@monstr.eu>
---
This patch is already in linux-next. Including it in this series for
completeness. linux-next commit f229605441030bcd315c21d97b25889d63ed0130
-- shuah
---
arch/microblaze/include/asm/dma-mapping.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/microblaze/include/asm/dma-mapping.h b/arch/microblaze/include/asm/dma-mapping.h
index 01d2282..46460f1 100644
--- a/arch/microblaze/include/asm/dma-mapping.h
+++ b/arch/microblaze/include/asm/dma-mapping.h
@@ -114,6 +114,8 @@ static inline void __dma_sync(unsigned long paddr,
static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
{
struct dma_map_ops *ops = get_dma_ops(dev);
+
+ debug_dma_mapping_error(dev, dma_addr);
if (ops->mapping_error)
return ops->mapping_error(dev, dma_addr);
--
1.7.9.5
^ permalink raw reply related
* [PATCH 3/9] ia64: dma_debug: add debug_dma_mapping_error support
From: Shuah Khan @ 2012-11-23 21:32 UTC (permalink / raw)
To: linux-arm-kernel
Add dma-debug interface debug_dma_mapping_error() to debug drivers that fail
to check dma mapping errors on addresses returned by dma_map_single() and
dma_map_page() interfaces.
Signed-off-by: Shuah Khan <shuah.khan@hp.com>
---
arch/ia64/include/asm/dma-mapping.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/ia64/include/asm/dma-mapping.h b/arch/ia64/include/asm/dma-mapping.h
index 4f5e814..cf3ab7e 100644
--- a/arch/ia64/include/asm/dma-mapping.h
+++ b/arch/ia64/include/asm/dma-mapping.h
@@ -58,6 +58,7 @@ static inline void dma_free_attrs(struct device *dev, size_t size,
static inline int dma_mapping_error(struct device *dev, dma_addr_t daddr)
{
struct dma_map_ops *ops = platform_dma_get_ops(dev);
+ debug_dma_mapping_error(dev, daddr);
return ops->mapping_error(dev, daddr);
}
--
1.7.9.5
^ permalink raw reply related
* [PATCH 2/9] c6x: dma_debug: add debug_dma_mapping_error support
From: Shuah Khan @ 2012-11-23 21:32 UTC (permalink / raw)
To: linux-arm-kernel
Add dma-debug interface debug_dma_mapping_error() to debug drivers that fail
to check dma mapping errors on addresses returned by dma_map_single() and
dma_map_page() interfaces.
Signed-off-by: Shuah Khan <shuah.khan@hp.com>
Acked-by: Mark Salter <msalter@redhat.com>
---
arch/c6x/include/asm/dma-mapping.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/c6x/include/asm/dma-mapping.h b/arch/c6x/include/asm/dma-mapping.h
index 03579fd..3c69406 100644
--- a/arch/c6x/include/asm/dma-mapping.h
+++ b/arch/c6x/include/asm/dma-mapping.h
@@ -32,6 +32,7 @@ static inline int dma_set_mask(struct device *dev, u64 dma_mask)
*/
static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
{
+ debug_dma_mapping_error(dev, dma_addr);
return dma_addr = ~0;
}
--
1.7.9.5
^ permalink raw reply related
* [PATCH 1/9] ARM64: dma_debug: add debug_dma_mapping_error support
From: Shuah Khan @ 2012-11-23 21:31 UTC (permalink / raw)
To: linux-arm-kernel
Add dma-debug interface debug_dma_mapping_error() to debug drivers that fail
to check dma mapping errors on addresses returned by dma_map_single() and
dma_map_page() interfaces.
Signed-off-by: Shuah Khan <shuah.khan@hp.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
---
arch/arm64/include/asm/dma-mapping.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h
index 538f4b4..9947768 100644
--- a/arch/arm64/include/asm/dma-mapping.h
+++ b/arch/arm64/include/asm/dma-mapping.h
@@ -50,6 +50,7 @@ static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t dev_addr)
static inline int dma_mapping_error(struct device *dev, dma_addr_t dev_addr)
{
struct dma_map_ops *ops = get_dma_ops(dev);
+ debug_dma_mapping_error(dev, dev_addr);
return ops->mapping_error(dev, dev_addr);
}
--
1.7.9.5
^ permalink raw reply related
* [PATCH 0/9] dma_debug: add debug_dma_mapping_error support to architectures that support DMA_DEBUG_A
From: Shuah Khan @ 2012-11-23 21:29 UTC (permalink / raw)
To: linux-arm-kernel
An earlier patch added dma mapping error debug feature to dma_debug
infrastructure. References:
https://lkml.org/lkml/2012/10/8/296
https://lkml.org/lkml/2012/11/3/219
The following series of patches adds the call to debug_dma_mapping_error() to
architecture specific dma_mapping_error() interfaces on the following
architectures that support CONFIG_DMA_API_DEBUG.
arm64
c6x
ia64
microblaze
mips
powerpc
sh
sparc
tile
arm - Change is already in Marek's dma-mapping tree[1]
https://patchwork.kernel.org/patch/1625601/
microblaze - Change is already in linux-next. Including it for completeness
linux-next commit f229605441030bcd315c21d97b25889d63ed0130
x86 - done in the first patch that added the feature.
ARM64: dma_debug: add debug_dma_mapping_error support
c6x: dma_debug: add debug_dma_mapping_error support
ia64: dma_debug: add debug_dma_mapping_error support
microblaze: dma-mapping: support debug_dma_mapping_error
mips: dma_debug: add debug_dma_mapping_error support
powerpc: dma_debug: add debug_dma_mapping_error support
sh: dma_debug: add debug_dma_mapping_error support
sparc: dma_debug: add debug_dma_mapping_error support
tile: dma_debug: add debug_dma_mapping_error support
Thanks,
-- Shuah
^ permalink raw reply
* [PATCH 5/5] sh: kfr2r09: Use lv5207lp backlight
From: Laurent Pinchart @ 2012-11-23 16:35 UTC (permalink / raw)
To: linux-fbdev
Replace the backlight callback with a lv5207lp backlight platform
device.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
arch/sh/boards/mach-kfr2r09/lcd_wqvga.c | 48 ---------------------------
arch/sh/boards/mach-kfr2r09/setup.c | 19 ++++++++---
arch/sh/include/mach-kfr2r09/mach/kfr2r09.h | 2 -
3 files changed, 14 insertions(+), 55 deletions(-)
diff --git a/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c b/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c
index c620503..355a78a 100644
--- a/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c
+++ b/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c
@@ -276,51 +276,3 @@ void kfr2r09_lcd_start(void *sohandle, struct sh_mobile_lcdc_sys_bus_ops *so)
{
write_memory_start(sohandle, so);
}
-
-#define CTRL_CKSW 0x10
-#define CTRL_C10 0x20
-#define CTRL_CPSW 0x80
-#define MAIN_MLED4 0x40
-#define MAIN_MSW 0x80
-
-int kfr2r09_lcd_set_brightness(int brightness)
-{
- struct i2c_adapter *a;
- struct i2c_msg msg;
- unsigned char buf[2];
- int ret;
-
- a = i2c_get_adapter(0);
- if (!a)
- return -ENODEV;
-
- buf[0] = 0x00;
- if (brightness)
- buf[1] = CTRL_CPSW | CTRL_C10 | CTRL_CKSW;
- else
- buf[1] = 0;
-
- msg.addr = 0x75;
- msg.buf = buf;
- msg.len = 2;
- msg.flags = 0;
- ret = i2c_transfer(a, &msg, 1);
- if (ret != 1)
- return -ENODEV;
-
- buf[0] = 0x01;
- if (brightness)
- buf[1] = MAIN_MSW | MAIN_MLED4 | 0x0c;
- else
- buf[1] = 0;
-
- msg.addr = 0x75;
- msg.buf = buf;
- msg.len = 2;
- msg.flags = 0;
- ret = i2c_transfer(a, &msg, 1);
- if (ret != 1)
- return -ENODEV;
-
- return 0;
-}
diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c
index ab502f12..1df4398 100644
--- a/arch/sh/boards/mach-kfr2r09/setup.c
+++ b/arch/sh/boards/mach-kfr2r09/setup.c
@@ -21,6 +21,7 @@
#include <linux/input.h>
#include <linux/input/sh_keysc.h>
#include <linux/i2c.h>
+#include <linux/platform_data/lv5207lp.h>
#include <linux/regulator/fixed.h>
#include <linux/regulator/machine.h>
#include <linux/usb/r8a66597.h>
@@ -159,11 +160,6 @@ static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = {
.setup_sys = kfr2r09_lcd_setup,
.start_transfer = kfr2r09_lcd_start,
},
- .bl_info = {
- .name = "sh_mobile_lcdc_bl",
- .max_brightness = 1,
- .set_brightness = kfr2r09_lcd_set_brightness,
- },
.sys_bus_cfg = {
.ldmt2r = 0x07010904,
.ldmt3r = 0x14012914,
@@ -195,6 +191,17 @@ static struct platform_device kfr2r09_sh_lcdc_device = {
},
};
+static struct lv5207lp_platform_data kfr2r09_backlight_data = {
+ .fbdev = &kfr2r09_sh_lcdc_device.dev,
+ .def_value = 13,
+ .max_value = 13,
+};
+
+static struct i2c_board_info kfr2r09_backlight_board_info = {
+ I2C_BOARD_INFO("lv5207lp", 0x75),
+ .platform_data = &kfr2r09_backlight_data,
+};
+
static struct r8a66597_platdata kfr2r09_usb0_gadget_data = {
.on_chip = 1,
};
@@ -627,6 +634,8 @@ static int __init kfr2r09_devices_setup(void)
gpio_request(GPIO_FN_SDHI0CMD, NULL);
gpio_request(GPIO_FN_SDHI0CLK, NULL);
+ i2c_register_board_info(0, &kfr2r09_backlight_board_info, 1);
+
return platform_add_devices(kfr2r09_devices,
ARRAY_SIZE(kfr2r09_devices));
}
diff --git a/arch/sh/include/mach-kfr2r09/mach/kfr2r09.h b/arch/sh/include/mach-kfr2r09/mach/kfr2r09.h
index c20c9e5..79f154e 100644
--- a/arch/sh/include/mach-kfr2r09/mach/kfr2r09.h
+++ b/arch/sh/include/mach-kfr2r09/mach/kfr2r09.h
@@ -4,13 +4,11 @@
#include <video/sh_mobile_lcdc.h>
#if defined(CONFIG_FB_SH_MOBILE_LCDC) || defined(CONFIG_FB_SH_MOBILE_LCDC_MODULE)
-int kfr2r09_lcd_set_brightness(int brightness);
int kfr2r09_lcd_setup(void *sys_ops_handle,
struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
void kfr2r09_lcd_start(void *sys_ops_handle,
struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
#else
-static int kfr2r09_lcd_set_brightness(int brightness) {}
static int kfr2r09_lcd_setup(void *sys_ops_handle,
struct sh_mobile_lcdc_sys_bus_ops *sys_ops)
{
--
1.7.8.6
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox