Skip to contentSkip to conversation

mfd: Add power control platform data to SDHI driver

PATCH In review Magnus Damm 4 participants 11 messages Nov 27, 2009 – Nov 30, 2009

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: Add power control platform data to SDHI driver

From: Magnus Damm <[email protected]>

This patch adds platform data with a function for power control to the SDHI driver. The idea is that board specific code can provide their own functions so power can be enabled and disabled for the sd-cards.

---

Needed by the Ecovec board.
Apply on top of the SDHI driver in the SuperH tree.

 drivers/mfd/sh_mobile_sdhi.c       |   11 +++++++++++
 include/linux/mfd/sh_mobile_sdhi.h |    8 ++++++++
 2 files changed, 19 insertions(+)
drivers/mfd/sh_mobile_sdhi.c +11 -0
@@ -24,6 +24,7 @@
 
 #include <linux/mfd/core.h>
 #include <linux/mfd/tmio.h>
+#include <linux/mfd/sh_mobile_sdhi.h>
 
 struct sh_mobile_sdhi {
 	struct clk *clk;
@@ -50,6 +51,15 @@ static struct mfd_cell sh_mobile_sdhi_ce
 	.resources     = sh_mobile_sdhi_resources,
 };
 
+static void sh_mobile_sdhi_set_pwr(struct platform_device *tmio, int state)
+{
+	struct platform_device *pdev = to_platform_device(tmio->dev.parent);
+	struct sh_mobile_sdhi_info *p = pdev->dev.platform_data;
+
+	if (p && p->set_pwr)
+		p->set_pwr(pdev, state);
+}
+
 static int __init sh_mobile_sdhi_probe(struct platform_device *pdev)
 {
 	struct sh_mobile_sdhi *priv;
@@ -87,6 +97,7 @@ static int __init sh_mobile_sdhi_probe(s
 
 	/* FIXME: silly const unsigned int hclk */
 	*(unsigned int *)&priv->mmc_data.hclk = clk_get_rate(priv->clk);
+	priv->mmc_data.set_pwr = sh_mobile_sdhi_set_pwr;
 
 	memcpy(&priv->cell_mmc, &sh_mobile_sdhi_cell, sizeof(priv->cell_mmc));
 	priv->cell_mmc.driver_data = &priv->mmc_data;
include/linux/mfd/sh_mobile_sdhi.h new file +8 -0
@@ -0,0 +1,8 @@
+#ifndef __SH_MOBILE_SDHI_H__
+#define __SH_MOBILE_SDHI_H__
+
+struct sh_mobile_sdhi_info {
+	void (*set_pwr)(struct platform_device *pdev, int state);
+};
+
+#endif /* __SH_MOBILE_SDHI_H__ */
#1 lore raw

Hi Magnus,

Quoted 7 lines · Magnus Damm

From: Magnus Damm <[email protected]>

This patch adds platform data with a function for power control to the SDHI driver. The idea is that board specific code can provide their own functions so power can be enabled and disabled for the sd-cards.

Quoted 5 lines

---

Needed by the Ecovec board.
Apply on top of the SDHI driver in the SuperH tree.

I wasnt cc'ed on that driver, right ? Just checking I didnt forget it...

Cheers,
Samuel.

Quoted 49 lines
 drivers/mfd/sh_mobile_sdhi.c       |   11 +++++++++++
 include/linux/mfd/sh_mobile_sdhi.h |    8 ++++++++
 2 files changed, 19 insertions(+)
drivers/mfd/sh_mobile_sdhi.c +11 -0
@@ -24,6 +24,7 @@
 
 #include <linux/mfd/core.h>
 #include <linux/mfd/tmio.h>
+#include <linux/mfd/sh_mobile_sdhi.h>
 
 struct sh_mobile_sdhi {
 	struct clk *clk;
@@ -50,6 +51,15 @@ static struct mfd_cell sh_mobile_sdhi_ce
 	.resources     = sh_mobile_sdhi_resources,
 };
 
+static void sh_mobile_sdhi_set_pwr(struct platform_device *tmio, int state)
+{
+	struct platform_device *pdev = to_platform_device(tmio->dev.parent);
+	struct sh_mobile_sdhi_info *p = pdev->dev.platform_data;
+
+	if (p && p->set_pwr)
+		p->set_pwr(pdev, state);
+}
+
 static int __init sh_mobile_sdhi_probe(struct platform_device *pdev)
 {
 	struct sh_mobile_sdhi *priv;
@@ -87,6 +97,7 @@ static int __init sh_mobile_sdhi_probe(s
 
 	/* FIXME: silly const unsigned int hclk */
 	*(unsigned int *)&priv->mmc_data.hclk = clk_get_rate(priv->clk);
+	priv->mmc_data.set_pwr = sh_mobile_sdhi_set_pwr;
 
 	memcpy(&priv->cell_mmc, &sh_mobile_sdhi_cell, sizeof(priv->cell_mmc));
 	priv->cell_mmc.driver_data = &priv->mmc_data;
include/linux/mfd/sh_mobile_sdhi.h new file +8 -0
@@ -0,0 +1,8 @@
+#ifndef __SH_MOBILE_SDHI_H__
+#define __SH_MOBILE_SDHI_H__
+
+struct sh_mobile_sdhi_info {
+	void (*set_pwr)(struct platform_device *pdev, int state);
+};
+
+#endif /* __SH_MOBILE_SDHI_H__ */
Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/
#2 lore raw
In reply to Magnus Damm

Hi Samuel,

Quoted 6 lines · Samuel Ortiz
Quoted 5 lines · Magnus Damm

This patch adds platform data with a function for power control to the SDHI driver. The idea is that board specific code can provide their own functions so power can be enabled and disabled for the sd-cards.

Quoted 6 lines
Quoted 5 lines

---

 Needed by the Ecovec board.
 Apply on top of the SDHI driver in the SuperH tree.

I wasnt cc'ed on that driver, right ? Just checking I didnt forget it...

You are correct, my bad. I'll do my best to keep you CC:ed from now on!

/ magnus

#3 lore raw
In reply to Magnus Damm
Quoted 9 lines · Magnus Damm

Hi Samuel,

Quoted 6 lines · Samuel Ortiz
Quoted 5 lines · Magnus Damm

This patch adds platform data with a function for power control to the SDHI driver. The idea is that board specific code can provide their own functions so power can be enabled and disabled for the sd-cards.

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines

---

 Needed by the Ecovec board.
 Apply on top of the SDHI driver in the SuperH tree.

I wasnt cc'ed on that driver, right ? Just checking I didnt forget it...

You are correct, my bad. I'll do my best to keep you CC:ed from now on!

No worries, I was mostly concerned about not having lost it in may mailbox.

Cheers,
Samuel.

Quoted 1 line

/ magnus

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/
#4 lore raw

PATCH 1/1 sh: Add SDHI power control support to Ecovec

From: Magnus Damm <[email protected]>

This patch adds support for SDHI power control to the Ecovec board. Platform data and power control callbacks for SDHI0 and SDHI1 are added. Power is by default off.

---

Depends on the SDHI power control patch.

 arch/sh/boards/mach-ecovec24/setup.c |   36 ++++++++++++++++++++++++++++------
 1 file changed, 30 insertions(+), 6 deletions(-)
arch/sh/boards/mach-ecovec24/setup.c +30 -6
@@ -20,6 +20,7 @@
 #include <linux/i2c.h>
 #include <linux/i2c/tsc2007.h>
 #include <linux/input.h>
+#include <linux/mfd/sh_mobile_sdhi.h>
 #include <video/sh_mobile_lcdc.h>
 #include <media/sh_mobile_ceu.h>
 #include <media/tw9910.h>
@@ -423,6 +424,15 @@ static struct i2c_board_info ts_i2c_clie
 };
 
 /* SHDI0 */
+static void sdhi0_set_pwr(struct platform_device *pdev, int state)
+{
+	gpio_set_value(GPIO_PTB6, state);
+}
+
+static struct sh_mobile_sdhi_info sdhi0_info = {
+	.set_pwr = sdhi0_set_pwr,
+};
+
 static struct resource sdhi0_resources[] = {
 	[0] = {
 		.name	= "SDHI0",
@@ -441,12 +451,24 @@ static struct platform_device sdhi0_devi
 	.num_resources  = ARRAY_SIZE(sdhi0_resources),
 	.resource       = sdhi0_resources,
 	.id             = 0,
+	.dev	= {
+		.platform_data	= &sdhi0_info,
+	},
 	.archdata = {
 		.hwblk_id = HWBLK_SDHI0,
 	},
 };
 
 /* SHDI1 */
+static void sdhi1_set_pwr(struct platform_device *pdev, int state)
+{
+	gpio_set_value(GPIO_PTB7, state);
+}
+
+static struct sh_mobile_sdhi_info sdhi1_info = {
+	.set_pwr = sdhi1_set_pwr,
+};
+
 static struct resource sdhi1_resources[] = {
 	[0] = {
 		.name	= "SDHI1",
@@ -465,6 +487,9 @@ static struct platform_device sdhi1_devi
 	.num_resources  = ARRAY_SIZE(sdhi1_resources),
 	.resource       = sdhi1_resources,
 	.id             = 1,
+	.dev	= {
+		.platform_data	= &sdhi1_info,
+	},
 	.archdata = {
 		.hwblk_id = HWBLK_SDHI1,
 	},
@@ -865,7 +890,7 @@ static int __init arch_setup(void)
 	gpio_direction_input(GPIO_PTR5);
 	gpio_direction_input(GPIO_PTR6);
 
-	/* enable SDHI0 */
+	/* enable SDHI0 (needs DS2.4 set to ON) */
 	gpio_request(GPIO_FN_SDHI0CD,  NULL);
 	gpio_request(GPIO_FN_SDHI0WP,  NULL);
 	gpio_request(GPIO_FN_SDHI0CMD, NULL);
@@ -874,8 +899,10 @@ static int __init arch_setup(void)
 	gpio_request(GPIO_FN_SDHI0D2,  NULL);
 	gpio_request(GPIO_FN_SDHI0D1,  NULL);
 	gpio_request(GPIO_FN_SDHI0D0,  NULL);
+	gpio_request(GPIO_PTB6, NULL);
+	gpio_direction_output(GPIO_PTB6, 0);
 
-	/* enable SDHI1 */
+	/* enable SDHI1 (needs DS2.6,7 set to ON,OFF) */
 	gpio_request(GPIO_FN_SDHI1CD,  NULL);
 	gpio_request(GPIO_FN_SDHI1WP,  NULL);
 	gpio_request(GPIO_FN_SDHI1CMD, NULL);
@@ -884,11 +911,8 @@ static int __init arch_setup(void)
 	gpio_request(GPIO_FN_SDHI1D2,  NULL);
 	gpio_request(GPIO_FN_SDHI1D1,  NULL);
 	gpio_request(GPIO_FN_SDHI1D0,  NULL);
-
-	gpio_request(GPIO_PTB6, NULL);
 	gpio_request(GPIO_PTB7, NULL);
-	gpio_direction_output(GPIO_PTB6, 1);
-	gpio_direction_output(GPIO_PTB7, 1);
+	gpio_direction_output(GPIO_PTB7, 0);
 
 	/* I/O buffer drive ability is high for SDHI1 */
 	ctrl_outw((ctrl_inw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA);
#5 lore raw

PATCH 1/1 sh: Add CPG save/restore code for sh7724 R-standby

From: Magnus Damm <[email protected]>

Add sh7724 code to save and restore CPG state during R-standby. Only CPG registers IRDACLKCR and SPUCLKCR require software save and restore.

---

 arch/sh/kernel/cpu/sh4a/setup-sh7724.c |   11 +++++++++++
 1 file changed, 11 insertions(+)
arch/sh/kernel/cpu/sh4a/setup-sh7724.c +11 -0
@@ -941,6 +941,9 @@ static struct {
 	/* RWDT */
 	unsigned short rwtcnt;
 	unsigned short rwtcsr;
+	/* CPG */
+	unsigned long irdaclk;
+	unsigned long spuclk;
 } sh7724_rstandby_state;
 
 static int sh7724_pre_sleep_notifier_call(struct notifier_block *nb,
@@ -998,6 +1001,10 @@ static int sh7724_pre_sleep_notifier_cal
 	sh7724_rstandby_state.rwtcsr |= 0xa500;
 	__raw_writew(sh7724_rstandby_state.rwtcsr & 0x07, 0xa4520004);
 
+	/* CPG */
+	sh7724_rstandby_state.irdaclk = __raw_readl(0xa4150018); /* IRDACLKCR */
+	sh7724_rstandby_state.spuclk = __raw_readl(0xa415003c); /* SPUCLKCR */
+
 	return NOTIFY_DONE;
 }
 
@@ -1052,6 +1059,10 @@ static int sh7724_post_sleep_notifier_ca
 	__raw_writew(sh7724_rstandby_state.rwtcnt, 0xa4520000); /* RWTCNT */
 	__raw_writew(sh7724_rstandby_state.rwtcsr, 0xa4520004); /* RWTCSR */
 
+	/* CPG */
+	__raw_writel(sh7724_rstandby_state.irdaclk, 0xa4150018); /* IRDACLKCR */
+	__raw_writel(sh7724_rstandby_state.spuclk, 0xa415003c); /* SPUCLKCR */
+
 	return NOTIFY_DONE;
 }
 
#6 lore raw

PATCH 1/1 sh: Move KEYSC header file

From: Magnus Damm <[email protected]>

This patch moves the KEYSC header file from the
SuperH specific asm directory to a place where
it can be shared by multiple architectures.

---

 arch/sh/boards/mach-ecovec24/setup.c |    2 +-
 arch/sh/boards/mach-kfr2r09/setup.c  |    2 +-
 arch/sh/boards/mach-migor/setup.c    |    2 +-
 arch/sh/boards/mach-se/7722/setup.c  |    2 +-
 arch/sh/boards/mach-se/7724/setup.c  |    2 +-
 arch/sh/include/asm/sh_keysc.h       |   14 --------------
 drivers/input/keyboard/sh_keysc.c    |    2 +-
 include/linux/input/sh_keysc.h       |   14 ++++++++++++++
 8 files changed, 20 insertions(+), 20 deletions(-)
arch/sh/boards/mach-ecovec24/setup.c +1 -1
@@ -20,12 +20,12 @@
 #include <linux/i2c.h>
 #include <linux/i2c/tsc2007.h>
 #include <linux/input.h>
+#include <linux/input/sh_keysc.h>
 #include <linux/mfd/sh_mobile_sdhi.h>
 #include <video/sh_mobile_lcdc.h>
 #include <media/sh_mobile_ceu.h>
 #include <asm/heartbeat.h>
 #include <asm/sh_eth.h>
-#include <asm/sh_keysc.h>
 #include <asm/clock.h>
 #include <asm/suspend.h>
 #include <cpu/sh7724.h>
arch/sh/boards/mach-kfr2r09/setup.c +1 -1
@@ -16,6 +16,7 @@
 #include <linux/clk.h>
 #include <linux/gpio.h>
 #include <linux/input.h>
+#include <linux/input/sh_keysc.h>
 #include <linux/i2c.h>
 #include <linux/usb/r8a66597.h>
 #include <media/soc_camera.h>
@@ -25,7 +26,6 @@
 #include <asm/clock.h>
 #include <asm/machvec.h>
 #include <asm/io.h>
-#include <asm/sh_keysc.h>
 #include <cpu/sh7724.h>
 #include <mach/kfr2r09.h>
 
arch/sh/boards/mach-migor/setup.c +1 -1
@@ -11,6 +11,7 @@
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/input.h>
+#include <linux/input/sh_keysc.h>
 #include <linux/mtd/physmap.h>
 #include <linux/mtd/nand.h>
 #include <linux/i2c.h>
@@ -25,7 +26,6 @@
 #include <asm/clock.h>
 #include <asm/machvec.h>
 #include <asm/io.h>
-#include <asm/sh_keysc.h>
 #include <asm/suspend.h>
 #include <mach/migor.h>
 #include <cpu/sh7722.h>
arch/sh/boards/mach-se/7722/setup.c +1 -1
@@ -14,6 +14,7 @@
 #include <linux/platform_device.h>
 #include <linux/ata_platform.h>
 #include <linux/input.h>
+#include <linux/input/sh_keysc.h>
 #include <linux/smc91x.h>
 #include <mach-se/mach/se7722.h>
 #include <mach-se/mach/mrshpc.h>
@@ -21,7 +22,6 @@
 #include <asm/clock.h>
 #include <asm/io.h>
 #include <asm/heartbeat.h>
-#include <asm/sh_keysc.h>
 #include <cpu/sh7722.h>
 
 /* Heartbeat */
arch/sh/boards/mach-se/7724/setup.c +1 -1
@@ -19,6 +19,7 @@
 #include <linux/smc91x.h>
 #include <linux/gpio.h>
 #include <linux/input.h>
+#include <linux/input/sh_keysc.h>
 #include <linux/usb/r8a66597.h>
 #include <video/sh_mobile_lcdc.h>
 #include <media/sh_mobile_ceu.h>
@@ -27,7 +28,6 @@
 #include <asm/heartbeat.h>
 #include <asm/sh_eth.h>
 #include <asm/clock.h>
-#include <asm/sh_keysc.h>
 #include <asm/suspend.h>
 #include <cpu/sh7724.h>
 #include <mach-se/mach/se7724.h>
arch/sh/include/asm/sh_keysc.h deleted +0 -14
@@ -1,14 +0,0 @@
-#ifndef __ASM_KEYSC_H__
-#define __ASM_KEYSC_H__
-
-#define SH_KEYSC_MAXKEYS 30
-
-struct sh_keysc_info {
-	enum { SH_KEYSC_MODE_1, SH_KEYSC_MODE_2, SH_KEYSC_MODE_3 } mode;
-	int scan_timing; /* 0 -> 7, see KYCR1, SCN[2:0] */
-	int delay;
-	int kycr2_delay;
-	int keycodes[SH_KEYSC_MAXKEYS];
-};
-
-#endif /* __ASM_KEYSC_H__ */
drivers/input/keyboard/sh_keysc.c +1 -1
@@ -18,9 +18,9 @@
 #include <linux/delay.h>
 #include <linux/platform_device.h>
 #include <linux/input.h>
+#include <linux/input/sh_keysc.h>
 #include <linux/clk.h>
 #include <linux/io.h>
-#include <asm/sh_keysc.h>
 
 #define KYCR1_OFFS   0x00
 #define KYCR2_OFFS   0x04
include/linux/input/sh_keysc.h new file +14 -0
@@ -0,0 +1,14 @@
+#ifndef __SH_KEYSC_H__
+#define __SH_KEYSC_H__
+
+#define SH_KEYSC_MAXKEYS 30
+
+struct sh_keysc_info {
+	enum { SH_KEYSC_MODE_1, SH_KEYSC_MODE_2, SH_KEYSC_MODE_3 } mode;
+	int scan_timing; /* 0 -> 7, see KYCR1, SCN[2:0] */
+	int delay;
+	int kycr2_delay;
+	int keycodes[SH_KEYSC_MAXKEYS];
+};
+
+#endif /* __SH_KEYSC_H__ */
maintainer
#7 lore raw

Re: [PATCH] sh: Move KEYSC header file

Quoted 7 lines · Magnus Damm

From: Magnus Damm <[email protected]>

This patch moves the KEYSC header file from the
SuperH specific asm directory to a place where
it can be shared by multiple architectures.

No oobjections on my part...

Signature · 1 line
Dmitry
#8 lore raw

PATCH 1/1 sh: Break out SuperH PFC code

From: Magnus Damm <[email protected]>

This file breaks out the SuperH PFC code from arch/sh/kernel/gpio.c + arch/sh/include/asm/gpio.h to drivers/sh/pfc.c + include/linux/sh_pfc.h.

Similar to the INTC stuff. The non-SuperH specific file location makes it possible to share the code between multiple architectures.

---

 arch/sh/include/asm/gpio.h |   82 ------
 arch/sh/kernel/Makefile    |    1 
 arch/sh/kernel/gpio.c      |  584 --------------------------------------------
 drivers/sh/Makefile        |    1 
 drivers/sh/pfc.c           |  584 ++++++++++++++++++++++++++++++++++++++++++++
 include/linux/sh_pfc.h     |   96 +++++++
 6 files changed, 682 insertions(+), 666 deletions(-)
arch/sh/include/asm/gpio.h +1 -81
@@ -20,7 +20,7 @@
 #endif
 
 #define ARCH_NR_GPIOS 512
-#include <asm-generic/gpio.h>
+#include <linux/sh_pfc.h>
 
 #ifdef CONFIG_GPIOLIB
 
@@ -53,84 +53,4 @@ static inline int irq_to_gpio(unsigned i
 
 #endif /* CONFIG_GPIOLIB */
 
-typedef unsigned short pinmux_enum_t;
-typedef unsigned short pinmux_flag_t;
-
-#define PINMUX_TYPE_NONE            0
-#define PINMUX_TYPE_FUNCTION        1
-#define PINMUX_TYPE_GPIO            2
-#define PINMUX_TYPE_OUTPUT          3
-#define PINMUX_TYPE_INPUT           4
-#define PINMUX_TYPE_INPUT_PULLUP    5
-#define PINMUX_TYPE_INPUT_PULLDOWN  6
-
-#define PINMUX_FLAG_TYPE            (0x7)
-#define PINMUX_FLAG_WANT_PULLUP     (1 << 3)
-#define PINMUX_FLAG_WANT_PULLDOWN   (1 << 4)
-
-#define PINMUX_FLAG_DBIT_SHIFT      5
-#define PINMUX_FLAG_DBIT            (0x1f << PINMUX_FLAG_DBIT_SHIFT)
-#define PINMUX_FLAG_DREG_SHIFT      10
-#define PINMUX_FLAG_DREG            (0x3f << PINMUX_FLAG_DREG_SHIFT)
-
-struct pinmux_gpio {
-	pinmux_enum_t enum_id;
-	pinmux_flag_t flags;
-};
-
-#define PINMUX_GPIO(gpio, data_or_mark) [gpio] = { data_or_mark }
-#define PINMUX_DATA(data_or_mark, ids...) data_or_mark, ids, 0
-
-struct pinmux_cfg_reg {
-	unsigned long reg, reg_width, field_width;
-	unsigned long *cnt;
-	pinmux_enum_t *enum_ids;
-};
-
-#define PINMUX_CFG_REG(name, r, r_width, f_width) \
-	.reg = r, .reg_width = r_width, .field_width = f_width,		\
-	.cnt = (unsigned long [r_width / f_width]) {}, \
-	.enum_ids = (pinmux_enum_t [(r_width / f_width) * (1 << f_width)]) \
-
-struct pinmux_data_reg {
-	unsigned long reg, reg_width, reg_shadow;
-	pinmux_enum_t *enum_ids;
-};
-
-#define PINMUX_DATA_REG(name, r, r_width) \
-	.reg = r, .reg_width = r_width,	\
-	.enum_ids = (pinmux_enum_t [r_width]) \
-
-struct pinmux_range {
-	pinmux_enum_t begin;
-	pinmux_enum_t end;
-	pinmux_enum_t force;
-};
-
-struct pinmux_info {
-	char *name;
-	pinmux_enum_t reserved_id;
-	struct pinmux_range data;
-	struct pinmux_range input;
-	struct pinmux_range input_pd;
-	struct pinmux_range input_pu;
-	struct pinmux_range output;
-	struct pinmux_range mark;
-	struct pinmux_range function;
-
-	unsigned first_gpio, last_gpio;
-
-	struct pinmux_gpio *gpios;
-	struct pinmux_cfg_reg *cfg_regs;
-	struct pinmux_data_reg *data_regs;
-
-	pinmux_enum_t *gpio_data;
-	unsigned int gpio_data_size;
-
-	unsigned long *gpio_in_use;
-	struct gpio_chip chip;
-};
-
-int register_pinmux(struct pinmux_info *pip);
-
 #endif /* __ASM_SH_GPIO_H */
arch/sh/kernel/Makefile +0 -1
@@ -32,7 +32,6 @@ obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
 obj-$(CONFIG_STACKTRACE)	+= stacktrace.o
 obj-$(CONFIG_IO_TRAPPED)	+= io_trapped.o
 obj-$(CONFIG_KPROBES)		+= kprobes.o
-obj-$(CONFIG_GENERIC_GPIO)	+= gpio.o
 obj-$(CONFIG_DYNAMIC_FTRACE)	+= ftrace.o
 obj-$(CONFIG_FTRACE_SYSCALLS)	+= ftrace.o
 obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o
arch/sh/kernel/gpio.c deleted +0 -584

584 lines not on this page · raw message

drivers/sh/Makefile +1 -0
@@ -3,4 +3,5 @@
 #
 obj-$(CONFIG_SUPERHYWAY)	+= superhyway/
 obj-$(CONFIG_MAPLE)		+= maple/
+obj-$(CONFIG_GENERIC_GPIO)	+= pfc.o
 obj-y				+= intc.o
drivers/sh/pfc.c new file +584 -0

584 lines not on this page · raw message

include/linux/sh_pfc.h new file +96 -0

96 lines not on this page · raw message

#9 lore raw

PATCH 1/1 sh: Improve kfr2r09 serial port setup code

From: Magnus Damm <[email protected]>

This patch improves the serial port communication quality of port YC401 on the KFR2R09 board. With this fix serial console is fine at 115200 - up and down keys now work as expected. Thanks to Hirohide Yamasaki for this fix.

---

 arch/sh/boards/mach-kfr2r09/setup.c |   51 +++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)
arch/sh/boards/mach-kfr2r09/setup.c +51 -0
@@ -414,11 +414,59 @@ static int kfr2r09_usb0_gadget_i2c_setup
 
 	return 0;
 }
+
+static int kfr2r09_serial_i2c_setup(void)
+{
+	struct i2c_adapter *a;
+	struct i2c_msg msg;
+	unsigned char buf[2];
+	int ret;
+
+	a = i2c_get_adapter(0);
+	if (!a)
+		return -ENODEV;
+
+	/* set bit 6 (the 7th bit) of chip at 0x09, register 0x13 */
+	buf[0] = 0x13;
+	msg.addr = 0x09;
+	msg.buf = buf;
+	msg.len = 1;
+	msg.flags = 0;
+	ret = i2c_transfer(a, &msg, 1);
+	if (ret != 1)
+		return -ENODEV;
+
+	buf[0] = 0;
+	msg.addr = 0x09;
+	msg.buf = buf;
+	msg.len = 1;
+	msg.flags = I2C_M_RD;
+	ret = i2c_transfer(a, &msg, 1);
+	if (ret != 1)
+		return -ENODEV;
+
+	buf[1] = buf[0] | (1 << 6);
+	buf[0] = 0x13;
+	msg.addr = 0x09;
+	msg.buf = buf;
+	msg.len = 2;
+	msg.flags = 0;
+	ret = i2c_transfer(a, &msg, 1);
+	if (ret != 1)
+		return -ENODEV;
+
+	return 0;
+}
 #else
 static int kfr2r09_usb0_gadget_i2c_setup(void)
 {
 	return -ENODEV;
 }
+
+static int kfr2r09_serial_i2c_setup(void)
+{
+	return -ENODEV;
+}
 #endif
 
 static int kfr2r09_usb0_gadget_setup(void)
@@ -463,6 +511,9 @@ static int __init kfr2r09_devices_setup(
 	/* enable SCIF1 serial port for YC401 console support */
 	gpio_request(GPIO_FN_SCIF1_RXD, NULL);
 	gpio_request(GPIO_FN_SCIF1_TXD, NULL);
+	kfr2r09_serial_i2c_setup(); /* ECONTMSK(bit6=L10ONEN) set 1 */
+	gpio_request(GPIO_PTG3, NULL); /* HPON_ON */
+	gpio_direction_output(GPIO_PTG3, 1); /* HPON_ON = H */
 
 	/* setup NOR flash at CS0 */
 	ctrl_outl(0x36db0400, BSC_CS0BCR);
#10 lore raw
Quoted 4 lines · Magnus Damm

This patch adds platform data with a function for power control to the SDHI driver. The idea is that board specific code can provide their own functions so power can be enabled and disabled for the sd-cards.

Quoted 3 lines · Magnus Damm

This patch adds support for SDHI power control to the Ecovec board. Platform data and power control callbacks for SDHI0 and SDHI1 are added. Power is by default off.

Quoted 3 lines · Magnus Damm

Add sh7724 code to save and restore CPG state during R-standby. Only CPG registers IRDACLKCR and SPUCLKCR require software save and restore.

Quoted 3 lines · Magnus Damm

This patch moves the KEYSC header file from the SuperH specific asm directory to a place where
it can be shared by multiple architectures.

Quoted 7 lines · Magnus Damm

This file breaks out the SuperH PFC code from arch/sh/kernel/gpio.c + arch/sh/include/asm/gpio.h to drivers/sh/pfc.c + include/linux/sh_pfc.h.

Similar to the INTC stuff. The non-SuperH specific file location makes it possible to share the code between multiple architectures.

Quoted 4 lines · Magnus Damm

This patch improves the serial port communication quality of port YC401 on the KFR2R09 board. With this fix serial console is fine at 115200 - up and down keys now work as expected. Thanks to Hirohide Yamasaki for this fix.

All applied, thanks.