Skip to contentSkip to conversation

pruss mfd drivers

PATCH Superseded Subhasish Ghosh 5 participants 21 messages Feb 1, 2011 – Feb 3, 2011

Subsystems (5)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

cover pruss mfd drivers

Programmable Realtime Unit (PRU) is basically a 32-bit RISC processor available within TI's DA8XX SOCs. It consists of local instruction and data RAM and also has access to SOC resources via a Switched Central Resource (SCR).

There are two PRU's available within DA8XX SOC's PRUSS, hence providing two execution cores. Devices/Protocols can be emulated on these utilizing either both or only one of the PRUs independently.

The rational behind the MFD driver being the fact that multiple devices can be implemented on the cores independently.
It's also possible, as in our case, to implement a single device on both the PRU's resulting in improved load sharing.

A detailed description is also available here:
http://processors.wiki.ti.com/index.php/Programmable_Realtime_Unit_Subsystem

version 1:
==========
* added pruss mfd driver.
* added pruss mfd board and platform changes.
* added pruss SocketCAN driver.
* added pruss SocketCAN board and platform changes.
* added pruss SocketCAN GPIOs.
* added previous review comments.

Subhasish Ghosh (9):
mfd: pruss mfd driver.
da850: pruss board specific additions.
da850: pruss platform specific additions.
can: pruss CAN driver.
da850: pruss CAN board specific additions.
da850: pruss CAN platform specific additions.
mfd: pruss CAN private data.
da850: pruss CAN board specific changes for gpios.
da850: pruss CAN platform specific changes for gpios.

 arch/arm/mach-davinci/board-da850-evm.c     |   75 ++
 arch/arm/mach-davinci/da850.c               |   12 +
 arch/arm/mach-davinci/devices-da8xx.c       |   65 ++
 arch/arm/mach-davinci/include/mach/da8xx.h  |    2 +
 arch/arm/mach-davinci/include/mach/mux.h    |    5 +
 drivers/mfd/Kconfig                         |   10 +
 drivers/mfd/Makefile                        |    1 +
 drivers/mfd/da8xx_pru.c                     |  403 +++++++++
 drivers/net/can/Kconfig                     |    1 +
 drivers/net/can/Makefile                    |    1 +
 drivers/net/can/da8xx_pruss/Kconfig         |   73 ++
 drivers/net/can/da8xx_pruss/Makefile        |    7 +
 drivers/net/can/da8xx_pruss/pruss_can.c     |  759 +++++++++++++++++
 drivers/net/can/da8xx_pruss/pruss_can_api.c | 1224 +++++++++++++++++++++++++++
 drivers/net/can/da8xx_pruss/pruss_can_api.h |  290 +++++++
 include/linux/mfd/pruss/da8xx_pru.h         |  106 +++
 include/linux/mfd/pruss/da8xx_prucore.h     |   74 ++
 17 files changed, 3108 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mfd/da8xx_pru.c
 create mode 100644 drivers/net/can/da8xx_pruss/Kconfig
 create mode 100644 drivers/net/can/da8xx_pruss/Makefile
 create mode 100644 drivers/net/can/da8xx_pruss/pruss_can.c
 create mode 100644 drivers/net/can/da8xx_pruss/pruss_can_api.c
 create mode 100644 drivers/net/can/da8xx_pruss/pruss_can_api.h
 create mode 100644 include/linux/mfd/pruss/da8xx_pru.h
 create mode 100644 include/linux/mfd/pruss/da8xx_prucore.h
Signature · 1 line
1.7.2.3
#1 lore raw

PATCH 1/9 mfd: pruss mfd driver.

This patch adds the pruss MFD driver and associated include files.

---
 drivers/mfd/Kconfig                     |   10 +
 drivers/mfd/Makefile                    |    1 +
 drivers/mfd/da8xx_pru.c                 |  403 +++++++++++++++++++++++++++++++
 include/linux/mfd/pruss/da8xx_pru.h     |  102 ++++++++
 include/linux/mfd/pruss/da8xx_prucore.h |   74 ++++++
 5 files changed, 590 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mfd/da8xx_pru.c
 create mode 100644 include/linux/mfd/pruss/da8xx_pru.h
 create mode 100644 include/linux/mfd/pruss/da8xx_prucore.h
drivers/mfd/Kconfig +10 -0
index fd01836..6c437df 100644
@@ -81,6 +81,16 @@ config MFD_DM355EVM_MSP
 	  boards.  MSP430 firmware manages resets and power sequencing,
 	  inputs from buttons and the IR remote, LEDs, an RTC, and more.
 
+config MFD_DA8XX_PRUSS
+	tristate "Texas Instruments DA8XX PRUSS support"
+	depends on ARCH_DAVINCI && ARCH_DAVINCI_DA850
+	select MFD_CORE
+	help
+	    This driver provides support api's for the programmable
+		realtime unit (PRU) present on TI's da8xx processors. It
+		provides basic read, write, config, enable, disable
+		routines to facilitate devices emulated on it.
+
 config HTC_EGPIO
 	bool "HTC EGPIO support"
 	depends on GENERIC_HARDIRQS && GPIOLIB && ARM
drivers/mfd/Makefile +1 -0
index a54e2c7..670d6b0 100644
@@ -13,6 +13,7 @@ obj-$(CONFIG_HTC_PASIC3)	+= htc-pasic3.o
 obj-$(CONFIG_HTC_I2CPLD)	+= htc-i2cpld.o
 
 obj-$(CONFIG_MFD_DAVINCI_VOICECODEC)	+= davinci_voicecodec.o
+obj-$(CONFIG_MFD_DA8XX_PRUSS)	+= da8xx_pru.o
 obj-$(CONFIG_MFD_DM355EVM_MSP)	+= dm355evm_msp.o
 
 obj-$(CONFIG_MFD_STMPE)		+= stmpe.o
drivers/mfd/da8xx_pru.c new file +403 -0

403 lines not on this page · raw message

include/linux/mfd/pruss/da8xx_pru.h new file +102 -0

102 lines not on this page · raw message

include/linux/mfd/pruss/da8xx_prucore.h new file +74 -0

74 lines not on this page · raw message

Signature · 1 line
1.7.2.3
#2 lore raw

PATCH 2/9 da850: pruss board specific additions.

In reply to Subhasish Ghosh

This patch adds board specific initializations and setup routines.

---
 arch/arm/mach-davinci/board-da850-evm.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/board-da850-evm.c +28 -0
index 11f986b..7938c6d 100644
@@ -1053,6 +1053,29 @@ static __init int da850_evm_init_cpufreq(void)
 static __init int da850_evm_init_cpufreq(void) { return 0; }
 #endif
 
+static struct da8xx_pruss_devices pruss_devices[] = {
+	{.dev_name = NULL,},
+};
+
+static int __init da8xx_evm_setup_pruss(void)
+{
+	u32 ret = 0;
+	u32 count;
+
+	for (count = 0; count < ARRAY_SIZE(pruss_devices); count++) {
+		if (pruss_devices[count].setup != NULL) {
+			ret = pruss_devices[count].setup();
+			if (ret) {
+				pr_warning("%s: %s init failed: %d\n", __func__,
+					pruss_devices[count].dev_name, ret);
+				return ret;
+			}
+		}
+	}
+
+	return da8xx_register_pruss(pruss_devices);
+}
+
 static __init void da850_evm_init(void)
 {
 	int ret;
@@ -1127,6 +1150,11 @@ static __init void da850_evm_init(void)
 
 	da8xx_register_mcasp(0, &da850_evm_snd_data);
 
+	ret = da8xx_evm_setup_pruss();
+	if (ret)
+		pr_warning("%s: pruss initialization failed: %d\n",
+				__func__, ret);
+
 	ret = davinci_cfg_reg_list(da850_lcdcntl_pins);
 	if (ret)
 		pr_warning("da850_evm_init: lcdcntl mux setup failed: %d\n",
Signature · 1 line
1.7.2.3
#3 lore raw

PATCH 2/9 da850: pruss board specific additions.

Hello.

Quoted 3 lines · Subhasish Ghosh

This patch adds board specific initializations and setup routines.

[...]

arch/arm/mach-davinci/board-da850-evm.c static __init int da850_evm_init_cpufreq(void) · line 1060

Quoted 13 lines
arch/arm/mach-davinci/board-da850-evm.c +5 -0
index 11f986b..7938c6d 100644
@@ -1053,6 +1053,29 @@ static __init int da850_evm_init_cpufreq(void)
  static __init int da850_evm_init_cpufreq(void) { return 0; }
  #endif
 
+static struct da8xx_pruss_devices pruss_devices[] = {
+	{.dev_name = NULL,},
+};
+
+static int __init da8xx_evm_setup_pruss(void)

Only da850_evm_setup_pruss() -- we're in the DA850 EVM support file.

Quoted 22 lines
arch/arm/mach-davinci/board-da850-evm.c +18 -0
+{
+	u32 ret = 0;
+	u32 count;
+
+	for (count = 0; count < ARRAY_SIZE(pruss_devices); count++) {
+		if (pruss_devices[count].setup != NULL) {
+			ret = pruss_devices[count].setup();
+			if (ret) {
+				pr_warning("%s: %s init failed: %d\n", __func__,
+					pruss_devices[count].dev_name, ret);
+				return ret;
+			}
+		}
+	}
+
+	return da8xx_register_pruss(pruss_devices);
+}
+
  static __init void da850_evm_init(void)
  {
  	int ret;

arch/arm/mach-davinci/board-da850-evm.c static __init void da850_evm_init(void) · line 1156

Quoted 7 lines
arch/arm/mach-davinci/board-da850-evm.c +4 -0
@@ -1127,6 +1150,11 @@ static __init void da850_evm_init(void)
 
  	da8xx_register_mcasp(0,&da850_evm_snd_data);
 
+	ret = da8xx_evm_setup_pruss();
+	if (ret)
+		pr_warning("%s: pruss initialization failed: %d\n",
+				__func__, ret);

Does it really make sense to print 2 messages for one error?

WBR, Sergei

#4 lore raw

PATCH 3/9 da850: pruss platform specific additions.

In reply to Subhasish Ghosh

This patch adds the platform device and assignes the platform resources for the PRUSS mfd driver.

---
 arch/arm/mach-davinci/da850.c              |    7 +++
 arch/arm/mach-davinci/devices-da8xx.c      |   65 ++++++++++++++++++++++++++++
 arch/arm/mach-davinci/include/mach/da8xx.h |    2 +
 3 files changed, 74 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/da850.c +7 -0
index 3443d97..341d836 100644
@@ -238,6 +238,12 @@ static struct clk tptc2_clk = {
 	.flags		= ALWAYS_ENABLED,
 };
 
+static struct clk pruss_clk = {
+	.name		= "pruss",
+	.parent		= &pll0_sysclk2,
+	.lpsc		= DA8XX_LPSC0_DMAX,
+};
+
 static struct clk uart0_clk = {
 	.name		= "uart0",
 	.parent		= &pll0_sysclk2,
@@ -387,6 +393,7 @@ static struct clk_lookup da850_clks[] = {
 	CLK(NULL,		"tpcc1",	&tpcc1_clk),
 	CLK(NULL,		"tptc2",	&tptc2_clk),
 	CLK(NULL,		"uart0",	&uart0_clk),
+	CLK(NULL,		"pruss",	&pruss_clk),
 	CLK(NULL,		"uart1",	&uart1_clk),
 	CLK(NULL,		"uart2",	&uart2_clk),
 	CLK(NULL,		"aintc",	&aintc_clk),
arch/arm/mach-davinci/devices-da8xx.c +65 -0

77 lines not on this page · raw message

arch/arm/mach-davinci/include/mach/da8xx.h +2 -0
index cfcb223..e5c178a 100644
@@ -15,6 +15,7 @@
 
 #include <linux/platform_device.h>
 #include <linux/davinci_emac.h>
+#include <linux/mfd/pruss/da8xx_pru.h>
 
 #include <mach/serial.h>
 #include <mach/edma.h>
@@ -81,6 +82,7 @@ int da8xx_register_watchdog(void);
 int da8xx_register_usb20(unsigned mA, unsigned potpgt);
 int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata);
 int da8xx_register_emac(void);
+int da8xx_register_pruss(struct da8xx_pruss_devices *);
 int da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata);
 int da8xx_register_mmcsd0(struct davinci_mmc_config *config);
 int da850_register_mmcsd1(struct davinci_mmc_config *config);
Signature · 1 line
1.7.2.3
#5 lore raw

PATCH 3/9 da850: pruss platform specific additions.

Hello.

Quoted 4 lines · Subhasish Ghosh

This patch adds the platform device and assignes the platform resources for the PRUSS mfd driver.

[...]

arch/arm/mach-davinci/da850.c static struct clk tptc2_clk = { · line 244

Quoted 12 lines
arch/arm/mach-davinci/da850.c +4 -0
index 3443d97..341d836 100644
@@ -238,6 +238,12 @@ static struct clk tptc2_clk = {
  	.flags		= ALWAYS_ENABLED,
  };
 
+static struct clk pruss_clk = {
+	.name		= "pruss",
+	.parent		= &pll0_sysclk2,
+	.lpsc		= DA8XX_LPSC0_DMAX,

IIRC, you were asked to change/add a new name for what is known as
DA8XX_LPSC0_DMAX...

arch/arm/mach-davinci/devices-da8xx.c void __init da8xx_register_mcasp(int id, struct snd_platform_data *pdata) · line 558

Quoted 10 lines
arch/arm/mach-davinci/devices-da8xx.c +5 -0
index beda8a4..562882c 100644
 
+struct platform_device da8xx_pruss_dev = {
+	.name			=	"da8xx_pruss",
+	.id				=	-1,
+	.num_resources	=	ARRAY_SIZE(da8xx_pruss_resources),
+	.resource		=	da8xx_pruss_resources,

Please align = uniformly.

Quoted 4 lines
arch/arm/mach-davinci/include/mach/da8xx.h +0 -0
index cfcb223..e5c178a 100644

[...]

arch/arm/mach-davinci/include/mach/da8xx.h int da8xx_register_watchdog(void); · line 88

Quoted 8 lines
arch/arm/mach-davinci/include/mach/da8xx.h +1 -0
@@ -81,6 +82,7 @@ int da8xx_register_watchdog(void);
 int da8xx_register_usb20(unsigned mA, unsigned potpgt);
 int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata);
 int da8xx_register_emac(void);
+int da8xx_register_pruss(struct da8xx_pruss_devices *);
 int da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata);
 int da8xx_register_mmcsd0(struct davinci_mmc_config *config);
 int da850_register_mmcsd1(struct davinci_mmc_config *config);

This patch should clearly precede the patch 2/9 as it defines
da8xx_register_pruss() which 2/9 uses.

WBR, Sergei

#6 lore raw

PATCH 4/9 can: pruss CAN driver.

In reply to Subhasish Ghosh

This patch adds support for the CAN device emulated on PRUSS.

---
 drivers/net/can/Kconfig                     |    1 +
 drivers/net/can/Makefile                    |    1 +
 drivers/net/can/da8xx_pruss/Kconfig         |   73 ++
 drivers/net/can/da8xx_pruss/Makefile        |    7 +
 drivers/net/can/da8xx_pruss/pruss_can.c     |  759 +++++++++++++++++
 drivers/net/can/da8xx_pruss/pruss_can_api.c | 1224 +++++++++++++++++++++++++++
 drivers/net/can/da8xx_pruss/pruss_can_api.h |  290 +++++++
 7 files changed, 2355 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/can/da8xx_pruss/Kconfig
 create mode 100644 drivers/net/can/da8xx_pruss/Makefile
 create mode 100644 drivers/net/can/da8xx_pruss/pruss_can.c
 create mode 100644 drivers/net/can/da8xx_pruss/pruss_can_api.c
 create mode 100644 drivers/net/can/da8xx_pruss/pruss_can_api.h
drivers/net/can/Kconfig +1 -0
index d5a9db6..ae8f0f9 100644
@@ -112,6 +112,7 @@ config PCH_CAN
 	  This driver can access CAN bus.
 
 source "drivers/net/can/mscan/Kconfig"
+source "drivers/net/can/da8xx_pruss/Kconfig"
 
 source "drivers/net/can/sja1000/Kconfig"
 
drivers/net/can/Makefile +1 -0
index 07ca159..849cdbf 100644
@@ -14,6 +14,7 @@ obj-$(CONFIG_CAN_SJA1000)	+= sja1000/
 obj-$(CONFIG_CAN_MSCAN)		+= mscan/
 obj-$(CONFIG_CAN_AT91)		+= at91_can.o
 obj-$(CONFIG_CAN_TI_HECC)	+= ti_hecc.o
+obj-$(CONFIG_CAN_TI_DA8XX_PRU)	+= da8xx_pruss/
 obj-$(CONFIG_CAN_MCP251X)	+= mcp251x.o
 obj-$(CONFIG_CAN_BFIN)		+= bfin_can.o
 obj-$(CONFIG_CAN_JANZ_ICAN3)	+= janz-ican3.o
drivers/net/can/da8xx_pruss/Kconfig new file +73 -0

73 lines not on this page · raw message

drivers/net/can/da8xx_pruss/Makefile new file +7 -0
new file mode 100644
index 0000000..48f3055
@@ -0,0 +1,7 @@
+#
+# Makefile for CAN Lite emulation
+#
+can_emu-objs :=   pruss_can.o \
+                  pruss_can_api.o
+
+obj-$(CONFIG_CAN_TI_DA8XX_PRU)    += can_emu.o
drivers/net/can/da8xx_pruss/pruss_can.c new file +759 -0

759 lines not on this page · raw message

drivers/net/can/da8xx_pruss/pruss_can_api.c new file +1224 -0

1,224 lines not on this page · raw message

drivers/net/can/da8xx_pruss/pruss_can_api.h new file +290 -0

290 lines not on this page · raw message

Signature · 1 line
1.7.2.3
#7 lore raw

PATCH 4/9 can: pruss CAN driver.

Hi,

Quoted 1 line

This patch adds support for the CAN device emulated on PRUSS.

You should CC the netdev[1] and the socketcan mailing lists[2] on these patches.

Cheers
Detlev

[1] netdev at vger.kernel.org
[2] socketcan-core at lists.berlios.de

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de

#8 lore raw

PATCH 5/9 da850: pruss CAN board specific additions.

In reply to Subhasish Ghosh

This patch adds the pruss CAN pin mux and registers the device with the pruss mfd driver.

---
 arch/arm/mach-davinci/board-da850-evm.c |   40 ++++++++++++++++++++++++++++++-
 1 files changed, 39 insertions(+), 1 deletions(-)
arch/arm/mach-davinci/board-da850-evm.c +39 -1
index 7938c6d..285545f 100644
@@ -1053,8 +1053,46 @@ static __init int da850_evm_init_cpufreq(void)
 static __init int da850_evm_init_cpufreq(void) { return 0; }
 #endif
 
+const short da850_pruss_can_pins[] = {
+	DA850_PRUSS_PRU0_R31_0, DA850_PRUSS_PRU1_R30_15,
+	DA850_PRUSS_PRU1_R31_18,
+	-1
+};
+
+static int __init da850_evm_setup_pruss_can(void)
+{
+	int ret, val = 0;
+	void __iomem *cfg_chip3_base;
+
+	if (!machine_is_davinci_da850_evm())
+		return 0;
+
+	ret = davinci_cfg_reg_list(da850_pruss_can_pins);
+	if (ret)
+		pr_warning("%s: da850_pruss_can_pins mux setup "
+					"failed:%d\n", __func__, ret);
+	cfg_chip3_base = DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG);
+	val = __raw_readl(cfg_chip3_base);
+	val |= BIT(3);
+	__raw_writel(val, cfg_chip3_base);
+
+	return ret;
+}
+
+static struct da8xx_pruss_can_data can_data = {
+	.version	= 1,
+};
+
 static struct da8xx_pruss_devices pruss_devices[] = {
-	{.dev_name = NULL,},
+	{
+		.dev_name	= "da8xx_pruss_can",
+		.pdata		= &can_data,
+		.pdata_size	= sizeof(can_data),
+		.setup		= da850_evm_setup_pruss_can,
+	},
+	{
+		.dev_name	= NULL,
+	},
 };
 
 static int __init da8xx_evm_setup_pruss(void)
Signature · 1 line
1.7.2.3
#9 lore raw

PATCH 5/9 da850: pruss CAN board specific additions.

Hello.

Quoted 4 lines · Subhasish Ghosh

This patch adds the pruss CAN pin mux and registers the device with the pruss mfd driver.

[...]

arch/arm/mach-davinci/board-da850-evm.c static __init int da850_evm_init_cpufreq(void) · line 1056

Quoted 9 lines
arch/arm/mach-davinci/board-da850-evm.c +1 -0
index 7938c6d..285545f 100644
@@ -1053,8 +1053,46 @@ static __init int da850_evm_init_cpufreq(void)
  static __init int da850_evm_init_cpufreq(void) { return 0; }
  #endif
 
+const short da850_pruss_can_pins[] = {
    Only da850_evm_pruss_can_pins[].

arch/arm/mach-davinci/board-da850-evm.c static __init int da850_evm_init_cpufreq(void) · line 1065

Quoted 9 lines
arch/arm/mach-davinci/board-da850-evm.c +9 -0
+	DA850_PRUSS_PRU0_R31_0, DA850_PRUSS_PRU1_R30_15,
+	DA850_PRUSS_PRU1_R31_18,
+	-1
+};
+
+static int __init da850_evm_setup_pruss_can(void)
+{
+	int ret, val = 0;
+	void __iomem *cfg_chip3_base;

CFGCHIP3 is a signle register, so it doesn't make sense to talk about its
base...

arch/arm/mach-davinci/board-da850-evm.c static __init int da850_evm_init_cpufreq(void) · line 1068

Quoted 2 lines
arch/arm/mach-davinci/board-da850-evm.c +2 -0
+	if (!machine_is_davinci_da850_evm())
+		return 0;

This check doesn't make sense as this function is not declared as
*_initcall(). It will only be called on this machine anyway.

Quoted 17 lines
arch/arm/mach-davinci/board-da850-evm.c +16 -0
+	ret = davinci_cfg_reg_list(da850_pruss_can_pins);
+	if (ret)
+		pr_warning("%s: da850_pruss_can_pins mux setup "
+					"failed:%d\n", __func__, ret);
+	cfg_chip3_base = DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG);
+	val = __raw_readl(cfg_chip3_base);
+	val |= BIT(3);
+	__raw_writel(val, cfg_chip3_base);
+
+	return ret;
+}
+
+static struct da8xx_pruss_can_data can_data = {
+	.version	= 1,
+};
+
  static struct da8xx_pruss_devices pruss_devices[] = {

arch/arm/mach-davinci/board-da850-evm.c static __init int da850_evm_init_cpufreq(void) · line 1095

Quoted 10 lines
arch/arm/mach-davinci/board-da850-evm.c +9 -1
-	{.dev_name = NULL,},
+	{
+		.dev_name	= "da8xx_pruss_can",
+		.pdata		= &can_data,
+		.pdata_size	= sizeof(can_data),
+		.setup		= da850_evm_setup_pruss_can,
+	},
+	{
+		.dev_name	= NULL,
+	},

Why you need a dummy lst element in this array?

WBR, Sergei

#10 lore raw

PATCH 6/9 da850: pruss CAN platform specific additions.

In reply to Subhasish Ghosh

This patch adds the necessary pins for the pruss CAN.

---
 arch/arm/mach-davinci/da850.c            |    4 ++++
 arch/arm/mach-davinci/include/mach/mux.h |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/da850.c +4 -0
index 341d836..11ce7ba 100644
@@ -565,6 +565,10 @@ static const struct mux_config da850_pins[] = {
 	MUX_CFG(DA850, EMA_CLK,		6,	0,	15,	1,	false)
 	MUX_CFG(DA850, EMA_WAIT_1,	6,	24,	15,	1,	false)
 	MUX_CFG(DA850, NEMA_CS_2,	7,	0,	15,	1,	false)
+	/* PRU functions for soft CAN */
+	MUX_CFG(DA850, PRUSS_PRU0_R31_0,	7,	28,	15,	0,	false)
+	MUX_CFG(DA850, PRUSS_PRU1_R30_15,	12,	0,	15,	4,	false)
+	MUX_CFG(DA850, PRUSS_PRU1_R31_18,	11,	20,	15,	0,	false)
 	/* GPIO function */
 	MUX_CFG(DA850, GPIO2_4,		6,	12,	15,	8,	false)
 	MUX_CFG(DA850, GPIO2_6,		6,	4,	15,	8,	false)
arch/arm/mach-davinci/include/mach/mux.h +4 -0
index 5d4e0fe..10f49f2 100644
@@ -906,6 +906,10 @@ enum davinci_da850_index {
 	DA850_EMA_CLK,
 	DA850_EMA_WAIT_1,
 	DA850_NEMA_CS_2,
+	/* PRU I/O */
+	DA850_PRUSS_PRU0_R31_0,
+	DA850_PRUSS_PRU1_R30_15,
+	DA850_PRUSS_PRU1_R31_18,
 
 	/* GPIO function */
 	DA850_GPIO2_4,
Signature · 1 line
1.7.2.3
#11 lore raw

PATCH 6/9 da850: pruss CAN platform specific additions.

Hello.

Quoted 3 lines · Subhasish Ghosh

This patch adds the necessary pins for the pruss CAN.

[...]

Quoted 20 lines
arch/arm/mach-davinci/da850.c +4 -0
index 341d836..11ce7ba 100644
@@ -565,6 +565,10 @@ static const struct mux_config da850_pins[] = {
  	MUX_CFG(DA850, EMA_CLK,		6,	0,	15,	1,	false)
  	MUX_CFG(DA850, EMA_WAIT_1,	6,	24,	15,	1,	false)
  	MUX_CFG(DA850, NEMA_CS_2,	7,	0,	15,	1,	false)
+	/* PRU functions for soft CAN */
+	MUX_CFG(DA850, PRUSS_PRU0_R31_0,	7,	28,	15,	0,	false)
+	MUX_CFG(DA850, PRUSS_PRU1_R30_15,	12,	0,	15,	4,	false)
+	MUX_CFG(DA850, PRUSS_PRU1_R31_18,	11,	20,	15,	0,	false)
  	/* GPIO function */
  	MUX_CFG(DA850, GPIO2_4,		6,	12,	15,	8,	false)
  	MUX_CFG(DA850, GPIO2_6,		6,	4,	15,	8,	false)
arch/arm/mach-davinci/include/mach/mux.h +0 -0
index 5d4e0fe..10f49f2 100644

arch/arm/mach-davinci/include/mach/mux.h enum davinci_da850_index { · line 912

Quoted 7 lines
arch/arm/mach-davinci/include/mach/mux.h +4 -0
@@ -906,6 +906,10 @@ enum davinci_da850_index {
  	DA850_EMA_CLK,
  	DA850_EMA_WAIT_1,
  	DA850_NEMA_CS_2,
+	/* PRU I/O */
+	DA850_PRUSS_PRU0_R31_0,
+	DA850_PRUSS_PRU1_R30_15,
+	DA850_PRUSS_PRU1_R31_18,

Again, this patch should precede the patch 5/9 due to PinMux dependencies.
I thought it must be pretty clear...

WBR, Sergei

#12 lore raw

PATCH 7/9 mfd: pruss CAN private data.

In reply to Subhasish Ghosh

This patch adds the PRUSS CAN data.

---
 include/linux/mfd/pruss/da8xx_pru.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
include/linux/mfd/pruss/da8xx_pru.h +4 -0
index 318dad8..2fa7ff5 100644
@@ -74,6 +74,10 @@ struct da8xx_pruss_devices {
 	int (*setup)(void);
 };
 
+struct da8xx_pruss_can_data {
+	u32 version;
+};
+
 u32 pruss_get_clk_freq(struct device *dev);
 
 u32 pruss_enable(struct device *dev, u8 pruss_num);
Signature · 1 line
1.7.2.3
#13 lore raw

PATCH 7/9 mfd: pruss CAN private data.

Hello.

Quoted 3 lines · Subhasish Ghosh

This patch adds the PRUSS CAN data.

[...]

include/linux/mfd/pruss/da8xx_pru.h struct da8xx_pruss_devices { · line 80

Quoted 12 lines
include/linux/mfd/pruss/da8xx_pru.h +4 -0
index 318dad8..2fa7ff5 100644
@@ -74,6 +74,10 @@ struct da8xx_pruss_devices {
  	int (*setup)(void);
  };
 
+struct da8xx_pruss_can_data {
+	u32 version;
+};
+

This patch too should precede the patch 5/9 as it defines the stucture
used there...

WBR, Sergei

#14 lore raw

PATCH 8/9 da850: pruss CAN board specific changes for gpios.

In reply to Subhasish Ghosh

This patch adds the GPIO modifications required for the pruss CAN.

---
 arch/arm/mach-davinci/board-da850-evm.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
arch/arm/mach-davinci/board-da850-evm.c +10 -1
index 285545f..737df73 100644
@@ -45,6 +45,7 @@
 
 #define DA850_MMCSD_CD_PIN		GPIO_TO_PIN(4, 0)
 #define DA850_MMCSD_WP_PIN		GPIO_TO_PIN(4, 1)
+#define DA850_PRUSS_CAN_TRX_PIN	GPIO_TO_PIN(2, 0)
 
 #define DA850_MII_MDIO_CLKEN_PIN	GPIO_TO_PIN(2, 6)
 
@@ -1055,7 +1056,7 @@ static __init int da850_evm_init_cpufreq(void) { return 0; }
 
 const short da850_pruss_can_pins[] = {
 	DA850_PRUSS_PRU0_R31_0, DA850_PRUSS_PRU1_R30_15,
-	DA850_PRUSS_PRU1_R31_18,
+	DA850_PRUSS_PRU1_R31_18, DA850_GPIO2_0,
 	-1
 };
 
@@ -1076,6 +1077,14 @@ static int __init da850_evm_setup_pruss_can(void)
 	val |= BIT(3);
 	__raw_writel(val, cfg_chip3_base);
 
+	/* value = 0 to enable the CAN transceiver */
+	ret = gpio_request_one(DA850_PRUSS_CAN_TRX_PIN,
+					GPIOF_OUT_INIT_LOW, "pruss_can_en");
+	if (ret) {
+		pr_warning("Cannot setup GPIO %d\n", DA850_PRUSS_CAN_TRX_PIN);
+		gpio_free(DA850_PRUSS_CAN_TRX_PIN);
+	}
+
 	return ret;
 }
 
Signature · 1 line
1.7.2.3
#15 lore raw

PATCH 8/9 da850: pruss CAN board specific changes for gpios.

Quoted 32 lines · Subhasish Ghosh

This patch adds the GPIO modifications required for the pruss CAN.

---
  arch/arm/mach-davinci/board-da850-evm.c |   11 ++++++++++-
  1 files changed, 10 insertions(+), 1 deletions(-)
arch/arm/mach-davinci/board-da850-evm.c +2 -1
index 285545f..737df73 100644
@@ -45,6 +45,7 @@
 
  #define DA850_MMCSD_CD_PIN		GPIO_TO_PIN(4, 0)
  #define DA850_MMCSD_WP_PIN		GPIO_TO_PIN(4, 1)
+#define DA850_PRUSS_CAN_TRX_PIN	GPIO_TO_PIN(2, 0)
 
  #define DA850_MII_MDIO_CLKEN_PIN	GPIO_TO_PIN(2, 6)
 
@@ -1055,7 +1056,7 @@ static __init int da850_evm_init_cpufreq(void) { return 0; }
 
  const short da850_pruss_can_pins[] = {
  	DA850_PRUSS_PRU0_R31_0, DA850_PRUSS_PRU1_R30_15,
-	DA850_PRUSS_PRU1_R31_18,
+	DA850_PRUSS_PRU1_R31_18, DA850_GPIO2_0,
  	-1
  };
 
@@ -1076,6 +1077,14 @@ static int __init da850_evm_setup_pruss_can(void)
  	val |= BIT(3);
  	__raw_writel(val, cfg_chip3_base);
 

arch/arm/mach-davinci/board-da850-evm.c static int __init da850_evm_setup_pruss_can(void) · line 1089

Quoted 10 lines
arch/arm/mach-davinci/board-da850-evm.c +8 -0
+	/* value = 0 to enable the CAN transceiver */
+	ret = gpio_request_one(DA850_PRUSS_CAN_TRX_PIN,
+					GPIOF_OUT_INIT_LOW, "pruss_can_en");
+	if (ret) {
+		pr_warning("Cannot setup GPIO %d\n", DA850_PRUSS_CAN_TRX_PIN);
+		gpio_free(DA850_PRUSS_CAN_TRX_PIN);
+	}
+
  	return ret;
  }

Should be mereged with patch 5/9, I think...

WBR, Sergei

#16 lore raw

PATCH 9/9 da850: pruss CAN platform specific changes for gpios.

In reply to Subhasish Ghosh

This patch adds the GPIOs for the pruss CAN device.

---
 arch/arm/mach-davinci/da850.c            |    1 +
 arch/arm/mach-davinci/include/mach/mux.h |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/da850.c +1 -0
index 11ce7ba..9382b4f 100644
@@ -570,6 +570,7 @@ static const struct mux_config da850_pins[] = {
 	MUX_CFG(DA850, PRUSS_PRU1_R30_15,	12,	0,	15,	4,	false)
 	MUX_CFG(DA850, PRUSS_PRU1_R31_18,	11,	20,	15,	0,	false)
 	/* GPIO function */
+	MUX_CFG(DA850, GPIO2_0,		6,	28,	15,	8,	false)
 	MUX_CFG(DA850, GPIO2_4,		6,	12,	15,	8,	false)
 	MUX_CFG(DA850, GPIO2_6,		6,	4,	15,	8,	false)
 	MUX_CFG(DA850, GPIO2_8,		5,	28,	15,	8,	false)
arch/arm/mach-davinci/include/mach/mux.h +1 -0
index 10f49f2..85b3a0d 100644
@@ -912,6 +912,7 @@ enum davinci_da850_index {
 	DA850_PRUSS_PRU1_R31_18,
 
 	/* GPIO function */
+	DA850_GPIO2_0,
 	DA850_GPIO2_4,
 	DA850_GPIO2_6,
 	DA850_GPIO2_8,
Signature · 1 line
1.7.2.3
#17 lore raw

PATCH 9/9 da850: pruss CAN platform specific changes for gpios.

Quoted 3 lines · Subhasish Ghosh

This patch adds the GPIOs for the pruss CAN device.

[...]

Quoted 17 lines
arch/arm/mach-davinci/da850.c +1 -0
index 11ce7ba..9382b4f 100644
@@ -570,6 +570,7 @@ static const struct mux_config da850_pins[] = {
  	MUX_CFG(DA850, PRUSS_PRU1_R30_15,	12,	0,	15,	4,	false)
  	MUX_CFG(DA850, PRUSS_PRU1_R31_18,	11,	20,	15,	0,	false)
  	/* GPIO function */
+	MUX_CFG(DA850, GPIO2_0,		6,	28,	15,	8,	false)
  	MUX_CFG(DA850, GPIO2_4,		6,	12,	15,	8,	false)
  	MUX_CFG(DA850, GPIO2_6,		6,	4,	15,	8,	false)
  	MUX_CFG(DA850, GPIO2_8,		5,	28,	15,	8,	false)
arch/arm/mach-davinci/include/mach/mux.h +0 -0
index 10f49f2..85b3a0d 100644

arch/arm/mach-davinci/include/mach/mux.h enum davinci_da850_index { · line 918

Quoted 7 lines
arch/arm/mach-davinci/include/mach/mux.h +1 -0
@@ -912,6 +912,7 @@ enum davinci_da850_index {
  	DA850_PRUSS_PRU1_R31_18,
 
  	/* GPIO function */
+	DA850_GPIO2_0,
  	DA850_GPIO2_4,
  	DA850_GPIO2_6,
  	DA850_GPIO2_8,

Should again precede the previous patch. I thought that must be obvious...

WBR, Sergei

#18 lore raw

cover pruss mfd drivers

In reply to Subhasish Ghosh
Quoted 6 lines · Subhasish Ghosh
 arch/arm/mach-davinci/board-da850-evm.c     |   75 ++
 arch/arm/mach-davinci/da850.c               |   12 +
 arch/arm/mach-davinci/devices-da8xx.c       |   65 ++
 arch/arm/mach-davinci/include/mach/da8xx.h  |    2 +
 arch/arm/mach-davinci/include/mach/mux.h    |    5 +
 drivers/mfd/Kconfig                         |   10 +
Quoted 8 lines
 drivers/mfd/Makefile                        |    1 +
 drivers/mfd/da8xx_pru.c                     |  403 +++++++++
 drivers/net/can/Kconfig                     |    1 +
 drivers/net/can/Makefile                    |    1 +
 drivers/net/can/da8xx_pruss/Kconfig         |   73 ++
 drivers/net/can/da8xx_pruss/Makefile        |    7 +
 drivers/net/can/da8xx_pruss/pruss_can.c     |  759 +++++++++++++++++
 drivers/net/can/da8xx_pruss/pruss_can_api.c | 1224 

The MFD and netdev lists need to be copied on this submission as this cannot be merged without an ack from the maintainers of those subsystems.

To automate copying the right folks on each patch, please use:

git-send-email --to <davinci list> --cc-cmd=scripts/get_maintainer.pl [...]

Thanks,
Sekhar

#19 lore raw

cover pruss mfd drivers

Quoted 3 lines · Sekhar

To automate copying the right folks on each patch, please use:

git-send-email --to <davinci list> --cc-cmd=scripts/get_maintainer.pl [...]

Please don't use get_maintainer.pl directly like this - you need to apply some thought and consideration to the results as it generates both false positives and false negatives.

#20 lore raw

cover pruss mfd drivers

Quoted 9 lines · Mark Brown
Quoted 3 lines · Sekhar

To automate copying the right folks on each patch, please use:

git-send-email --to <davinci list> --cc-cmd=scripts/get_maintainer.pl [...]

Please don't use get_maintainer.pl directly like this - you need to apply some thought and consideration to the results as it generates both false positives and false negatives.

Point taken. I usually do a --dry-run before actually sending just to verify the results.

Thanks,
Sekhar