Skip to contentSkip to conversation

gpio: Add Multi-Function-Pin configuration driver for Marvell SoCs

PATCH New Prafulla Wadaskar 1 participant 4 messages Dec 9, 2010 – Dec 11, 2010 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH v4 2/7 gpio: Add Multi-Function-Pin configuration driver for Marvell SoCs

Most of the Marvell SoCs has Multi Function Pin (MFP) configuration registers For ex. ARMADA100.

These registers are programmed to expose the specific functionality associated with respective SoC Pins

This driver provides configuration APIs,
using them, configuration need to be done in board specific code

for ex- following code configures MFPs 107 and 108 for UART_TX/RX functionality

int board_early_init_f(void)

{
        u32 mfp_cfg[] = {
                /* Console on UART1 */
                MFP107_UART1_RXD,
                MFP108_UART1_TXD,
                MFP_EOC         /*End of configureation*/
        };
        /* configure MFP's */
        mfp_config(mfp_cfg);
        return 0;
}

---
Changelog v4:
1. Driver renamed as mvmfp
2. Re-architected mvmfp driver as per review feedback

Changelog v4 (REV-1):
1. MFPR_BASE renamed as MV_MFPR_BASE and defination moved to board config file
2. val&= removed from config-write logic

 drivers/gpio/Makefile |    1 +
 drivers/gpio/mvmfp.c  |   87 ++++++++++++++++++++++++++++++++++++++++++
 include/mvmfp.h       |  100 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 188 insertions(+), 0 deletions(-)
 create mode 100644 drivers/gpio/mvmfp.c
 create mode 100644 include/mvmfp.h
drivers/gpio/Makefile +1 -0
index 398024c..a5fa2b5 100644
@@ -27,6 +27,7 @@ LIB 	:= $(obj)libgpio.o
 
 COBJS-$(CONFIG_AT91_GPIO)	+= at91_gpio.o
 COBJS-$(CONFIG_KIRKWOOD_GPIO)	+= kw_gpio.o
+COBJS-$(CONFIG_MARVELL_MFP)	+= mvmfp.o
 COBJS-$(CONFIG_MXC_GPIO)	+= mxc_gpio.o
 COBJS-$(CONFIG_PCA953X)		+= pca953x.o
 COBJS-$(CONFIG_S5P)		+= s5p_gpio.o
drivers/gpio/mvmfp.c new file +87 -0

87 lines not on this page · raw message

include/mvmfp.h new file +100 -0

100 lines not on this page · raw message

Signature · 1 line
1.5.3.4
#1 lore raw

PATCH v4 2/7 gpio: Add Multi-Function-Pin configuration driver for Marvell SoCs

Quoted 48 lines

-----Original Message-----
From: Prafulla Wadaskar [mailto:prafulla at marvell.com]
Sent: Thursday, December 09, 2010 7:47 PM
To: u-boot at lists.denx.de
Cc: Lei Wen; Eric Miao; Yu Tang; Kiran Vedere; Manas Saksena; Prabhanjan Sarnaik; Ashish Karkare; Prafulla Wadaskar
Subject: [PATCH v4 2/7] [REV-1] gpio: Add Multi-Function-Pin configuration driver for Marvell SoCs

Most of the Marvell SoCs has Multi Function Pin (MFP) configuration registers
For ex. ARMADA100.

These registers are programmed to expose the specific functionality associated with respective SoC Pins

This driver provides configuration APIs,
using them, configuration need to be done in board specific code

for ex- following code configures MFPs 107 and 108 for UART_TX/RX functionality

int board_early_init_f(void)

{
        u32 mfp_cfg[] = {
                /* Console on UART1 */
                MFP107_UART1_RXD,
                MFP108_UART1_TXD,
                MFP_EOC         /*End of configureation*/
        };
        /* configure MFP's */
        mfp_config(mfp_cfg);
        return 0;
}

---
Changelog v4:
1. Driver renamed as mvmfp
2. Re-architected mvmfp driver as per review feedback

Changelog v4 (REV-1):
1. MFPR_BASE renamed as MV_MFPR_BASE and defination moved to board config file
2. val&= removed from config-write logic

Quoted 8 lines
 drivers/gpio/Makefile |    1 +
 drivers/gpio/mvmfp.c  |   87 ++++++++++++++++++++++++++++++++++++++++++
 include/mvmfp.h       |  100
+++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 188 insertions(+), 0 deletions(-)
 create mode 100644 drivers/gpio/mvmfp.c
 create mode 100644 include/mvmfp.h

Applied to u-boot-marvell.git master branch

Regards..
Prafulla ..

#2 lore raw

PATCH v4 6/7 mv-common.h: Add support for ARMADA100 Platforms

In reply to Prafulla Wadaskar

This patch adds commonly used macros for ARMADA100 based baords, Also some code reshuffled and updated for typos and comments

---
Changelog v3:
CONFIG_ARCH_CPU_INIT moved out of #ifdef

Changelog v4:
CONFIG_MFP change to CONFIG_MARVELL_MFP
some whitespaces removed

Changelog v4(REV-1)
MV_MFPR_BASE configuration added

 include/configs/mv-common.h |   66 ++++++++++++++++++++++++++++++++----------
 1 files changed, 50 insertions(+), 16 deletions(-)
include/configs/mv-common.h +50 -16
index 0a76163..97b6971 100644
@@ -39,6 +39,7 @@
 #define CONFIG_MARVELL		1
 #define CONFIG_ARM926EJS	1	/* Basic Architecture */
 
+/* ====> Kirkwood Platform Common Definations */
 #if defined(CONFIG_KIRKWOOD)
 #define CONFIG_MD5	/* get_random_hex on krikwood needs MD5 support */
 #define CONFIG_KIRKWOOD_EGIGA_INIT	/* Enable GbePort0/1 for kernel */
@@ -54,27 +55,46 @@
 #define	CONFIG_SYS_KWD_CONFIG	$(SRCTREE)/$(CONFIG_BOARDDIR)/kwbimage.cfg
 #endif /* CONFIG_SYS_KWD_CONFIG */
 
-/*
- * CONFIG_SYS_TEXT_BASE can be defined in board specific header file, if needed
- */
-#ifndef CONFIG_SYS_TEXT_BASE
-#define	CONFIG_SYS_TEXT_BASE	0x00600000
-#endif /* CONFIG_SYS_TEXT_BASE */
+/* Kirkwood has 2k of Security SRAM, use it for SP */
+#define CONFIG_SYS_INIT_SP_ADDR		0xC8012000
+#define CONFIG_NR_DRAM_BANKS_MAX	2
 
 #define CONFIG_I2C_MVTWSI_BASE	KW_TWSI_BASE
-#define MV_UART0_BASE		KW_UART0_BASE
+#define MV_UART_CONSOLE_BASE	KW_UART0_BASE
 #define MV_SATA_BASE		KW_SATA_BASE
 #define MV_SATA_PORT0_OFFSET	KW_SATA_PORT0_OFFSET
 #define MV_SATA_PORT1_OFFSET	KW_SATA_PORT1_OFFSET
 
+/* ====> ARMADA100 Platform Common Definations */
+#elif defined (CONFIG_ARMADA100)
+
+#define CONFIG_SYS_TCLK		(14745600)	/* NS16550 clk config */
+#define CONFIG_SYS_HZ_CLOCK	(3250000)	/* Timer Freq. 3.25MHZ */
+#define CONFIG_MARVELL_MFP			/* Enable mvmfp driver */
+#define MV_MFPR_BASE		ARMD1_MFPR_BASE
+#define MV_UART_CONSOLE_BASE	ARMD1_UART1_BASE
+#define CONFIG_SYS_NS16550_IER	(1 << 6)	/* Bit 6 in UART_IER register
+						represents UART Unit Enable */
+/*
+ * There is no internal RAM in ARMADA100, using DRAM
+ * TBD: dcache to be used for this
+ */
+#define CONFIG_SYS_INIT_SP_ADDR		(CONFIG_SYS_TEXT_BASE - 0x00200000)
+#define CONFIG_NR_DRAM_BANKS_MAX	2
+
 #else
-#error "Unsupported SoC"
+#error "Unsupported SoC Platform..."
 #endif
 
+/*
+ * Custom CONFIG_SYS_TEXT_BASE can be done in <board>.h
+ */
+#ifndef CONFIG_SYS_TEXT_BASE
+#define	CONFIG_SYS_TEXT_BASE	0x00600000
+#endif /* CONFIG_SYS_TEXT_BASE */
+
 /* additions for new ARM relocation support */
-#define CONFIG_SYS_SDRAM_BASE		0x00000000
-/* Kirkwood has 2k of Security SRAM, use it for SP */
-#define CONFIG_SYS_INIT_SP_ADDR		0xC8012000
+#define CONFIG_SYS_SDRAM_BASE	0x00000000
 
 /*
  * CLKs configurations
@@ -88,7 +108,7 @@
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE	(-4)
 #define CONFIG_SYS_NS16550_CLK		CONFIG_SYS_TCLK
-#define CONFIG_SYS_NS16550_COM1		MV_UART0_BASE
+#define CONFIG_SYS_NS16550_COM1		MV_UART_CONSOLE_BASE
 
 /*
  * Serial Port configuration
@@ -156,25 +176,37 @@
 #define CONFIG_CMDLINE_EDITING
 #define CONFIG_CONSOLE_INFO_QUIET	/* some code reduction */
 #define CONFIG_ARCH_CPU_INIT	/* call arch_cpu_init() */
+#ifndef CONFIG_ARMADA100	/* will be removed latter */
 #define CONFIG_ARCH_MISC_INIT	/* call arch_misc_init() */
+#endif /* CONFIG_ARMADA100 */
 #define CONFIG_BOARD_EARLY_INIT_F /* call board_init_f for early inits */
 #define CONFIG_DISPLAY_CPUINFO	/* Display cpu info */
-#define CONFIG_NR_DRAM_BANKS	4
 #define CONFIG_STACKSIZE	0x00100000	/* regular stack- 1M */
 #define CONFIG_SYS_LOAD_ADDR	0x00800000	/* default load adr- 8M */
-#define CONFIG_SYS_MEMTEST_START 0x00400000	/* 4M */
-#define CONFIG_SYS_MEMTEST_END	0x007fffff	/*(_8M -1) */
+#define CONFIG_SYS_MEMTEST_START 0x00800000	/* 8M */
+#define CONFIG_SYS_MEMTEST_END	0x00ffffff	/*(_16M -1) */
 #define CONFIG_SYS_RESET_ADDRESS 0xffff0000	/* Rst Vector Adr */
 #define CONFIG_SYS_MAXARGS	16	/* max number of command args */
 
 /*
+ * DRAM Banks configuration, Custom config can be done in <board>.h
+ */
+#ifndef CONFIG_NR_DRAM_BANKS
+#define CONFIG_NR_DRAM_BANKS	CONFIG_NR_DRAM_BANKS_MAX
+#else
+#if (CONFIG_NR_DRAM_BANKS > CONFIG_NR_DRAM_BANKS_MAX)
+#error CONFIG_NR_DRAM_BANKS Configurated more than available
+#endif
+#endif /* CONFIG_NR_DRAM_BANKS */
+
+/*
  * Ethernet Driver configuration
  */
 #ifdef CONFIG_CMD_NET
 #define CONFIG_CMD_MII
 #define CONFIG_NETCONSOLE	/* include NetConsole support   */
 #define CONFIG_NET_MULTI	/* specify more that one ports available */
-#define	CONFIG_MII		/* expose smi ove miiphy interface */
+#define CONFIG_MII		/* expose smi ove miiphy interface */
 #define CONFIG_MVGBE		/* Enable Marvell Gbe Controller Driver */
 #define CONFIG_SYS_FAULT_ECHO_LINK_DOWN	/* detect link using phy */
 #define CONFIG_ENV_OVERWRITE	/* ethaddr can be reprogrammed */
@@ -232,6 +264,7 @@
 /*
  * File system
  */
+#ifndef CONFIG_ARMADA100	/* will be removed latter */
 #define CONFIG_CMD_EXT2
 #define CONFIG_CMD_JFFS2
 #define CONFIG_CMD_FAT
@@ -242,5 +275,6 @@
 #define CONFIG_MTD_PARTITIONS
 #define CONFIG_CMD_MTDPARTS
 #define CONFIG_LZO
+#endif /* CONFIG_ARMADA100 */
 
 #endif /* _MV_COMMON_H */
Signature · 1 line
1.5.3.4
#3 lore raw

PATCH v4 6/7 mv-common.h: Add support for ARMADA100 Platforms

Quoted 19 lines

-----Original Message-----
From: Prafulla Wadaskar [mailto:prafulla at marvell.com]
Sent: Thursday, December 09, 2010 7:47 PM
To: u-boot at lists.denx.de
Cc: Lei Wen; Eric Miao; Yu Tang; Kiran Vedere; Manas Saksena; Prabhanjan Sarnaik; Ashish Karkare; Prafulla Wadaskar
Subject: [PATCH v4 6/7] [REV-1] mv-common.h: Add support for ARMADA100 Platforms

This patch adds commonly used macros for ARMADA100 based baords, Also some code reshuffled and updated for typos and comments

---
Changelog v3:
CONFIG_ARCH_CPU_INIT moved out of #ifdef

Quoted 7 lines

Changelog v4:
CONFIG_MFP change to CONFIG_MARVELL_MFP
some whitespaces removed

Changelog v4(REV-1)
MV_MFPR_BASE configuration added

Applied to u-boot-marvell.git master branch

Regards..
Prafulla ..