* [PATCH 1/3] ARM: mx28: Register SPI clocks @ 2012-04-03 19:20 Fabio Estevam 2012-04-03 19:20 ` [PATCH 2/3] ARM: mx28: Add SPI resources Fabio Estevam 2012-04-03 19:20 ` [PATCH 3/3] ARM: mx28evk: Add SPI NOR flash support Fabio Estevam 0 siblings, 2 replies; 10+ messages in thread From: Fabio Estevam @ 2012-04-03 19:20 UTC (permalink / raw) To: linux-arm-kernel Register SPI clocks. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> --- arch/arm/mach-mxs/clock-mx28.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-mxs/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c index cea29c9..add79a0 100644 --- a/arch/arm/mach-mxs/clock-mx28.c +++ b/arch/arm/mach-mxs/clock-mx28.c @@ -648,6 +648,10 @@ static struct clk_lookup lookups[] = { _REGISTER_CLOCK("imx28-fb", NULL, lcdif_clk) _REGISTER_CLOCK("mxs-saif.0", NULL, saif0_clk) _REGISTER_CLOCK("mxs-saif.1", NULL, saif1_clk) + _REGISTER_CLOCK("mxs-spi.0", NULL, ssp0_clk) + _REGISTER_CLOCK("mxs-spi.1", NULL, ssp1_clk) + _REGISTER_CLOCK("mxs-spi.2", NULL, ssp2_clk) + _REGISTER_CLOCK("mxs-spi.3", NULL, ssp3_clk) }; static int clk_misc_init(void) -- 1.7.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/3] ARM: mx28: Add SPI resources 2012-04-03 19:20 [PATCH 1/3] ARM: mx28: Register SPI clocks Fabio Estevam @ 2012-04-03 19:20 ` Fabio Estevam 2012-05-28 7:25 ` Jean-Paul 2012-04-03 19:20 ` [PATCH 3/3] ARM: mx28evk: Add SPI NOR flash support Fabio Estevam 1 sibling, 1 reply; 10+ messages in thread From: Fabio Estevam @ 2012-04-03 19:20 UTC (permalink / raw) To: linux-arm-kernel Add SPI resources. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> --- arch/arm/mach-mxs/devices-mx28.h | 4 + arch/arm/mach-mxs/devices/Kconfig | 3 + arch/arm/mach-mxs/devices/Makefile | 1 + arch/arm/mach-mxs/devices/platform-mxs-spi.c | 74 +++++++++++++++++++++++ arch/arm/mach-mxs/include/mach/devices-common.h | 11 ++++ 5 files changed, 93 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-mxs/devices/platform-mxs-spi.c diff --git a/arch/arm/mach-mxs/devices-mx28.h b/arch/arm/mach-mxs/devices-mx28.h index 9dbeae1..9b9206d 100644 --- a/arch/arm/mach-mxs/devices-mx28.h +++ b/arch/arm/mach-mxs/devices-mx28.h @@ -55,3 +55,7 @@ extern const struct mxs_saif_data mx28_saif_data[] __initconst; mxs_add_saif(&mx28_saif_data[id], pdata) struct platform_device *__init mx28_add_rtc_stmp3xxx(void); + +extern const struct mxs_mxs_spi_data mx28_mxs_spi_data[] __initconst; +#define mx28_add_mxs_spi(id) \ + mxs_add_mxs_spi(&mx28_mxs_spi_data[id]) diff --git a/arch/arm/mach-mxs/devices/Kconfig b/arch/arm/mach-mxs/devices/Kconfig index b8913df..8ba5fca 100644 --- a/arch/arm/mach-mxs/devices/Kconfig +++ b/arch/arm/mach-mxs/devices/Kconfig @@ -30,5 +30,8 @@ config MXS_HAVE_PLATFORM_MXSFB config MXS_HAVE_PLATFORM_MXS_SAIF bool +config MXS_HAVE_PLATFORM_MXS_SPI + bool + config MXS_HAVE_PLATFORM_RTC_STMP3XXX bool diff --git a/arch/arm/mach-mxs/devices/Makefile b/arch/arm/mach-mxs/devices/Makefile index c8f5c95..1664049 100644 --- a/arch/arm/mach-mxs/devices/Makefile +++ b/arch/arm/mach-mxs/devices/Makefile @@ -11,3 +11,4 @@ obj-y += platform-gpio-mxs.o obj-$(CONFIG_MXS_HAVE_PLATFORM_MXSFB) += platform-mxsfb.o obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_SAIF) += platform-mxs-saif.o obj-$(CONFIG_MXS_HAVE_PLATFORM_RTC_STMP3XXX) += platform-rtc-stmp3xxx.o +obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_SPI) += platform-mxs-spi.o diff --git a/arch/arm/mach-mxs/devices/platform-mxs-spi.c b/arch/arm/mach-mxs/devices/platform-mxs-spi.c new file mode 100644 index 0000000..b9e78d3 --- /dev/null +++ b/arch/arm/mach-mxs/devices/platform-mxs-spi.c @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2010 Pengutronix + * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de> + * + * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License version 2 as published by the + * Free Software Foundation. + */ + +#include <linux/compiler.h> +#include <linux/err.h> +#include <linux/init.h> + +#include <mach/mx23.h> +#include <mach/mx28.h> +#include <mach/devices-common.h> + +#define mxs_mxs_spi_data_entry_single(soc, _id, hwid) \ + { \ + .id = _id, \ + .iobase = soc ## _SSP ## hwid ## _BASE_ADDR, \ + .dma = soc ## _DMA_SSP ## hwid, \ + .irq_err = soc ## _INT_SSP ## hwid ## _ERROR, \ + .irq_dma = soc ## _INT_SSP ## hwid ## _DMA, \ + } + +#define mxs_mxs_spi_data_entry(soc, _id, hwid) \ + [_id] = mxs_mxs_spi_data_entry_single(soc, _id, hwid) + + +#ifdef CONFIG_SOC_IMX23 +const struct mxs_mxs_spi_data mx23_mxs_spi_data[] __initconst = { + mxs_mxs_spi_data_entry(MX23, 0, 1), + mxs_mxs_spi_data_entry(MX23, 1, 2), +}; +#endif + +#ifdef CONFIG_SOC_IMX28 +const struct mxs_mxs_spi_data mx28_mxs_spi_data[] __initconst = { + mxs_mxs_spi_data_entry(MX28, 0, 0), + mxs_mxs_spi_data_entry(MX28, 1, 1), + mxs_mxs_spi_data_entry(MX28, 2, 2), + mxs_mxs_spi_data_entry(MX28, 3, 3), +}; +#endif + +struct platform_device *__init mxs_add_mxs_spi( + const struct mxs_mxs_spi_data *data) +{ + struct resource res[] = { + { + .start = data->iobase, + .end = data->iobase + SZ_8K - 1, + .flags = IORESOURCE_MEM, + }, { + .start = data->dma, + .end = data->dma, + .flags = IORESOURCE_DMA, + }, { + .start = data->irq_err, + .end = data->irq_err, + .flags = IORESOURCE_IRQ, + }, { + .start = data->irq_dma, + .end = data->irq_dma, + .flags = IORESOURCE_IRQ, + }, + }; + + return mxs_add_platform_device("mxs-spi", data->id, + res, ARRAY_SIZE(res), NULL, 0); +} diff --git a/arch/arm/mach-mxs/include/mach/devices-common.h b/arch/arm/mach-mxs/include/mach/devices-common.h index f2e3839..2bb1d9e 100644 --- a/arch/arm/mach-mxs/include/mach/devices-common.h +++ b/arch/arm/mach-mxs/include/mach/devices-common.h @@ -116,3 +116,14 @@ struct mxs_saif_data { struct platform_device *__init mxs_add_saif( const struct mxs_saif_data *data, const struct mxs_saif_platform_data *pdata); + +/* spi */ +struct mxs_mxs_spi_data { + int id; + resource_size_t iobase; + resource_size_t dma; + resource_size_t irq_err; + resource_size_t irq_dma; +}; +struct platform_device *__init mxs_add_mxs_spi( + const struct mxs_mxs_spi_data *data); -- 1.7.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/3] ARM: mx28: Add SPI resources 2012-04-03 19:20 ` [PATCH 2/3] ARM: mx28: Add SPI resources Fabio Estevam @ 2012-05-28 7:25 ` Jean-Paul 2012-05-28 23:39 ` Fabio Estevam 0 siblings, 1 reply; 10+ messages in thread From: Jean-Paul @ 2012-05-28 7:25 UTC (permalink / raw) To: linux-arm-kernel Hi Fabio Estevam, I have im28 evk board and I fallowed your instructions to add the SPI resources in my kernel. I'm using the kernel 3.2.15. After rebuilding the kernel, I still can not see the imx28 spi drivers. Im sorry to ask these beginner questions but I'm new in using linux spi drivers. I checked at these locations: /sys/class/spidev and /sys/class/spi_master I could not see any SPI device, it was just empty. when I do: ls /sys/bus/spi/drivers I can see: enc28j60 , mc33880 , mmc_spi , and spidev How can I create a device spi node since it looks like that i don't have spi driver for the imx28 evk board? Thanks for your help, Jean-Paul ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/3] ARM: mx28: Add SPI resources 2012-05-28 7:25 ` Jean-Paul @ 2012-05-28 23:39 ` Fabio Estevam 0 siblings, 0 replies; 10+ messages in thread From: Fabio Estevam @ 2012-05-28 23:39 UTC (permalink / raw) To: linux-arm-kernel Hi Jean-Paul, On Mon, May 28, 2012 at 4:25 AM, Jean-Paul <alainsergenagni@yahoo.com> wrote: > > Hi Fabio Estevam, > ?I have im28 evk board and I fallowed your instructions to add the SPI resources > in my kernel. I'm using the kernel 3.2.15. After rebuilding the kernel, I still > can not see the imx28 spi drivers. Im sorry to ask these beginner questions but > I'm new in using linux spi drivers. On patch 3/3 I added the support for a SPI NOR flash. > ?I checked at these locations: > ? ? /sys/class/spidev ? and ? ?/sys/class/spi_master > I could not see any SPI device, it was just empty. > > when I do: ls /sys/bus/spi/drivers > I can see: ? enc28j60 , mc33880 , mmc_spi , and spidev > > How can I create a device spi node since it looks like that i don't have spi > driver for the imx28 evk board? Make sure you added the mxs spi driver I posted in the spi list and also that you selected it in .config. I still need to add dt support for the mxs spi driver. Regards, Fabio Estevam ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/3] ARM: mx28evk: Add SPI NOR flash support 2012-04-03 19:20 [PATCH 1/3] ARM: mx28: Register SPI clocks Fabio Estevam 2012-04-03 19:20 ` [PATCH 2/3] ARM: mx28: Add SPI resources Fabio Estevam @ 2012-04-03 19:20 ` Fabio Estevam 2012-04-03 19:26 ` Wolfram Sang 1 sibling, 1 reply; 10+ messages in thread From: Fabio Estevam @ 2012-04-03 19:20 UTC (permalink / raw) To: linux-arm-kernel Add SPI NOR flash support. By default, the mx28evk board does not come with a SPI NOR flash populated. Soldered a sst25vf016b and tested it using mtd-utils. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> --- I will submit the spi-mxs driver in a day or so. arch/arm/mach-mxs/Kconfig | 1 + arch/arm/mach-mxs/mach-mx28evk.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-mxs/Kconfig b/arch/arm/mach-mxs/Kconfig index c57f996..8078fbe 100644 --- a/arch/arm/mach-mxs/Kconfig +++ b/arch/arm/mach-mxs/Kconfig @@ -52,6 +52,7 @@ config MACH_MX28EVK select MXS_HAVE_PLATFORM_MXSFB select MXS_HAVE_PLATFORM_MXS_SAIF select MXS_HAVE_PLATFORM_MXS_I2C + select MXS_HAVE_PLATFORM_MXS_SPI select MXS_HAVE_PLATFORM_RTC_STMP3XXX select MXS_OCOTP help diff --git a/arch/arm/mach-mxs/mach-mx28evk.c b/arch/arm/mach-mxs/mach-mx28evk.c index e386c14..f3bca27 100644 --- a/arch/arm/mach-mxs/mach-mx28evk.c +++ b/arch/arm/mach-mxs/mach-mx28evk.c @@ -20,6 +20,7 @@ #include <linux/i2c.h> #include <linux/regulator/machine.h> #include <linux/regulator/fixed.h> +#include <linux/spi/spi.h> #include <asm/mach-types.h> #include <asm/mach/arch.h> @@ -204,6 +205,12 @@ static const iomux_cfg_t mx28evk_pads[] __initconst = { (MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), MX28_PAD_SAIF1_SDATA0__SAIF1_SDATA0 | (MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), + /* SPI2 */ + MX28_PAD_SSP2_SCK__SSP2_SCK, + MX28_PAD_SSP2_MOSI__SSP2_CMD, + MX28_PAD_SSP2_MISO__SSP2_D0, + MX28_PAD_SSP2_SS0__SSP2_D3 | + (MXS_PAD_3V3 | MXS_PAD_8MA | MXS_PAD_PULLUP), }; /* led */ @@ -409,6 +416,15 @@ static const struct mxs_saif_platform_data }, }; +static struct spi_board_info mx28evk_spi_nor_device[] = { + { + .modalias = "sst25vf016b", + .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ + .bus_num = 2, + .chip_select = 0, + }, +}; + static void __init mx28evk_init(void) { int ret; @@ -454,6 +470,10 @@ static void __init mx28evk_init(void) mx28_add_rtc_stmp3xxx(); gpio_led_register_device(0, &mx28evk_led_data); + + mx28_add_mxs_spi(2); + spi_register_board_info(mx28evk_spi_nor_device, + ARRAY_SIZE(mx28evk_spi_nor_device)); } static void __init mx28evk_timer_init(void) -- 1.7.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/3] ARM: mx28evk: Add SPI NOR flash support 2012-04-03 19:20 ` [PATCH 3/3] ARM: mx28evk: Add SPI NOR flash support Fabio Estevam @ 2012-04-03 19:26 ` Wolfram Sang 2012-04-03 19:29 ` Fabio Estevam 2012-04-18 21:42 ` Marek Vasut 0 siblings, 2 replies; 10+ messages in thread From: Wolfram Sang @ 2012-04-03 19:26 UTC (permalink / raw) To: linux-arm-kernel Hi Fabio, On Tue, Apr 03, 2012 at 04:20:07PM -0300, Fabio Estevam wrote: > Add SPI NOR flash support. > > By default, the mx28evk board does not come with a SPI NOR flash populated. > > Soldered a sst25vf016b and tested it using mtd-utils. > > Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> > --- > I will submit the spi-mxs driver in a day or so. \o/ Looking forward to that one! However, I think this patch should include registering the spi-device as well? Regards, Wolfram -- Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120403/5c2522cd/attachment.sig> ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/3] ARM: mx28evk: Add SPI NOR flash support 2012-04-03 19:26 ` Wolfram Sang @ 2012-04-03 19:29 ` Fabio Estevam 2012-04-03 19:34 ` Wolfram Sang 2012-04-18 21:42 ` Marek Vasut 1 sibling, 1 reply; 10+ messages in thread From: Fabio Estevam @ 2012-04-03 19:29 UTC (permalink / raw) To: linux-arm-kernel Hi Wolfram, On Tue, Apr 3, 2012 at 4:26 PM, Wolfram Sang <w.sang@pengutronix.de> wrote: > However, I think this patch should include registering the spi-device as well? It does register it by doing: mx28_add_mxs_spi(2); Regards, Fabio Estevam ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/3] ARM: mx28evk: Add SPI NOR flash support 2012-04-03 19:29 ` Fabio Estevam @ 2012-04-03 19:34 ` Wolfram Sang 0 siblings, 0 replies; 10+ messages in thread From: Wolfram Sang @ 2012-04-03 19:34 UTC (permalink / raw) To: linux-arm-kernel > > However, I think this patch should include registering the spi-device as well? > > It does register it by doing: mx28_add_mxs_spi(2); Doh, right! -- Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120403/ab67b25d/attachment.sig> ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/3] ARM: mx28evk: Add SPI NOR flash support 2012-04-03 19:26 ` Wolfram Sang 2012-04-03 19:29 ` Fabio Estevam @ 2012-04-18 21:42 ` Marek Vasut 2012-04-18 21:49 ` Fabio Estevam 1 sibling, 1 reply; 10+ messages in thread From: Marek Vasut @ 2012-04-18 21:42 UTC (permalink / raw) To: linux-arm-kernel Dear Wolfram Sang, > Hi Fabio, > > On Tue, Apr 03, 2012 at 04:20:07PM -0300, Fabio Estevam wrote: > > Add SPI NOR flash support. > > > > By default, the mx28evk board does not come with a SPI NOR flash > > populated. > > > > Soldered a sst25vf016b and tested it using mtd-utils. > > > > Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> > > --- > > I will submit the spi-mxs driver in a day or so. > > \o/ Looking forward to that one! Hey, did you get anywhere with this? > However, I think this patch should include registering the spi-device as > well? > > Regards, > > Wolfram Best regards, Marek Vasut ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/3] ARM: mx28evk: Add SPI NOR flash support 2012-04-18 21:42 ` Marek Vasut @ 2012-04-18 21:49 ` Fabio Estevam 0 siblings, 0 replies; 10+ messages in thread From: Fabio Estevam @ 2012-04-18 21:49 UTC (permalink / raw) To: linux-arm-kernel Hi Marek, On Wed, Apr 18, 2012 at 6:42 PM, Marek Vasut <marek.vasut@gmail.com> wrote: > Hey, did you get anywhere with this? I had it working a few weeks ago, but I still need to convert it to DT. After I convert it to DT I will post the patch. ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2012-05-28 23:39 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-04-03 19:20 [PATCH 1/3] ARM: mx28: Register SPI clocks Fabio Estevam 2012-04-03 19:20 ` [PATCH 2/3] ARM: mx28: Add SPI resources Fabio Estevam 2012-05-28 7:25 ` Jean-Paul 2012-05-28 23:39 ` Fabio Estevam 2012-04-03 19:20 ` [PATCH 3/3] ARM: mx28evk: Add SPI NOR flash support Fabio Estevam 2012-04-03 19:26 ` Wolfram Sang 2012-04-03 19:29 ` Fabio Estevam 2012-04-03 19:34 ` Wolfram Sang 2012-04-18 21:42 ` Marek Vasut 2012-04-18 21:49 ` Fabio Estevam
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).