* [PATCH 1/4] davinci: da8xx/omap-l1: add support for SPI
2011-02-01 0:05 [PATCH 0/4] davinci: Add SPI support for da8xx platforms Michael Williamson
@ 2011-02-01 0:05 ` Michael Williamson
2011-02-01 11:44 ` Sergei Shtylyov
2011-02-01 0:05 ` [PATCH 2/4] davinci: add spi devices support for MityDSP-L138/MityARM-1808 platform Michael Williamson
` (2 subsequent siblings)
3 siblings, 1 reply; 14+ messages in thread
From: Michael Williamson @ 2011-02-01 0:05 UTC (permalink / raw)
To: linux-arm-kernel
Add SPI registration routines, clocks, and driver resources for
DA850/OMAP-L138/AM18x and DA830/OMAP-L137/AM17x platforms.
Signed-off-by: Michael Williamson <michael.williamson@criticallink.com>
---
arch/arm/mach-davinci/da850.c | 16 +++++
arch/arm/mach-davinci/devices-da8xx.c | 88 ++++++++++++++++++++++++++++
arch/arm/mach-davinci/include/mach/da8xx.h | 2 +
3 files changed, 106 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 3443d97..68fe4c2 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -359,6 +359,20 @@ static struct clk usb20_clk = {
.gpsc = 1,
};
+static struct clk spi0_clk = {
+ .name = "spi0",
+ .parent = &pll0_sysclk2,
+ .lpsc = DA8XX_LPSC0_SPI0,
+};
+
+static struct clk spi1_clk = {
+ .name = "spi1",
+ .parent = &pll0_sysclk2,
+ .lpsc = DA8XX_LPSC1_SPI1,
+ .gpsc = 1,
+ .flags = DA850_CLK_ASYNC3,
+};
+
static struct clk_lookup da850_clks[] = {
CLK(NULL, "ref", &ref_clk),
CLK(NULL, "pll0", &pll0_clk),
@@ -403,6 +417,8 @@ static struct clk_lookup da850_clks[] = {
CLK(NULL, "aemif", &aemif_clk),
CLK(NULL, "usb11", &usb11_clk),
CLK(NULL, "usb20", &usb20_clk),
+ CLK("spi_davinci.0", NULL, &spi0_clk),
+ CLK("spi_davinci.1", NULL, &spi1_clk),
CLK(NULL, NULL, NULL),
};
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index beda8a4..5f8ff96 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -725,3 +725,91 @@ int __init da8xx_register_cpuidle(void)
return platform_device_register(&da8xx_cpuidle_device);
}
+
+static struct resource da8xx_spi0_resources[] = {
+ [0] = {
+ .start = 0x01c41000,
+ .end = 0x01c41fff,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_DA8XX_SPINT0,
+ .start = IRQ_DA8XX_SPINT0,
+ .flags = IORESOURCE_IRQ,
+ },
+ [2] = {
+ .start = EDMA_CTLR_CHAN(0, 14),
+ .end = EDMA_CTLR_CHAN(0, 14),
+ .flags = IORESOURCE_DMA,
+ },
+ [3] = {
+ .start = EDMA_CTLR_CHAN(0, 15),
+ .end = EDMA_CTLR_CHAN(0, 15),
+ .flags = IORESOURCE_DMA,
+ },
+ [4] = {
+ .start = 0,
+ .end = 0,
+ .flags = IORESOURCE_DMA,
+ },
+};
+
+static struct resource da8xx_spi1_resources[] = {
+ [0] = {
+ .start = 0x01f0e000,
+ .end = 0x01f0efff,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_DA8XX_SPINT1,
+ .start = IRQ_DA8XX_SPINT1,
+ .flags = IORESOURCE_IRQ,
+ },
+ [2] = {
+ .start = EDMA_CTLR_CHAN(0, 18),
+ .end = EDMA_CTLR_CHAN(0, 18),
+ .flags = IORESOURCE_DMA,
+ },
+ [3] = {
+ .start = EDMA_CTLR_CHAN(0, 19),
+ .end = EDMA_CTLR_CHAN(0, 19),
+ .flags = IORESOURCE_DMA,
+ },
+ [4] = {
+ .start = 0,
+ .end = 0,
+ .flags = IORESOURCE_DMA,
+ },
+};
+
+static struct platform_device da8xx_spi_device[] = {
+ [0] = {
+ .name = "spi_davinci",
+ .id = 0,
+ .num_resources = ARRAY_SIZE(da8xx_spi0_resources),
+ .resource = da8xx_spi0_resources,
+ },
+ [1] = {
+ .name = "spi_davinci",
+ .id = 1,
+ .num_resources = ARRAY_SIZE(da8xx_spi1_resources),
+ .resource = da8xx_spi1_resources,
+ },
+};
+
+int __init da8xx_register_spi(int instance,
+ struct davinci_spi_platform_data *pdata)
+{
+ struct platform_device *pdev;
+
+ if (instance == 0)
+ pdev = &da8xx_spi_device[0];
+ else if (instance == 1)
+ pdev = &da8xx_spi_device[1];
+ else
+ return -EINVAL;
+
+ pdev->dev.platform_data = pdata;
+
+ return platform_device_register(pdev);
+}
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index cfcb223..1f4cf5f 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -23,6 +23,7 @@
#include <mach/mmc.h>
#include <mach/usb.h>
#include <mach/pm.h>
+#include <mach/spi.h>
extern void __iomem *da8xx_syscfg0_base;
extern void __iomem *da8xx_syscfg1_base;
@@ -77,6 +78,7 @@ void __init da850_init(void);
int da830_register_edma(struct edma_rsv_info *rsv);
int da850_register_edma(struct edma_rsv_info *rsv[2]);
int da8xx_register_i2c(int instance, struct davinci_i2c_platform_data *pdata);
+int da8xx_register_spi(int instance, struct davinci_spi_platform_data *pdata);
int da8xx_register_watchdog(void);
int da8xx_register_usb20(unsigned mA, unsigned potpgt);
int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 1/4] davinci: da8xx/omap-l1: add support for SPI
2011-02-01 0:05 ` [PATCH 1/4] davinci: da8xx/omap-l1: add support for SPI Michael Williamson
@ 2011-02-01 11:44 ` Sergei Shtylyov
2011-02-01 12:26 ` Michael Williamson
0 siblings, 1 reply; 14+ messages in thread
From: Sergei Shtylyov @ 2011-02-01 11:44 UTC (permalink / raw)
To: linux-arm-kernel
Hello.
On 01-02-2011 3:05, Michael Williamson wrote:
> Add SPI registration routines, clocks, and driver resources for
> DA850/OMAP-L138/AM18x and DA830/OMAP-L137/AM17x platforms.
> Signed-off-by: Michael Williamson<michael.williamson@criticallink.com>
[...]
> diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
> index beda8a4..5f8ff96 100644
> --- a/arch/arm/mach-davinci/devices-da8xx.c
> +++ b/arch/arm/mach-davinci/devices-da8xx.c
> @@ -725,3 +725,91 @@ int __init da8xx_register_cpuidle(void)
>
> return platform_device_register(&da8xx_cpuidle_device);
> }
> +
> +static struct resource da8xx_spi0_resources[] = {
> + [0] = {
> + .start = 0x01c41000,
> + .end = 0x01c41fff,
> + .flags = IORESOURCE_MEM,
> + },
> + [1] = {
> + .start = IRQ_DA8XX_SPINT0,
> + .start = IRQ_DA8XX_SPINT0,
You mean '.end'?
> + .flags = IORESOURCE_IRQ,
> + },
> + [2] = {
> + .start = EDMA_CTLR_CHAN(0, 14),
> + .end = EDMA_CTLR_CHAN(0, 14),
Could you align = uniformly with resource 0 -- preferably with a tab?
> + .flags = IORESOURCE_DMA,
> + },
> + [3] = {
> + .start = EDMA_CTLR_CHAN(0, 15),
> + .end = EDMA_CTLR_CHAN(0, 15),
Same here.
> + .flags = IORESOURCE_DMA,
> + },
> + [4] = {
> + .start = 0,
> + .end = 0,
There's no need to init to 0.
> + .flags = IORESOURCE_DMA,
> + },
> +};
> +
> +static struct resource da8xx_spi1_resources[] = {
> + [0] = {
> + .start = 0x01f0e000,
> + .end = 0x01f0efff,
> + .flags = IORESOURCE_MEM,
> + },
> + [1] = {
> + .start = IRQ_DA8XX_SPINT1,
> + .start = IRQ_DA8XX_SPINT1,
You meand '.end'?
> + .flags = IORESOURCE_IRQ,
> + },
> + [2] = {
> + .start = EDMA_CTLR_CHAN(0, 18),
> + .end = EDMA_CTLR_CHAN(0, 18),
Could you align = uniformly with resource 0 -- preferably with a tab?
> + .flags = IORESOURCE_DMA,
> + },
> + [3] = {
> + .start = EDMA_CTLR_CHAN(0, 19),
> + .end = EDMA_CTLR_CHAN(0, 19),
Same here.
> + .flags = IORESOURCE_DMA,
> + },
> + [4] = {
> + .start = 0,
> + .end = 0,
There's no need to init to 0.
> + .flags = IORESOURCE_DMA,
> + },
> +};
> +
> +static struct platform_device da8xx_spi_device[] = {
> + [0] = {
> + .name = "spi_davinci",
> + .id = 0,
> + .num_resources = ARRAY_SIZE(da8xx_spi0_resources),
> + .resource = da8xx_spi0_resources,
> + },
> + [1] = {
> + .name = "spi_davinci",
> + .id = 1,
> + .num_resources = ARRAY_SIZE(da8xx_spi1_resources),
> + .resource = da8xx_spi1_resources,
> + },
> +};
> +
> +int __init da8xx_register_spi(int instance,
> + struct davinci_spi_platform_data *pdata)
> +{
> + struct platform_device *pdev;
> +
> + if (instance == 0)
> + pdev =&da8xx_spi_device[0];
> + else if (instance == 1)
> + pdev =&da8xx_spi_device[1];
Why not:
if (instance == 0 || instance == 1)
pdev = &da8xx_spi_device[instance];
> + else
> + return -EINVAL;
> +
> + pdev->dev.platform_data = pdata;
> +
> + return platform_device_register(pdev);
> +}
WBR, Sergei
^ permalink raw reply [flat|nested] 14+ messages in thread* [PATCH 1/4] davinci: da8xx/omap-l1: add support for SPI
2011-02-01 11:44 ` Sergei Shtylyov
@ 2011-02-01 12:26 ` Michael Williamson
0 siblings, 0 replies; 14+ messages in thread
From: Michael Williamson @ 2011-02-01 12:26 UTC (permalink / raw)
To: linux-arm-kernel
Hi Sergei,
On 2/1/2011 6:44 AM, Sergei Shtylyov wrote:
> Hello.
>
> On 01-02-2011 3:05, Michael Williamson wrote:
>
>> Add SPI registration routines, clocks, and driver resources for
>> DA850/OMAP-L138/AM18x and DA830/OMAP-L137/AM17x platforms.
>
>> Signed-off-by: Michael Williamson<michael.williamson@criticallink.com>
> [...]
>
>> diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
>> index beda8a4..5f8ff96 100644
>> --- a/arch/arm/mach-davinci/devices-da8xx.c
>> +++ b/arch/arm/mach-davinci/devices-da8xx.c
>> @@ -725,3 +725,91 @@ int __init da8xx_register_cpuidle(void)
>>
>> return platform_device_register(&da8xx_cpuidle_device);
>> }
>> +
>> +static struct resource da8xx_spi0_resources[] = {
>> + [0] = {
>> + .start = 0x01c41000,
>> + .end = 0x01c41fff,
>> + .flags = IORESOURCE_MEM,
>> + },
>> + [1] = {
>> + .start = IRQ_DA8XX_SPINT0,
>> + .start = IRQ_DA8XX_SPINT0,
>
> You mean '.end'?
>
Yes. I will correct.
>> + .flags = IORESOURCE_IRQ,
>> + },
>> + [2] = {
>> + .start = EDMA_CTLR_CHAN(0, 14),
>> + .end = EDMA_CTLR_CHAN(0, 14),
>
> Could you align = uniformly with resource 0 -- preferably with a tab?
>
Sure.
>> + .flags = IORESOURCE_DMA,
>> + },
>> + [3] = {
>> + .start = EDMA_CTLR_CHAN(0, 15),
>> + .end = EDMA_CTLR_CHAN(0, 15),
>
> Same here.
>
>> + .flags = IORESOURCE_DMA,
>> + },
>> + [4] = {
>> + .start = 0,
>> + .end = 0,
>
> There's no need to init to 0.
>
OK.
>> + .flags = IORESOURCE_DMA,
>> + },
>> +};
>> +
>> +static struct resource da8xx_spi1_resources[] = {
>> + [0] = {
>> + .start = 0x01f0e000,
>> + .end = 0x01f0efff,
>> + .flags = IORESOURCE_MEM,
>> + },
>> + [1] = {
>> + .start = IRQ_DA8XX_SPINT1,
>> + .start = IRQ_DA8XX_SPINT1,
>
> You meand '.end'?
>
I did, but I see that .end is not used by platform_get_irq(), only .start.
[wondering why testing didn't catch this, and why no compiler warnings on
double assignment]. I will correct. Thanks.
>> + .flags = IORESOURCE_IRQ,
>> + },
>> + [2] = {
>> + .start = EDMA_CTLR_CHAN(0, 18),
>> + .end = EDMA_CTLR_CHAN(0, 18),
>
> Could you align = uniformly with resource 0 -- preferably with a tab?
>
Sure.
>> + .flags = IORESOURCE_DMA,
>> + },
>> + [3] = {
>> + .start = EDMA_CTLR_CHAN(0, 19),
>> + .end = EDMA_CTLR_CHAN(0, 19),
>
> Same here.
>
Got it.
>> + .flags = IORESOURCE_DMA,
>> + },
>> + [4] = {
>> + .start = 0,
>> + .end = 0,
>
> There's no need to init to 0.
>
OK.
>> + .flags = IORESOURCE_DMA,
>> + },
>> +};
>> +
>> +static struct platform_device da8xx_spi_device[] = {
>> + [0] = {
>> + .name = "spi_davinci",
>> + .id = 0,
>> + .num_resources = ARRAY_SIZE(da8xx_spi0_resources),
>> + .resource = da8xx_spi0_resources,
>> + },
>> + [1] = {
>> + .name = "spi_davinci",
>> + .id = 1,
>> + .num_resources = ARRAY_SIZE(da8xx_spi1_resources),
>> + .resource = da8xx_spi1_resources,
>> + },
>> +};
>> +
>> +int __init da8xx_register_spi(int instance,
>> + struct davinci_spi_platform_data *pdata)
>> +{
>> + struct platform_device *pdev;
>> +
>> + if (instance == 0)
>> + pdev =&da8xx_spi_device[0];
>> + else if (instance == 1)
>> + pdev =&da8xx_spi_device[1];
>
> Why not:
>
> if (instance == 0 || instance == 1)
> pdev = &da8xx_spi_device[instance];
>
OK.
>> + else
>> + return -EINVAL;
>> +
>> + pdev->dev.platform_data = pdata;
>> +
>> + return platform_device_register(pdev);
>> +}
>
> WBR, Sergei
Thanks for the review Sergei.
-Mike
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/4] davinci: add spi devices support for MityDSP-L138/MityARM-1808 platform
2011-02-01 0:05 [PATCH 0/4] davinci: Add SPI support for da8xx platforms Michael Williamson
2011-02-01 0:05 ` [PATCH 1/4] davinci: da8xx/omap-l1: add support for SPI Michael Williamson
@ 2011-02-01 0:05 ` Michael Williamson
2011-02-01 12:21 ` Nori, Sekhar
2011-02-01 0:05 ` [PATCH 3/4] davinci: add spi devices support for da850/omap-l138/am18x evm Michael Williamson
2011-02-01 0:05 ` [PATCH 4/4] davinci: add spi devices support for da830/omap-l137/am17x evm Michael Williamson
3 siblings, 1 reply; 14+ messages in thread
From: Michael Williamson @ 2011-02-01 0:05 UTC (permalink / raw)
To: linux-arm-kernel
This patch adds support for accessing the on board SPI NOR FLASH
device for MityDSP-L138 and MityARM-1808 SoMs.
Signed-off-by: Michael Williamson <michael.williamson@criticallink.com>
Tested-by: Michael Williamson <michael.williamson@criticallink.com>
---
arch/arm/mach-davinci/board-mityomapl138.c | 104 ++++++++++++++++++++++++++++
1 files changed, 104 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c
index 0ea5932..9dd88d7 100644
--- a/arch/arm/mach-davinci/board-mityomapl138.c
+++ b/arch/arm/mach-davinci/board-mityomapl138.c
@@ -17,6 +17,8 @@
#include <linux/i2c.h>
#include <linux/i2c/at24.h>
#include <linux/etherdevice.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/flash.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
@@ -25,6 +27,7 @@
#include <mach/da8xx.h>
#include <mach/nand.h>
#include <mach/mux.h>
+#include <mach/spi.h>
#define MITYOMAPL138_PHY_ID "0:03"
@@ -294,6 +297,104 @@ static int __init pmic_tps65023_init(void)
}
/*
+ * SPI Devices:
+ * SPI1_CS0: 8M Flash ST-M25P64-VME6G
+ */
+static struct mtd_partition spi_flash_partitions[] = {
+ [0] = {
+ .name = "ubl",
+ .offset = 0,
+ .size = SZ_64K,
+ .mask_flags = MTD_WRITEABLE,
+ },
+ [1] = {
+ .name = "u-boot",
+ .offset = MTDPART_OFS_APPEND,
+ .size = SZ_512K,
+ .mask_flags = MTD_WRITEABLE,
+ },
+ [2] = {
+ .name = "u-boot-env",
+ .offset = MTDPART_OFS_APPEND,
+ .size = SZ_64K,
+ .mask_flags = MTD_WRITEABLE,
+ },
+ [3] = {
+ .name = "periph-config",
+ .offset = MTDPART_OFS_APPEND,
+ .size = SZ_64K,
+ .mask_flags = MTD_WRITEABLE,
+ },
+ [4] = {
+ .name = "reserved",
+ .offset = MTDPART_OFS_APPEND,
+ .size = SZ_256K + SZ_64K,
+ },
+ [5] = {
+ .name = "kernel",
+ .offset = MTDPART_OFS_APPEND,
+ .size = SZ_2M + SZ_1M,
+ },
+ [6] = {
+ .name = "fpga",
+ .offset = MTDPART_OFS_APPEND,
+ .size = SZ_2M,
+ },
+ [7] = {
+ .name = "spare",
+ .offset = MTDPART_OFS_APPEND,
+ .size = MTDPART_SIZ_FULL,
+ },
+};
+
+static struct flash_platform_data mityomapl138_spi_flash_data = {
+ .name = "m25p80",
+ .parts = spi_flash_partitions,
+ .nr_parts = ARRAY_SIZE(spi_flash_partitions),
+ .type = "m24p64",
+};
+
+static struct davinci_spi_config spi_eprom_config = {
+ .io_type = SPI_IO_TYPE_DMA,
+ .c2tdelay = 8,
+ .t2cdelay = 8,
+};
+
+static struct spi_board_info mityomapl138_spi_flash_info[] = {
+ {
+ .modalias = "m25p80",
+ .platform_data = &mityomapl138_spi_flash_data,
+ .controller_data = &spi_eprom_config,
+ .mode = SPI_MODE_0,
+ .max_speed_hz = 30000000,
+ .bus_num = 1,
+ .chip_select = 0,
+ },
+};
+
+static struct davinci_spi_platform_data mityomapl138_spi1_pdata = {
+ .version = SPI_VERSION_2,
+ .num_chipselect = 1,
+ .intr_line = 1,
+};
+
+static void __init mityomapl138_init_spi1(struct spi_board_info *info,
+ unsigned len)
+{
+ int ret;
+
+ ret = spi_register_board_info(info, len);
+ if (ret)
+ pr_warning("%s: failed to register board info : %d\n",
+ __func__, ret);
+
+ ret = da8xx_register_spi(1, &mityomapl138_spi1_pdata);
+ if (ret)
+ pr_warning("%s: failed to register spi 1 device : %d\n",
+ __func__, ret);
+}
+
+/*
* MityDSP-L138 includes a 256 MByte large-page NAND flash
* (128K blocks).
*/
@@ -448,6 +549,9 @@ static void __init mityomapl138_init(void)
mityomapl138_setup_nand();
+ mityomapl138_init_spi1(mityomapl138_spi_flash_info,
+ ARRAY_SIZE(mityomapl138_spi_flash_info));
+
mityomapl138_config_emac();
ret = da8xx_register_rtc();
--
1.7.0.4
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 2/4] davinci: add spi devices support for MityDSP-L138/MityARM-1808 platform
2011-02-01 0:05 ` [PATCH 2/4] davinci: add spi devices support for MityDSP-L138/MityARM-1808 platform Michael Williamson
@ 2011-02-01 12:21 ` Nori, Sekhar
2011-02-01 12:33 ` Michael Williamson
0 siblings, 1 reply; 14+ messages in thread
From: Nori, Sekhar @ 2011-02-01 12:21 UTC (permalink / raw)
To: linux-arm-kernel
Hi Mike,
On Tue, Feb 01, 2011 at 05:35:14, Michael Williamson wrote:
> This patch adds support for accessing the on board SPI NOR FLASH
> device for MityDSP-L138 and MityARM-1808 SoMs.
>
> Signed-off-by: Michael Williamson <michael.williamson@criticallink.com>
> Tested-by: Michael Williamson <michael.williamson@criticallink.com>
> ---
> arch/arm/mach-davinci/board-mityomapl138.c | 104 ++++++++++++++++++++++++++++
> 1 files changed, 104 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c
> +
> +static struct davinci_spi_platform_data mityomapl138_spi1_pdata = {
> + .version = SPI_VERSION_2,
> + .num_chipselect = 1,
> + .intr_line = 1,
> +};
This platform data is better placed in devices-da8xx.c as most of
it is common across all DA8xx platforms. Only num_chipselect and
chip_sel array are expected to be board specific so only those should
be passed on from board files.
Thanks,
Sekhar
^ permalink raw reply [flat|nested] 14+ messages in thread* [PATCH 2/4] davinci: add spi devices support for MityDSP-L138/MityARM-1808 platform
2011-02-01 12:21 ` Nori, Sekhar
@ 2011-02-01 12:33 ` Michael Williamson
0 siblings, 0 replies; 14+ messages in thread
From: Michael Williamson @ 2011-02-01 12:33 UTC (permalink / raw)
To: linux-arm-kernel
Hi Sekhar,
On 2/1/2011 7:21 AM, Nori, Sekhar wrote:
> Hi Mike,
>
> On Tue, Feb 01, 2011 at 05:35:14, Michael Williamson wrote:
>> This patch adds support for accessing the on board SPI NOR FLASH
>> device for MityDSP-L138 and MityARM-1808 SoMs.
>>
>> Signed-off-by: Michael Williamson <michael.williamson@criticallink.com>
>> Tested-by: Michael Williamson <michael.williamson@criticallink.com>
>> ---
>> arch/arm/mach-davinci/board-mityomapl138.c | 104 ++++++++++++++++++++++++++++
>> 1 files changed, 104 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c
>
>
>> +
>> +static struct davinci_spi_platform_data mityomapl138_spi1_pdata = {
>> + .version = SPI_VERSION_2,
>> + .num_chipselect = 1,
>> + .intr_line = 1,
>> +};
>
> This platform data is better placed in devices-da8xx.c as most of
> it is common across all DA8xx platforms. Only num_chipselect and
> chip_sel array are expected to be board specific so only those should
> be passed on from board files.
>
> Thanks,
> Sekhar
I will move this to devices-da8xx.c and create a placeholder for spi0.
Thanks.
-Mike
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 3/4] davinci: add spi devices support for da850/omap-l138/am18x evm
2011-02-01 0:05 [PATCH 0/4] davinci: Add SPI support for da8xx platforms Michael Williamson
2011-02-01 0:05 ` [PATCH 1/4] davinci: da8xx/omap-l1: add support for SPI Michael Williamson
2011-02-01 0:05 ` [PATCH 2/4] davinci: add spi devices support for MityDSP-L138/MityARM-1808 platform Michael Williamson
@ 2011-02-01 0:05 ` Michael Williamson
2011-02-01 11:54 ` Sergei Shtylyov
2011-02-01 0:05 ` [PATCH 4/4] davinci: add spi devices support for da830/omap-l137/am17x evm Michael Williamson
3 siblings, 1 reply; 14+ messages in thread
From: Michael Williamson @ 2011-02-01 0:05 UTC (permalink / raw)
To: linux-arm-kernel
From: Sekhar Nori <nsekhar@ti.com>
This patch adds the on-board SPI flash device to the
DA850/OMAP-L138/AM18x EVM. It also registers the SPI flash
device to the MTD subsystem.
Based on SPI flash device support for MityDSP-L138F platform.
Signed-off-by: Michael Williamson <michael.williamson@criticallink.com>
---
arch/arm/mach-davinci/board-da850-evm.c | 88 +++++++++++++++++++++++++++++++
1 files changed, 88 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 11f986b..6eb6cf2 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -29,6 +29,8 @@
#include <linux/regulator/machine.h>
#include <linux/regulator/tps6507x.h>
#include <linux/input/tps6507x-ts.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/flash.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
@@ -38,6 +40,7 @@
#include <mach/nand.h>
#include <mach/mux.h>
#include <mach/aemif.h>
+#include <mach/spi.h>
#define DA850_EVM_PHY_ID "0:00"
#define DA850_LCD_PWR_PIN GPIO_TO_PIN(2, 8)
@@ -48,6 +51,89 @@
#define DA850_MII_MDIO_CLKEN_PIN GPIO_TO_PIN(2, 6)
+static struct davinci_spi_platform_data da850evm_spi1_pdata = {
+ .version = SPI_VERSION_2,
+ .num_chipselect = 1,
+ .intr_line = 1,
+};
+
+static struct mtd_partition da850evm_spiflash_part[] = {
+ [0] = {
+ .name = "UBL",
+ .offset = 0,
+ .size = SZ_64K,
+ .mask_flags = MTD_WRITEABLE,
+ },
+ [1] = {
+ .name = "U-Boot",
+ .offset = MTDPART_OFS_APPEND,
+ .size = SZ_512K,
+ .mask_flags = MTD_WRITEABLE,
+ },
+ [2] = {
+ .name = "U-Boot-Env",
+ .offset = MTDPART_OFS_APPEND,
+ .size = SZ_64K,
+ .mask_flags = MTD_WRITEABLE,
+ },
+ [3] = {
+ .name = "Kernel",
+ .offset = MTDPART_OFS_APPEND,
+ .size = SZ_2M + SZ_512K,
+ .mask_flags = 0,
+ },
+ [4] = {
+ .name = "Filesystem",
+ .offset = MTDPART_OFS_APPEND,
+ .size = SZ_4M,
+ .mask_flags = 0,
+ },
+ [5] = {
+ .name = "MAC-Address",
+ .offset = SZ_8M - SZ_64K,
+ .size = SZ_64K,
+ .mask_flags = MTD_WRITEABLE,
+ },
+};
+
+static struct flash_platform_data da850evm_spiflash_data = {
+ .name = "m25p80",
+ .parts = da850evm_spiflash_part,
+ .nr_parts = ARRAY_SIZE(da850evm_spiflash_part),
+ .type = "m25p64",
+};
+
+static struct davinci_spi_config da850evm_spiflash_cfg = {
+ .io_type = SPI_IO_TYPE_DMA,
+ .c2tdelay = 8,
+ .t2cdelay = 8,
+};
+
+static struct spi_board_info da850evm_spi_info[] = {
+ {
+ .modalias = "m25p80",
+ .platform_data = &da850evm_spiflash_data,
+ .controller_data = &da850evm_spiflash_cfg,
+ .mode = SPI_MODE_0,
+ .max_speed_hz = 30000000,
+ .bus_num = 1,
+ .chip_select = 0,
+ },
+};
+
+static void __init da850evm_init_spi1(struct spi_board_info *info, unsigned len)
+{
+ int ret;
+
+ ret = spi_register_board_info(info, len);
+ if (ret)
+ pr_warning("failed to register board info : %d\n", ret);
+
+ ret = da8xx_register_spi(1, &da850evm_spi1_pdata);
+ if (ret)
+ pr_warning("failed to register spi 1 device : %d\n", ret);
+}
+
static struct mtd_partition da850_evm_norflash_partition[] = {
{
.name = "bootloaders + env",
@@ -1167,6 +1253,8 @@ static __init void da850_evm_init(void)
if (ret)
pr_warning("da850_evm_init: suspend registration failed: %d\n",
ret);
+
+ da850evm_init_spi1(da850evm_spi_info, ARRAY_SIZE(da850evm_spi_info));
}
#ifdef CONFIG_SERIAL_8250_CONSOLE
--
1.7.0.4
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 4/4] davinci: add spi devices support for da830/omap-l137/am17x evm
2011-02-01 0:05 [PATCH 0/4] davinci: Add SPI support for da8xx platforms Michael Williamson
` (2 preceding siblings ...)
2011-02-01 0:05 ` [PATCH 3/4] davinci: add spi devices support for da850/omap-l138/am18x evm Michael Williamson
@ 2011-02-01 0:05 ` Michael Williamson
2011-02-01 12:06 ` Sergei Shtylyov
3 siblings, 1 reply; 14+ messages in thread
From: Michael Williamson @ 2011-02-01 0:05 UTC (permalink / raw)
To: linux-arm-kernel
From: Sekhar Nori <nsekhar@ti.com>
This patch adds the on-board SPI flash device to the
DA830/OMAP-L137/AM17x EVM. It also registers the SPI flash
device to the MTD subsystem.
Based on SPI flash device support for MityDSP-L138F platform.
Signed-off-by: Michael Williamson <michael.williamson@criticallink.com>
---
arch/arm/mach-davinci/board-da830-evm.c | 82 +++++++++++++++++++++++++++++++
1 files changed, 82 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
index b52a3a1..15077a0 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -20,6 +20,8 @@
#include <linux/i2c/at24.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/flash.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
@@ -30,6 +32,7 @@
#include <mach/da8xx.h>
#include <mach/usb.h>
#include <mach/aemif.h>
+#include <mach/spi.h>
#define DA830_EVM_PHY_ID ""
/*
@@ -534,6 +537,83 @@ static struct edma_rsv_info da830_edma_rsv[] = {
},
};
+static struct davinci_spi_platform_data da830evm_spi0_pdata = {
+ .version = SPI_VERSION_2,
+ .num_chipselect = 1,
+ .intr_line = 1,
+};
+
+static struct mtd_partition da830evm_spiflash_part[] = {
+ [0] = {
+ .name = "DSP-UBL",
+ .offset = 0,
+ .size = SZ_8K,
+ .mask_flags = MTD_WRITEABLE,
+ },
+ [1] = {
+ .name = "ARM-UBL",
+ .offset = MTDPART_OFS_APPEND,
+ .size = SZ_16K + SZ_8K,
+ .mask_flags = MTD_WRITEABLE,
+ },
+ [2] = {
+ .name = "U-Boot",
+ .offset = MTDPART_OFS_APPEND,
+ .size = SZ_256K - SZ_32K,
+ .mask_flags = MTD_WRITEABLE,
+ },
+ [3] = {
+ .name = "U-Boot-Environment",
+ .offset = MTDPART_OFS_APPEND,
+ .size = SZ_16K,
+ .mask_flags = 0,
+ },
+ [4] = {
+ .name = "Kernel",
+ .offset = MTDPART_OFS_APPEND,
+ .size = MTDPART_SIZ_FULL,
+ .mask_flags = 0,
+ },
+};
+
+static struct flash_platform_data da830evm_spiflash_data = {
+ .name = "m25p80",
+ .parts = da830evm_spiflash_part,
+ .nr_parts = ARRAY_SIZE(da830evm_spiflash_part),
+ .type = "w25x32",
+};
+
+static struct davinci_spi_config da830evm_spiflash_cfg = {
+ .io_type = SPI_IO_TYPE_DMA,
+ .c2tdelay = 8,
+ .t2cdelay = 8,
+};
+
+static struct spi_board_info da830evm_spi_info[] = {
+ {
+ .modalias = "m25p80",
+ .platform_data = &da830evm_spiflash_data,
+ .controller_data = &da830evm_spiflash_cfg,
+ .mode = SPI_MODE_0,
+ .max_speed_hz = 30000000,
+ .bus_num = 0,
+ .chip_select = 0,
+ },
+};
+
+static void __init da830evm_init_spi0(struct spi_board_info *info, unsigned len)
+{
+ int ret;
+
+ ret = spi_register_board_info(info, len);
+ if (ret)
+ pr_warning("failed to register board info : %d\n", ret);
+
+ ret = da8xx_register_spi(0, &da830evm_spi0_pdata);
+ if (ret)
+ pr_warning("failed to register spi 0 device : %d\n", ret);
+}
+
static __init void da830_evm_init(void)
{
struct davinci_soc_info *soc_info = &davinci_soc_info;
@@ -590,6 +670,8 @@ static __init void da830_evm_init(void)
ret = da8xx_register_rtc();
if (ret)
pr_warning("da830_evm_init: rtc setup failed: %d\n", ret);
+
+ da830evm_init_spi0(da830evm_spi_info, ARRAY_SIZE(da830evm_spi_info));
}
#ifdef CONFIG_SERIAL_8250_CONSOLE
--
1.7.0.4
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 4/4] davinci: add spi devices support for da830/omap-l137/am17x evm
2011-02-01 0:05 ` [PATCH 4/4] davinci: add spi devices support for da830/omap-l137/am17x evm Michael Williamson
@ 2011-02-01 12:06 ` Sergei Shtylyov
2011-02-01 12:11 ` Nori, Sekhar
0 siblings, 1 reply; 14+ messages in thread
From: Sergei Shtylyov @ 2011-02-01 12:06 UTC (permalink / raw)
To: linux-arm-kernel
Hello.
On 01-02-2011 3:05, Michael Williamson wrote:
> From: Sekhar Nori<nsekhar@ti.com>
> This patch adds the on-board SPI flash device to the
> DA830/OMAP-L137/AM17x EVM. It also registers the SPI flash
> device to the MTD subsystem.
> Based on SPI flash device support for MityDSP-L138F platform.
> Signed-off-by: Michael Williamson<michael.williamson@criticallink.com>
Why Sekhar hasn't signed off on this patch?
> diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
> index b52a3a1..15077a0 100644
> --- a/arch/arm/mach-davinci/board-da830-evm.c
> +++ b/arch/arm/mach-davinci/board-da830-evm.c
[...]
> @@ -534,6 +537,83 @@ static struct edma_rsv_info da830_edma_rsv[] = {
> },
> };
>
> +static struct davinci_spi_platform_data da830evm_spi0_pdata = {
> + .version = SPI_VERSION_2,
> + .num_chipselect = 1,
> + .intr_line = 1,
> +};
> +
> +static struct mtd_partition da830evm_spiflash_part[] = {
> + [0] = {
> + .name = "DSP-UBL",
> + .offset = 0,
> + .size = SZ_8K,
> + .mask_flags = MTD_WRITEABLE,
> + },
> + [1] = {
> + .name = "ARM-UBL",
> + .offset = MTDPART_OFS_APPEND,
> + .size = SZ_16K + SZ_8K,
> + .mask_flags = MTD_WRITEABLE,
> + },
> + [2] = {
> + .name = "U-Boot",
> + .offset = MTDPART_OFS_APPEND,
> + .size = SZ_256K - SZ_32K,
> + .mask_flags = MTD_WRITEABLE,
> + },
> + [3] = {
> + .name = "U-Boot-Environment",
> + .offset = MTDPART_OFS_APPEND,
> + .size = SZ_16K,
> + .mask_flags = 0,
> + },
> + [4] = {
> + .name = "Kernel",
> + .offset = MTDPART_OFS_APPEND,
> + .size = MTDPART_SIZ_FULL,
> + .mask_flags = 0,
There's no need to explicitly init to 0.
WBR, Sergei
^ permalink raw reply [flat|nested] 14+ messages in thread* [PATCH 4/4] davinci: add spi devices support for da830/omap-l137/am17x evm
2011-02-01 12:06 ` Sergei Shtylyov
@ 2011-02-01 12:11 ` Nori, Sekhar
2011-02-01 12:43 ` Michael Williamson
0 siblings, 1 reply; 14+ messages in thread
From: Nori, Sekhar @ 2011-02-01 12:11 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Feb 01, 2011 at 17:36:35, Sergei Shtylyov wrote:
> Hello.
>
> On 01-02-2011 3:05, Michael Williamson wrote:
>
> > From: Sekhar Nori<nsekhar@ti.com>
>
> > This patch adds the on-board SPI flash device to the
> > DA830/OMAP-L137/AM17x EVM. It also registers the SPI flash
> > device to the MTD subsystem.
>
> > Based on SPI flash device support for MityDSP-L138F platform.
>
> > Signed-off-by: Michael Williamson<michael.williamson@criticallink.com>
>
> Why Sekhar hasn't signed off on this patch?
I should have.
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Thanks,
Sekhar
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 4/4] davinci: add spi devices support for da830/omap-l137/am17x evm
2011-02-01 12:11 ` Nori, Sekhar
@ 2011-02-01 12:43 ` Michael Williamson
2011-02-01 13:01 ` Nori, Sekhar
0 siblings, 1 reply; 14+ messages in thread
From: Michael Williamson @ 2011-02-01 12:43 UTC (permalink / raw)
To: linux-arm-kernel
Hi Sekhar,
On 2/1/2011 7:11 AM, Nori, Sekhar wrote:
> On Tue, Feb 01, 2011 at 17:36:35, Sergei Shtylyov wrote:
>> Hello.
>>
>> On 01-02-2011 3:05, Michael Williamson wrote:
>>
>>> From: Sekhar Nori<nsekhar@ti.com>
>>
>>> This patch adds the on-board SPI flash device to the
>>> DA830/OMAP-L137/AM17x EVM. It also registers the SPI flash
>>> device to the MTD subsystem.
>>
>>> Based on SPI flash device support for MityDSP-L138F platform.
>>
>>> Signed-off-by: Michael Williamson<michael.williamson@criticallink.com>
>>
>> Why Sekhar hasn't signed off on this patch?
>
> I should have.
>
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
>
> Thanks,
> Sekhar
>
I need to move the da830evm_spi0_pdata structure into the common devices-da8xx.c
based on your other comment to part 2/4 of this series.
For my clarification on patch submission, do I need to change the authorship if
I touch it in anyway? Or should I leave you the author (given you ack the mods,
and confirm your sign-off)?
Thanks.
-Mike
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 4/4] davinci: add spi devices support for da830/omap-l137/am17x evm
2011-02-01 12:43 ` Michael Williamson
@ 2011-02-01 13:01 ` Nori, Sekhar
0 siblings, 0 replies; 14+ messages in thread
From: Nori, Sekhar @ 2011-02-01 13:01 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Feb 01, 2011 at 18:13:13, Michael Williamson wrote:
> I need to move the da830evm_spi0_pdata structure into the common devices-da8xx.c
> based on your other comment to part 2/4 of this series.
>
> For my clarification on patch submission, do I need to change the authorship if
> I touch it in anyway? Or should I leave you the author (given you ack the mods,
> and confirm your sign-off)?
If you do not end up modifying the patch heavily, you can keep me
as the author.
In this case, the change you have done can be noted in between the
sign-offs. Thus:
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
[michael.williamson at criticallink.com: moved da830evm_spi0_pdata to devices-da8xx.c]
Signed-off-by: Michael Williamson <michael.williamson@criticallink.com>
Thanks,
Sekhar
^ permalink raw reply [flat|nested] 14+ messages in thread