Skip to contentSkip to conversation

OMAP2 MCSPI Use resources

PATCH In review Komal Shah 1 participant 2 messages Feb 22, 2006

Subsystems (4)
lore
Share & tools
lore

Komal Shah

author
#0 lore raw

PATCH 1/1 OMAP2 MCSPI Use resources

Juha,

Attached patch uses the resources instead of passing base address from pdata, also removed MASTER_CDATA macro and uses spi_get_master_drvdata api instead.

I am able to build the tree, but not able to test it as I don't have TSC2101 protocol driver ready. So, if you can test it with your protocol drivers then let me know.

---Komal Shah
http://komalshah.blogspot.com/

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

arch/arm/mach-omap2/devices.c +77 -0
index def9e53..7028a04 100644
@@ -115,6 +115,82 @@ static inline void omap_init_sti(void)
 static inline void omap_init_sti(void) {}
 #endif
 
+#if 	defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
+
+#include <asm/arch/mcspi.h>
+
+#define OMAP2_MCSPI_BASE1		IO_ADDRESS(0x48098000)
+#define OMAP2_MCSPI_INT1		65
+
+#define OMAP2_MCSPI_BASE2		IO_ADDRESS(0x4809A000)
+#define OMAP2_MCSPI_INT2		66
+
+static struct omap2_mcspi_platform_config omap2_mcspi1_config = {
+	.num_cs         = 4,
+};    
+
+static struct resource omap_mcspi_resources1[] = {
+	{
+		.start		= OMAP2_MCSPI_BASE1,
+		.end		= OMAP2_MCSPI_BASE1 + 0x3f,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= OMAP2_MCSPI_INT1,
+		.flags		= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device omap_mcspi_device1 = {
+	.name		= "omap2_mcspi",
+	.id		= 1,
+	.dev = {
+		.release	= omap_nop_release,
+		.platform_data  = &omap2_mcspi1_config,
+	},
+	.num_resources	= ARRAY_SIZE(omap_mcspi_resources1),
+	.resource	= omap_mcspi_resources1,
+};
+
+static struct omap2_mcspi_platform_config omap2_mcspi2_config = {
+	.num_cs         = 2,
+};    
+
+static struct resource omap_mcspi_resources2[] = {
+	{
+		.start		= OMAP2_MCSPI_BASE2,
+		.end		= OMAP2_MCSPI_BASE2 + 0x3f,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= OMAP2_MCSPI_INT2,
+		.flags		= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device omap_mcspi_device2 = {
+	.name		= "omap2_mcspi",
+	.id		= 2,
+	.dev = {
+		.release	= omap_nop_release,
+		.platform_data  = &omap2_mcspi2_config,
+	},
+	.num_resources	= ARRAY_SIZE(omap_mcspi_resources2),
+	.resource	= omap_mcspi_resources2,
+};
+
+static void omap_init_mcspi(void)
+{
+	(void) platform_device_register(&omap_mcspi_device1);
+	(void) platform_device_register(&omap_mcspi_device2);
+}
+
+#else
+
+static void omap_init_mcspi(void) {}
+
+#endif
+
 /*-------------------------------------------------------------------------*/
 
 static int __init omap2_init_devices(void)
@@ -123,6 +199,7 @@ static int __init omap2_init_devices(voi
 	 * in alphabetical order so they're easier to sort through.
 	 */
 	omap_init_i2c();
+	omap_init_mcspi();
 	omap_init_sti();
 
 	return 0;
drivers/spi/omap2_mcspi.c +50 -23

176 lines not on this page · raw message

author
#1 lore raw
Quoted 8 lines · --- Komal Shah

Juha,

Attached patch uses the resources instead of passing base address from
pdata, also removed MASTER_CDATA macro and uses spi_get_master_drvdata
api instead.

Quoted 4 lines

I am able to build the tree, but not able to test it as I don't have TSC2101 protocol driver ready. So, if you can test it with your protocol drivers then let me know.

Also let me know why you are exporting omap2_mcspi_driver and instead of class_device_put we can use spi_master_put and spi_master_get instead of class_device_get. If you confirm this third patch will in-corporate review comments from you :)

---

Attached the updated patch with clocks support.

---Komal Shah
http://komalshah.blogspot.com/

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

arch/arm/mach-omap2/devices.c +77 -0
index def9e53..7028a04 100644
@@ -115,6 +115,82 @@ static inline void omap_init_sti(void)
 static inline void omap_init_sti(void) {}
 #endif
 
+#if 	defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
+
+#include <asm/arch/mcspi.h>
+
+#define OMAP2_MCSPI_BASE1		IO_ADDRESS(0x48098000)
+#define OMAP2_MCSPI_INT1		65
+
+#define OMAP2_MCSPI_BASE2		IO_ADDRESS(0x4809A000)
+#define OMAP2_MCSPI_INT2		66
+
+static struct omap2_mcspi_platform_config omap2_mcspi1_config = {
+	.num_cs         = 4,
+};    
+
+static struct resource omap_mcspi_resources1[] = {
+	{
+		.start		= OMAP2_MCSPI_BASE1,
+		.end		= OMAP2_MCSPI_BASE1 + 0x3f,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= OMAP2_MCSPI_INT1,
+		.flags		= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device omap_mcspi_device1 = {
+	.name		= "omap2_mcspi",
+	.id		= 1,
+	.dev = {
+		.release	= omap_nop_release,
+		.platform_data  = &omap2_mcspi1_config,
+	},
+	.num_resources	= ARRAY_SIZE(omap_mcspi_resources1),
+	.resource	= omap_mcspi_resources1,
+};
+
+static struct omap2_mcspi_platform_config omap2_mcspi2_config = {
+	.num_cs         = 2,
+};    
+
+static struct resource omap_mcspi_resources2[] = {
+	{
+		.start		= OMAP2_MCSPI_BASE2,
+		.end		= OMAP2_MCSPI_BASE2 + 0x3f,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= OMAP2_MCSPI_INT2,
+		.flags		= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device omap_mcspi_device2 = {
+	.name		= "omap2_mcspi",
+	.id		= 2,
+	.dev = {
+		.release	= omap_nop_release,
+		.platform_data  = &omap2_mcspi2_config,
+	},
+	.num_resources	= ARRAY_SIZE(omap_mcspi_resources2),
+	.resource	= omap_mcspi_resources2,
+};
+
+static void omap_init_mcspi(void)
+{
+	(void) platform_device_register(&omap_mcspi_device1);
+	(void) platform_device_register(&omap_mcspi_device2);
+}
+
+#else
+
+static void omap_init_mcspi(void) {}
+
+#endif
+
 /*-------------------------------------------------------------------------*/
 
 static int __init omap2_init_devices(void)
@@ -123,6 +199,7 @@ static int __init omap2_init_devices(voi
 	 * in alphabetical order so they're easier to sort through.
 	 */
 	omap_init_i2c();
+	omap_init_mcspi();
 	omap_init_sti();
 
 	return 0;
drivers/spi/omap2_mcspi.c +105 -25

239 lines not on this page · raw message