2017-12-26 03:54:32 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
//
|
|
|
|
// Copyright (C) 2006 by OpenMoko, Inc.
|
|
|
|
// Author: Harald Welte <laforge@openmoko.org>
|
|
|
|
// All rights reserved.
|
2007-02-17 07:52:37 +08:00
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/list.h>
|
|
|
|
#include <linux/timer.h>
|
|
|
|
#include <linux/init.h>
|
2009-05-14 05:52:24 +08:00
|
|
|
#include <linux/gpio.h>
|
spi: spi-gpio: Rewrite to use GPIO descriptors
This converts the bit-banged GPIO SPI driver to looking up and
using GPIO descriptors to get a handle on GPIO lines for SCK,
MOSI, MISO and all CS lines.
All existing board files are converted in one go to keep it all
consistent. With these conversions I rarely find any interrim
steps that makes any sense.
Device tree probing and GPIO handling should work like before
also after this patch.
For board files, we stop using controller data to pass the GPIO
line for chip select, instead we pass this as a GPIO descriptor
lookup like everything else.
In some s3c24xx machines the names of the SPI devices were set to
"spi-gpio" rather than "spi_gpio" which can never have worked, I
fixed it working (I guess) as part of this patch set. Sometimes
I wonder how this code got upstream in the first place, it
obviously is not tested.
mach-s3c64xx/mach-smartq.c has the same problem and additionally
defines the *same* GPIO line for MOSI and MISO which is not going
to be accepted by gpiolib. As the lines were number 1,2,2 I assumed
it was a typo and use lines 1,2,3. A comment gives awat that line 0
is chip select though no actual SPI device is provided for the LCD
supposed to be on this bit-banged SPI bus. I left it intact instead
of just deleting the bus though.
Kill off board file code that try to initialize the SPI lines
to the same values that they will later be set by the spi_gpio
driver anyways. Given the huge number of weird things in these
board files I do not think this code is very tested or put in
with much afterthought anyways.
In order to assert that we do not get performance regressions on
this crucial bing-banged driver, a ran a script like this dumping the
Ilitek ILI9322 regmap 10000 times (it has no caching obviously) on
an otherwise idle system in two iterations before and after the
patches:
#!/bin/sh
for run in `seq 10000`
do
cat /debug/regmap/spi0.0/registers > /dev/null
done
Before the patch:
time test.sh
real 3m 41.03s
user 0m 29.41s
sys 3m 7.22s
time test.sh
real 3m 44.24s
user 0m 32.31s
sys 3m 7.60s
After the patch:
time test.sh
real 3m 41.32s
user 0m 28.92s
sys 3m 8.08s
time test.sh
real 3m 39.92s
user 0m 30.20s
sys 3m 5.56s
So any performance differences seems to be in the error margin.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Olof Johansson <olof@lixom.net>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-12 20:45:30 +08:00
|
|
|
#include <linux/gpio/machine.h>
|
2011-12-22 08:26:03 +08:00
|
|
|
#include <linux/device.h>
|
2007-02-17 07:52:37 +08:00
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/serial_core.h>
|
2014-02-14 09:32:45 +08:00
|
|
|
#include <linux/serial_s3c.h>
|
2007-02-17 07:52:37 +08:00
|
|
|
#include <linux/spi/spi.h>
|
2011-06-28 20:49:14 +08:00
|
|
|
#include <linux/spi/spi_gpio.h>
|
2008-09-06 19:10:45 +08:00
|
|
|
#include <linux/io.h>
|
2007-02-17 07:52:37 +08:00
|
|
|
#include <linux/mtd/mtd.h>
|
2017-08-04 23:29:10 +08:00
|
|
|
#include <linux/mtd/rawnand.h>
|
2007-02-17 07:52:37 +08:00
|
|
|
#include <linux/mtd/nand_ecc.h>
|
|
|
|
#include <linux/mtd/partitions.h>
|
|
|
|
|
|
|
|
#include <asm/mach/arch.h>
|
|
|
|
#include <asm/mach/map.h>
|
|
|
|
#include <asm/mach/irq.h>
|
|
|
|
|
2008-08-05 23:14:15 +08:00
|
|
|
#include <mach/hardware.h>
|
2007-02-17 07:52:37 +08:00
|
|
|
#include <asm/irq.h>
|
|
|
|
#include <asm/mach-types.h>
|
|
|
|
|
2012-08-24 21:22:12 +08:00
|
|
|
#include <linux/platform_data/leds-s3c24xx.h>
|
2011-10-03 08:46:13 +08:00
|
|
|
#include <mach/regs-lcd.h>
|
2008-08-05 23:14:15 +08:00
|
|
|
#include <mach/fb.h>
|
2012-08-24 21:22:12 +08:00
|
|
|
#include <linux/platform_data/mtd-nand-s3c2410.h>
|
|
|
|
#include <linux/platform_data/usb-s3c2410_udc.h>
|
|
|
|
#include <linux/platform_data/i2c-s3c2410.h>
|
2014-01-14 21:24:24 +08:00
|
|
|
#include <mach/gpio-samsung.h>
|
2007-02-17 07:52:37 +08:00
|
|
|
|
2010-05-04 13:38:49 +08:00
|
|
|
#include <plat/gpio-cfg.h>
|
2008-10-08 05:26:09 +08:00
|
|
|
#include <plat/devs.h>
|
|
|
|
#include <plat/cpu.h>
|
|
|
|
#include <plat/pm.h>
|
2013-01-10 10:47:04 +08:00
|
|
|
#include <plat/samsung-time.h>
|
2007-02-17 07:52:37 +08:00
|
|
|
|
2012-01-03 21:02:03 +08:00
|
|
|
#include "common.h"
|
2013-02-09 02:18:48 +08:00
|
|
|
#include "common-smdk.h"
|
2012-01-03 21:02:03 +08:00
|
|
|
|
2007-02-17 07:52:37 +08:00
|
|
|
static struct map_desc qt2410_iodesc[] __initdata = {
|
|
|
|
{ 0xe0000000, __phys_to_pfn(S3C2410_CS3+0x01000000), SZ_1M, MT_DEVICE }
|
|
|
|
};
|
|
|
|
|
|
|
|
#define UCON S3C2410_UCON_DEFAULT
|
|
|
|
#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
|
|
|
|
#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
|
|
|
|
|
|
|
|
static struct s3c2410_uartcfg smdk2410_uartcfgs[] = {
|
|
|
|
[0] = {
|
|
|
|
.hwport = 0,
|
|
|
|
.flags = 0,
|
|
|
|
.ucon = UCON,
|
|
|
|
.ulcon = ULCON,
|
|
|
|
.ufcon = UFCON,
|
|
|
|
},
|
|
|
|
[1] = {
|
|
|
|
.hwport = 1,
|
|
|
|
.flags = 0,
|
|
|
|
.ucon = UCON,
|
|
|
|
.ulcon = ULCON,
|
|
|
|
.ufcon = UFCON,
|
|
|
|
},
|
|
|
|
[2] = {
|
|
|
|
.hwport = 2,
|
|
|
|
.flags = 0,
|
|
|
|
.ucon = UCON,
|
|
|
|
.ulcon = ULCON,
|
|
|
|
.ufcon = UFCON,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/* LCD driver info */
|
|
|
|
|
2007-10-16 16:28:56 +08:00
|
|
|
static struct s3c2410fb_display qt2410_lcd_cfg[] __initdata = {
|
|
|
|
{
|
|
|
|
/* Configuration for 640x480 SHARP LQ080V3DG01 */
|
2007-10-16 16:28:58 +08:00
|
|
|
.lcdcon5 = S3C2410_LCDCON5_FRM565 |
|
|
|
|
S3C2410_LCDCON5_INVVLINE |
|
|
|
|
S3C2410_LCDCON5_INVVFRAME |
|
|
|
|
S3C2410_LCDCON5_PWREN |
|
|
|
|
S3C2410_LCDCON5_HWSWP,
|
2007-10-16 16:28:56 +08:00
|
|
|
|
2007-10-16 16:28:57 +08:00
|
|
|
.type = S3C2410_LCDCON1_TFT,
|
2007-10-16 16:28:56 +08:00
|
|
|
.width = 640,
|
|
|
|
.height = 480,
|
|
|
|
|
2007-10-16 16:29:06 +08:00
|
|
|
.pixclock = 40000, /* HCLK/4 */
|
2007-10-16 16:28:56 +08:00
|
|
|
.xres = 640,
|
|
|
|
.yres = 480,
|
|
|
|
.bpp = 16,
|
2007-10-16 16:28:57 +08:00
|
|
|
.left_margin = 44,
|
|
|
|
.right_margin = 116,
|
2007-10-16 16:29:00 +08:00
|
|
|
.hsync_len = 96,
|
2007-10-16 16:28:59 +08:00
|
|
|
.upper_margin = 19,
|
|
|
|
.lower_margin = 11,
|
2007-10-16 16:29:00 +08:00
|
|
|
.vsync_len = 15,
|
2007-02-17 07:52:37 +08:00
|
|
|
},
|
2007-10-16 16:28:56 +08:00
|
|
|
{
|
|
|
|
/* Configuration for 480x640 toppoly TD028TTEC1 */
|
2007-10-16 16:28:58 +08:00
|
|
|
.lcdcon5 = S3C2410_LCDCON5_FRM565 |
|
|
|
|
S3C2410_LCDCON5_INVVLINE |
|
|
|
|
S3C2410_LCDCON5_INVVFRAME |
|
|
|
|
S3C2410_LCDCON5_PWREN |
|
|
|
|
S3C2410_LCDCON5_HWSWP,
|
2007-10-16 16:28:56 +08:00
|
|
|
|
2007-10-16 16:28:57 +08:00
|
|
|
.type = S3C2410_LCDCON1_TFT,
|
2007-10-16 16:28:56 +08:00
|
|
|
.width = 480,
|
|
|
|
.height = 640,
|
2007-10-16 16:29:06 +08:00
|
|
|
.pixclock = 40000, /* HCLK/4 */
|
2007-10-16 16:28:56 +08:00
|
|
|
.xres = 480,
|
|
|
|
.yres = 640,
|
|
|
|
.bpp = 16,
|
2007-10-16 16:28:57 +08:00
|
|
|
.left_margin = 8,
|
|
|
|
.right_margin = 24,
|
2007-10-16 16:29:00 +08:00
|
|
|
.hsync_len = 8,
|
2007-10-16 16:28:59 +08:00
|
|
|
.upper_margin = 2,
|
|
|
|
.lower_margin = 4,
|
2007-10-16 16:29:00 +08:00
|
|
|
.vsync_len = 2,
|
2007-02-17 07:52:37 +08:00
|
|
|
},
|
2007-10-16 16:28:56 +08:00
|
|
|
{
|
|
|
|
/* Config for 240x320 LCD */
|
2007-10-16 16:28:58 +08:00
|
|
|
.lcdcon5 = S3C2410_LCDCON5_FRM565 |
|
|
|
|
S3C2410_LCDCON5_INVVLINE |
|
|
|
|
S3C2410_LCDCON5_INVVFRAME |
|
|
|
|
S3C2410_LCDCON5_PWREN |
|
|
|
|
S3C2410_LCDCON5_HWSWP,
|
2007-10-16 16:28:56 +08:00
|
|
|
|
2007-10-16 16:28:57 +08:00
|
|
|
.type = S3C2410_LCDCON1_TFT,
|
2007-10-16 16:28:56 +08:00
|
|
|
.width = 240,
|
|
|
|
.height = 320,
|
2007-10-16 16:29:06 +08:00
|
|
|
.pixclock = 100000, /* HCLK/10 */
|
2007-10-16 16:28:56 +08:00
|
|
|
.xres = 240,
|
|
|
|
.yres = 320,
|
|
|
|
.bpp = 16,
|
2007-10-16 16:28:57 +08:00
|
|
|
.left_margin = 13,
|
|
|
|
.right_margin = 8,
|
2007-10-16 16:29:00 +08:00
|
|
|
.hsync_len = 4,
|
2007-10-16 16:28:59 +08:00
|
|
|
.upper_margin = 2,
|
|
|
|
.lower_margin = 7,
|
2007-10-16 16:29:00 +08:00
|
|
|
.vsync_len = 4,
|
2007-02-17 07:52:37 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-10-16 16:28:56 +08:00
|
|
|
static struct s3c2410fb_mach_info qt2410_fb_info __initdata = {
|
|
|
|
.displays = qt2410_lcd_cfg,
|
|
|
|
.num_displays = ARRAY_SIZE(qt2410_lcd_cfg),
|
|
|
|
.default_display = 0,
|
2007-02-17 07:52:37 +08:00
|
|
|
|
|
|
|
.lpcsel = ((0xCE6) & ~7) | 1<<4,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* CS8900 */
|
|
|
|
|
|
|
|
static struct resource qt2410_cs89x0_resources[] = {
|
2012-05-13 05:47:13 +08:00
|
|
|
[0] = DEFINE_RES_MEM(0x19000000, 17),
|
|
|
|
[1] = DEFINE_RES_IRQ(IRQ_EINT9),
|
2007-02-17 07:52:37 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device qt2410_cs89x0 = {
|
|
|
|
.name = "cirrus-cs89x0",
|
|
|
|
.num_resources = ARRAY_SIZE(qt2410_cs89x0_resources),
|
|
|
|
.resource = qt2410_cs89x0_resources,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* LED */
|
|
|
|
|
|
|
|
static struct s3c24xx_led_platdata qt2410_pdata_led = {
|
2009-05-18 05:32:23 +08:00
|
|
|
.gpio = S3C2410_GPB(0),
|
2007-02-17 07:52:37 +08:00
|
|
|
.flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
|
|
|
|
.name = "led",
|
|
|
|
.def_trigger = "timer",
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device qt2410_led = {
|
|
|
|
.name = "s3c24xx_led",
|
|
|
|
.id = 0,
|
|
|
|
.dev = {
|
|
|
|
.platform_data = &qt2410_pdata_led,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
/* SPI */
|
|
|
|
|
2011-06-28 20:49:14 +08:00
|
|
|
static struct spi_gpio_platform_data spi_gpio_cfg = {
|
spi: spi-gpio: Rewrite to use GPIO descriptors
This converts the bit-banged GPIO SPI driver to looking up and
using GPIO descriptors to get a handle on GPIO lines for SCK,
MOSI, MISO and all CS lines.
All existing board files are converted in one go to keep it all
consistent. With these conversions I rarely find any interrim
steps that makes any sense.
Device tree probing and GPIO handling should work like before
also after this patch.
For board files, we stop using controller data to pass the GPIO
line for chip select, instead we pass this as a GPIO descriptor
lookup like everything else.
In some s3c24xx machines the names of the SPI devices were set to
"spi-gpio" rather than "spi_gpio" which can never have worked, I
fixed it working (I guess) as part of this patch set. Sometimes
I wonder how this code got upstream in the first place, it
obviously is not tested.
mach-s3c64xx/mach-smartq.c has the same problem and additionally
defines the *same* GPIO line for MOSI and MISO which is not going
to be accepted by gpiolib. As the lines were number 1,2,2 I assumed
it was a typo and use lines 1,2,3. A comment gives awat that line 0
is chip select though no actual SPI device is provided for the LCD
supposed to be on this bit-banged SPI bus. I left it intact instead
of just deleting the bus though.
Kill off board file code that try to initialize the SPI lines
to the same values that they will later be set by the spi_gpio
driver anyways. Given the huge number of weird things in these
board files I do not think this code is very tested or put in
with much afterthought anyways.
In order to assert that we do not get performance regressions on
this crucial bing-banged driver, a ran a script like this dumping the
Ilitek ILI9322 regmap 10000 times (it has no caching obviously) on
an otherwise idle system in two iterations before and after the
patches:
#!/bin/sh
for run in `seq 10000`
do
cat /debug/regmap/spi0.0/registers > /dev/null
done
Before the patch:
time test.sh
real 3m 41.03s
user 0m 29.41s
sys 3m 7.22s
time test.sh
real 3m 44.24s
user 0m 32.31s
sys 3m 7.60s
After the patch:
time test.sh
real 3m 41.32s
user 0m 28.92s
sys 3m 8.08s
time test.sh
real 3m 39.92s
user 0m 30.20s
sys 3m 5.56s
So any performance differences seems to be in the error margin.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Olof Johansson <olof@lixom.net>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-12 20:45:30 +08:00
|
|
|
.num_chipselect = 1,
|
2007-02-17 07:52:37 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device qt2410_spi = {
|
spi: spi-gpio: Rewrite to use GPIO descriptors
This converts the bit-banged GPIO SPI driver to looking up and
using GPIO descriptors to get a handle on GPIO lines for SCK,
MOSI, MISO and all CS lines.
All existing board files are converted in one go to keep it all
consistent. With these conversions I rarely find any interrim
steps that makes any sense.
Device tree probing and GPIO handling should work like before
also after this patch.
For board files, we stop using controller data to pass the GPIO
line for chip select, instead we pass this as a GPIO descriptor
lookup like everything else.
In some s3c24xx machines the names of the SPI devices were set to
"spi-gpio" rather than "spi_gpio" which can never have worked, I
fixed it working (I guess) as part of this patch set. Sometimes
I wonder how this code got upstream in the first place, it
obviously is not tested.
mach-s3c64xx/mach-smartq.c has the same problem and additionally
defines the *same* GPIO line for MOSI and MISO which is not going
to be accepted by gpiolib. As the lines were number 1,2,2 I assumed
it was a typo and use lines 1,2,3. A comment gives awat that line 0
is chip select though no actual SPI device is provided for the LCD
supposed to be on this bit-banged SPI bus. I left it intact instead
of just deleting the bus though.
Kill off board file code that try to initialize the SPI lines
to the same values that they will later be set by the spi_gpio
driver anyways. Given the huge number of weird things in these
board files I do not think this code is very tested or put in
with much afterthought anyways.
In order to assert that we do not get performance regressions on
this crucial bing-banged driver, a ran a script like this dumping the
Ilitek ILI9322 regmap 10000 times (it has no caching obviously) on
an otherwise idle system in two iterations before and after the
patches:
#!/bin/sh
for run in `seq 10000`
do
cat /debug/regmap/spi0.0/registers > /dev/null
done
Before the patch:
time test.sh
real 3m 41.03s
user 0m 29.41s
sys 3m 7.22s
time test.sh
real 3m 44.24s
user 0m 32.31s
sys 3m 7.60s
After the patch:
time test.sh
real 3m 41.32s
user 0m 28.92s
sys 3m 8.08s
time test.sh
real 3m 39.92s
user 0m 30.20s
sys 3m 5.56s
So any performance differences seems to be in the error margin.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Olof Johansson <olof@lixom.net>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-12 20:45:30 +08:00
|
|
|
.name = "spi_gpio",
|
2011-06-28 20:49:14 +08:00
|
|
|
.id = 1,
|
|
|
|
.dev.platform_data = &spi_gpio_cfg,
|
2007-02-17 07:52:37 +08:00
|
|
|
};
|
|
|
|
|
spi: spi-gpio: Rewrite to use GPIO descriptors
This converts the bit-banged GPIO SPI driver to looking up and
using GPIO descriptors to get a handle on GPIO lines for SCK,
MOSI, MISO and all CS lines.
All existing board files are converted in one go to keep it all
consistent. With these conversions I rarely find any interrim
steps that makes any sense.
Device tree probing and GPIO handling should work like before
also after this patch.
For board files, we stop using controller data to pass the GPIO
line for chip select, instead we pass this as a GPIO descriptor
lookup like everything else.
In some s3c24xx machines the names of the SPI devices were set to
"spi-gpio" rather than "spi_gpio" which can never have worked, I
fixed it working (I guess) as part of this patch set. Sometimes
I wonder how this code got upstream in the first place, it
obviously is not tested.
mach-s3c64xx/mach-smartq.c has the same problem and additionally
defines the *same* GPIO line for MOSI and MISO which is not going
to be accepted by gpiolib. As the lines were number 1,2,2 I assumed
it was a typo and use lines 1,2,3. A comment gives awat that line 0
is chip select though no actual SPI device is provided for the LCD
supposed to be on this bit-banged SPI bus. I left it intact instead
of just deleting the bus though.
Kill off board file code that try to initialize the SPI lines
to the same values that they will later be set by the spi_gpio
driver anyways. Given the huge number of weird things in these
board files I do not think this code is very tested or put in
with much afterthought anyways.
In order to assert that we do not get performance regressions on
this crucial bing-banged driver, a ran a script like this dumping the
Ilitek ILI9322 regmap 10000 times (it has no caching obviously) on
an otherwise idle system in two iterations before and after the
patches:
#!/bin/sh
for run in `seq 10000`
do
cat /debug/regmap/spi0.0/registers > /dev/null
done
Before the patch:
time test.sh
real 3m 41.03s
user 0m 29.41s
sys 3m 7.22s
time test.sh
real 3m 44.24s
user 0m 32.31s
sys 3m 7.60s
After the patch:
time test.sh
real 3m 41.32s
user 0m 28.92s
sys 3m 8.08s
time test.sh
real 3m 39.92s
user 0m 30.20s
sys 3m 5.56s
So any performance differences seems to be in the error margin.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Olof Johansson <olof@lixom.net>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-12 20:45:30 +08:00
|
|
|
static struct gpiod_lookup_table qt2410_spi_gpiod_table = {
|
|
|
|
.dev_id = "spi_gpio",
|
|
|
|
.table = {
|
|
|
|
GPIO_LOOKUP("GPIOG", 7,
|
|
|
|
"sck", GPIO_ACTIVE_HIGH),
|
|
|
|
GPIO_LOOKUP("GPIOG", 6,
|
|
|
|
"mosi", GPIO_ACTIVE_HIGH),
|
|
|
|
GPIO_LOOKUP("GPIOG", 5,
|
|
|
|
"miso", GPIO_ACTIVE_HIGH),
|
|
|
|
GPIO_LOOKUP("GPIOB", 5,
|
|
|
|
"cs", GPIO_ACTIVE_HIGH),
|
|
|
|
{ },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2007-02-17 07:52:37 +08:00
|
|
|
/* Board devices */
|
|
|
|
|
|
|
|
static struct platform_device *qt2410_devices[] __initdata = {
|
2009-11-23 08:13:39 +08:00
|
|
|
&s3c_device_ohci,
|
2007-02-17 07:52:37 +08:00
|
|
|
&s3c_device_lcd,
|
|
|
|
&s3c_device_wdt,
|
2008-11-01 00:14:40 +08:00
|
|
|
&s3c_device_i2c0,
|
2007-02-17 07:52:37 +08:00
|
|
|
&s3c_device_iis,
|
|
|
|
&s3c_device_sdi,
|
|
|
|
&s3c_device_usbgadget,
|
|
|
|
&qt2410_spi,
|
|
|
|
&qt2410_cs89x0,
|
|
|
|
&qt2410_led,
|
|
|
|
};
|
|
|
|
|
2009-09-28 18:59:49 +08:00
|
|
|
static struct mtd_partition __initdata qt2410_nand_part[] = {
|
2007-02-17 07:52:37 +08:00
|
|
|
[0] = {
|
|
|
|
.name = "U-Boot",
|
|
|
|
.size = 0x30000,
|
|
|
|
.offset = 0,
|
|
|
|
},
|
|
|
|
[1] = {
|
|
|
|
.name = "U-Boot environment",
|
|
|
|
.offset = 0x30000,
|
|
|
|
.size = 0x4000,
|
|
|
|
},
|
|
|
|
[2] = {
|
|
|
|
.name = "kernel",
|
|
|
|
.offset = 0x34000,
|
|
|
|
.size = SZ_2M,
|
|
|
|
},
|
|
|
|
[3] = {
|
|
|
|
.name = "initrd",
|
|
|
|
.offset = 0x234000,
|
|
|
|
.size = SZ_4M,
|
|
|
|
},
|
|
|
|
[4] = {
|
|
|
|
.name = "jffs2",
|
|
|
|
.offset = 0x634000,
|
|
|
|
.size = 0x39cc000,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2009-09-28 18:59:49 +08:00
|
|
|
static struct s3c2410_nand_set __initdata qt2410_nand_sets[] = {
|
2007-02-17 07:52:37 +08:00
|
|
|
[0] = {
|
|
|
|
.name = "NAND",
|
|
|
|
.nr_chips = 1,
|
|
|
|
.nr_partitions = ARRAY_SIZE(qt2410_nand_part),
|
|
|
|
.partitions = qt2410_nand_part,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
/* choose a set of timings which should suit most 512Mbit
|
|
|
|
* chips and beyond.
|
|
|
|
*/
|
|
|
|
|
2009-09-28 18:59:49 +08:00
|
|
|
static struct s3c2410_platform_nand __initdata qt2410_nand_info = {
|
2007-02-17 07:52:37 +08:00
|
|
|
.tacls = 20,
|
|
|
|
.twrph0 = 60,
|
|
|
|
.twrph1 = 20,
|
|
|
|
.nr_sets = ARRAY_SIZE(qt2410_nand_sets),
|
|
|
|
.sets = qt2410_nand_sets,
|
2016-10-21 05:42:44 +08:00
|
|
|
.ecc_mode = NAND_ECC_SOFT,
|
2007-02-17 07:52:37 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* UDC */
|
|
|
|
|
|
|
|
static struct s3c2410_udc_mach_info qt2410_udc_cfg = {
|
|
|
|
};
|
|
|
|
|
|
|
|
static char tft_type = 's';
|
|
|
|
|
|
|
|
static int __init qt2410_tft_setup(char *str)
|
|
|
|
{
|
|
|
|
tft_type = str[0];
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
__setup("tft=", qt2410_tft_setup);
|
|
|
|
|
|
|
|
static void __init qt2410_map_io(void)
|
|
|
|
{
|
|
|
|
s3c24xx_init_io(qt2410_iodesc, ARRAY_SIZE(qt2410_iodesc));
|
|
|
|
s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
|
2013-01-10 10:47:04 +08:00
|
|
|
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
|
2007-02-17 07:52:37 +08:00
|
|
|
}
|
|
|
|
|
2014-05-09 04:49:29 +08:00
|
|
|
static void __init qt2410_init_time(void)
|
|
|
|
{
|
|
|
|
s3c2410_init_clocks(12000000);
|
|
|
|
samsung_timer_init();
|
|
|
|
}
|
|
|
|
|
2007-02-17 07:52:37 +08:00
|
|
|
static void __init qt2410_machine_init(void)
|
|
|
|
{
|
2009-09-28 18:59:49 +08:00
|
|
|
s3c_nand_set_platdata(&qt2410_nand_info);
|
2007-02-17 07:52:37 +08:00
|
|
|
|
|
|
|
switch (tft_type) {
|
|
|
|
case 'p': /* production */
|
2007-10-16 16:28:56 +08:00
|
|
|
qt2410_fb_info.default_display = 1;
|
2007-02-17 07:52:37 +08:00
|
|
|
break;
|
|
|
|
case 'b': /* big */
|
2007-10-16 16:28:56 +08:00
|
|
|
qt2410_fb_info.default_display = 0;
|
2007-02-17 07:52:37 +08:00
|
|
|
break;
|
|
|
|
case 's': /* small */
|
|
|
|
default:
|
2007-10-16 16:28:56 +08:00
|
|
|
qt2410_fb_info.default_display = 2;
|
2007-02-17 07:52:37 +08:00
|
|
|
break;
|
|
|
|
}
|
2007-10-16 16:28:56 +08:00
|
|
|
s3c24xx_fb_set_platdata(&qt2410_fb_info);
|
2007-02-17 07:52:37 +08:00
|
|
|
|
2012-07-13 17:04:50 +08:00
|
|
|
/* set initial state of the LED GPIO */
|
|
|
|
WARN_ON(gpio_request_one(S3C2410_GPB(0), GPIOF_OUT_INIT_HIGH, NULL));
|
|
|
|
gpio_free(S3C2410_GPB(0));
|
2007-02-17 07:52:37 +08:00
|
|
|
|
|
|
|
s3c24xx_udc_set_platdata(&qt2410_udc_cfg);
|
2008-11-01 00:14:40 +08:00
|
|
|
s3c_i2c0_set_platdata(NULL);
|
2007-02-17 07:52:37 +08:00
|
|
|
|
spi: spi-gpio: Rewrite to use GPIO descriptors
This converts the bit-banged GPIO SPI driver to looking up and
using GPIO descriptors to get a handle on GPIO lines for SCK,
MOSI, MISO and all CS lines.
All existing board files are converted in one go to keep it all
consistent. With these conversions I rarely find any interrim
steps that makes any sense.
Device tree probing and GPIO handling should work like before
also after this patch.
For board files, we stop using controller data to pass the GPIO
line for chip select, instead we pass this as a GPIO descriptor
lookup like everything else.
In some s3c24xx machines the names of the SPI devices were set to
"spi-gpio" rather than "spi_gpio" which can never have worked, I
fixed it working (I guess) as part of this patch set. Sometimes
I wonder how this code got upstream in the first place, it
obviously is not tested.
mach-s3c64xx/mach-smartq.c has the same problem and additionally
defines the *same* GPIO line for MOSI and MISO which is not going
to be accepted by gpiolib. As the lines were number 1,2,2 I assumed
it was a typo and use lines 1,2,3. A comment gives awat that line 0
is chip select though no actual SPI device is provided for the LCD
supposed to be on this bit-banged SPI bus. I left it intact instead
of just deleting the bus though.
Kill off board file code that try to initialize the SPI lines
to the same values that they will later be set by the spi_gpio
driver anyways. Given the huge number of weird things in these
board files I do not think this code is very tested or put in
with much afterthought anyways.
In order to assert that we do not get performance regressions on
this crucial bing-banged driver, a ran a script like this dumping the
Ilitek ILI9322 regmap 10000 times (it has no caching obviously) on
an otherwise idle system in two iterations before and after the
patches:
#!/bin/sh
for run in `seq 10000`
do
cat /debug/regmap/spi0.0/registers > /dev/null
done
Before the patch:
time test.sh
real 3m 41.03s
user 0m 29.41s
sys 3m 7.22s
time test.sh
real 3m 44.24s
user 0m 32.31s
sys 3m 7.60s
After the patch:
time test.sh
real 3m 41.32s
user 0m 28.92s
sys 3m 8.08s
time test.sh
real 3m 39.92s
user 0m 30.20s
sys 3m 5.56s
So any performance differences seems to be in the error margin.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Olof Johansson <olof@lixom.net>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-12 20:45:30 +08:00
|
|
|
gpiod_add_lookup_table(&qt2410_spi_gpiod_table);
|
2007-04-20 18:19:16 +08:00
|
|
|
platform_add_devices(qt2410_devices, ARRAY_SIZE(qt2410_devices));
|
2008-12-12 08:24:18 +08:00
|
|
|
s3c_pm_init();
|
2007-02-17 07:52:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
MACHINE_START(QT2410, "QT2410")
|
2011-07-06 10:38:17 +08:00
|
|
|
.atag_offset = 0x100,
|
2007-02-17 07:52:37 +08:00
|
|
|
.map_io = qt2410_map_io,
|
2013-03-07 11:38:19 +08:00
|
|
|
.init_irq = s3c2410_init_irq,
|
2007-02-17 07:52:37 +08:00
|
|
|
.init_machine = qt2410_machine_init,
|
2014-05-09 04:49:29 +08:00
|
|
|
.init_time = qt2410_init_time,
|
2007-02-17 07:52:37 +08:00
|
|
|
MACHINE_END
|