Hi guys, does any of you have experience with touchscreen controllers?
Subsystems (6)
I'm working with ADS7843 and I have some troubles to get only the push event on the screen.
If any of you knows a better place where to talk about this argument it will be appreciated very much to tell me.
Best regards
Signature · 7 lines
Fabio Giovagnini Aurion s.r.l. P.I e C.F. 00885711200 Tel. +39.051.594.78.24 Cell. +39.335.83.50.919
Quoted 6 lines · Fabio Giovagnini
I'm working with ADS7843 and I have some troubles to get only the push event on the screen.
If any of you knows a better place where to talk about this argument it will be appreciated very much to tell me.Best regards
Hi Fabio,
I've dealt with that chip for our 7760 board. The key is to provide a pen poll function so pen up can be detected. Here's the way I defined it in the platform bsp stuff:
:
:
#include <linux/spi/spi.h>
#include <linux/spi/ads7846.h>
:
:
/* SPI devices - Touch Screen */
static int ads7843_pendown_state(void)
{
return (ctrl_inb(PGDR) & 0x40) ? 0 : 1;
}static struct ads7846_platform_data ads_info = {
.model = 7843,
.x_min = 150,
.x_max = 3830,
.y_min = 190,
.y_max = 3830,
.vref_delay_usecs = 100,
.keep_vref_on = 1,
.x_plate_ohms = 576,
.y_plate_ohms = 366,
.pressure_max = 15000, /* Generally nonsense on the 7843 */
.debounce_max = 1,
.debounce_rep = 0,
.debounce_tol = (~0),
.get_pendown_state = ads7843_pendown_state,
};static struct spi_board_info jcinap_spi_devices[] = {
{
/* Touchscreen controller */
.modalias = "ads7846",
.chip_select = 0,
.bus_num = 0,
.max_speed_hz = 1000000, /* 1Mhz */
.platform_data = &ads_info,
.irq = 11
},
};:
:
In the init code:
:
:
/* Register the SPI devices */ spi_register_board_info(jcinap_spi_devices, ARRAY_SIZE(jcinap_spi_devices)); :
:
Dale Larson
Johnson Controls, Inc
Quoted 6 lines · Fabio Giovagnini
I'm working with ADS7843 and I have some troubles to get only the push event on the screen.
If any of you knows a better place where to talk about this argument it will be appreciated very much to tell me.Best regards
Hi Fabio,
I've dealt with that chip for our 7760 board. The key is to provide a pen poll function so pen up can be detected. Here's the way I defined it in the platform bsp stuff:
:
:
#include <linux/spi/spi.h>
#include <linux/spi/ads7846.h>
:
:
/* SPI devices - Touch Screen */
static int ads7843_pendown_state(void)
{
return (ctrl_inb(PGDR) & 0x40) ? 0 : 1;
}static struct ads7846_platform_data ads_info = {
.model = 7843,
.x_min = 150,
.x_max = 3830,
.y_min = 190,
.y_max = 3830,
.vref_delay_usecs = 100,
.keep_vref_on = 1,
.x_plate_ohms = 576,
.y_plate_ohms = 366,
.pressure_max = 15000, /* Generally nonsense on the 7843 */
.debounce_max = 1,
.debounce_rep = 0,
.debounce_tol = (~0),
.get_pendown_state = ads7843_pendown_state,
};static struct spi_board_info jcinap_spi_devices[] = {
{
/* Touchscreen controller */
.modalias = "ads7846",
.chip_select = 0,
.bus_num = 0,
.max_speed_hz = 1000000, /* 1Mhz */
.platform_data = &ads_info,
.irq = 11
},
};:
:
In the init code:
:
:
/* Register the SPI devices */ spi_register_board_info(jcinap_spi_devices, ARRAY_SIZE(jcinap_spi_devices)); :
:
Dale Larson
Johnson Controls, Inc
Quoted 6 lines · Fabio Giovagnini
I'm working with ADS7843 and I have some troubles to get only the push event on the screen.
If any of you knows a better place where to talk about this argument it will be appreciated very much to tell me.Best regards
Hi Fabio,
I've dealt with that chip for our 7760 board. The key is to provide a pen poll function so pen up can be detected. Here's the way I defined it in the platform bsp stuff:
:
:
#include <linux/spi/spi.h>
#include <linux/spi/ads7846.h>
:
:
/* SPI devices - Touch Screen */
static int ads7843_pendown_state(void)
{
return (ctrl_inb(PGDR) & 0x40) ? 0 : 1;
}static struct ads7846_platform_data ads_info = {
.model = 7843,
.x_min = 150,
.x_max = 3830,
.y_min = 190,
.y_max = 3830,
.vref_delay_usecs = 100,
.keep_vref_on = 1,
.x_plate_ohms = 576,
.y_plate_ohms = 366,
.pressure_max = 15000, /* Generally nonsense on the 7843 */
.debounce_max = 1,
.debounce_rep = 0,
.debounce_tol = (~0),
.get_pendown_state = ads7843_pendown_state,
};static struct spi_board_info jcinap_spi_devices[] = {
{
/* Touchscreen controller */
.modalias = "ads7846",
.chip_select = 0,
.bus_num = 0,
.max_speed_hz = 1000000, /* 1Mhz */
.platform_data = &ads_info,
.irq = 11
},
};:
:
In the init code:
:
:
/* Register the SPI devices */ spi_register_board_info(jcinap_spi_devices, ARRAY_SIZE(jcinap_spi_devices)); :
:
Dale Larson
Johnson Controls, Inc
Hi Dale,
maybe I need to be more clear about my condition.
1) I connected the ads7843 to general I/O ports because the SPIs available on sh2a7203 have been be used for other functions;
2) My real problem is the following: I wrote an ADS7843 device driver as a button driver of the input subsystem. I configured the ads7843 with INT enabled; so when the touch is pressed I have a burst of IRQ. The IRQ handler read the ads7843 and return to the input subsystem the abs values of the touchscreen.
The user program open the file /dev/input/event0 and with the select waits for data; what I see is: during all the time I have a finger on the touch only IRQ handler is exeuted and no action is done in the user program. I tried also opening /dev/input/event0 with O_NONBLOCK flag but nothing changes.
Did you use the ads7843 with INT enabled or not? And if yes, using the falling edge or the low level?
Thanks
In data domenica 25 aprile 2010 04:26:51, Dale Larson ha scritto:
Quoted 76 lines · : > Fabio Giovagnini wrote:
Quoted 6 lines
I'm working with ADS7843 and I have some troubles to get only the push event on the screen.
If any of you knows a better place where to talk about this argument it will be appreciated very much to tell me.Best regards
Hi Fabio,
I've dealt with that chip for our 7760 board. The key is to provide a pen poll function so pen up can be detected. Here's the way I defined it in the platform bsp stuff:
#include <
linux/spi/spi.h>
#include <linux/spi/ads7846.h>/* SPI devices - Touch Screen */
static int
ads7843_pendown_state(void){ return (ctrl_inb(PGDR) & 0x40) ? 0 : 1; }static struct ads7846_platform_data ads_info = { .model = 7843, .x_min = 150, .x_max = 3830, .y_min = 190, .y_max = 3830, .vref_delay_usecs = 100, .keep_vref_on = 1, .x_plate_ohms = 576, .y_plate_ohms = 366, .pressure_max = 15000, /* Generally nonsense on the 7843 */ .debounce_max = 1, .debounce_rep = 0, .debounce_tol = (~0), .get_pendown_state = ads7843_pendown_state, };static struct spi_board_info jcinap_spi_devices[] = { { /* Touchscreen controller */ .modalias = "ads7846", .chip_select = 0, .bus_num = 0, .max_speed_hz = 1000000, /* 1Mhz */ .platform_data = &ads_info, .irq = 11 }, };In the init code:
/* Register the SPI devices */
spi_register_board_info(jcinap_spi_devices,
ARRAY_SIZE(jcinap_spi_devices));Dale Larson
Johnson Controls, Inc--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 7 lines
Fabio Giovagnini Aurion s.r.l. P.I e C.F. 00885711200 Tel. +39.051.594.78.24 Cell. +39.335.83.50.919
In data domenica 25 aprile 2010 04:26:51, Dale Larson ha scritto:
Quoted 19 lines · : > Fabio Giovagnini wrote:
Quoted 6 lines
I'm working with ADS7843 and I have some troubles to get only the push event on the screen.
If any of you knows a better place where to talk about this argument it will be appreciated very much to tell me.Best regards
Hi Fabio,
I've dealt with that chip for our 7760 board. The key is to provide a pen poll function so pen up can be detected. Here's the way I defined it in the platform bsp stuff:
#include <
linux/spi/spi.h>
#include <linux/spi/ads7846.h>
Quoted 6 lines
/* SPI devices - Touch Screen */
static int
ads7843_pendown_state(void){ return (ctrl_inb(PGDR) & 0x40) ? 0 : 1; }
Is this the pin where is connected the INT line of the ADS7843?
Thanks
Quoted 51 lines
static struct ads7846_platform_data ads_info = { .model = 7843, .x_min = 150, .x_max = 3830, .y_min = 190, .y_max = 3830, .vref_delay_usecs = 100, .keep_vref_on = 1, .x_plate_ohms = 576, .y_plate_ohms = 366, .pressure_max = 15000, /* Generally nonsense on the 7843 */ .debounce_max = 1, .debounce_rep = 0, .debounce_tol = (~0), .get_pendown_state = ads7843_pendown_state, };static struct spi_board_info jcinap_spi_devices[] = { { /* Touchscreen controller */ .modalias = "ads7846", .chip_select = 0, .bus_num = 0, .max_speed_hz = 1000000, /* 1Mhz */ .platform_data = &ads_info, .irq = 11 }, };In the init code:
/* Register the SPI devices */
spi_register_board_info(jcinap_spi_devices,
ARRAY_SIZE(jcinap_spi_devices));Dale Larson
Johnson Controls, Inc--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 7 lines
Fabio Giovagnini Aurion s.r.l. P.I e C.F. 00885711200 Tel. +39.051.594.78.24 Cell. +39.335.83.50.919
hi fabio,
Quoted 4 lines · Fabio Giovagnini
Hi Dale,
maybe I need to be more clear about my condition.
1) I connected the ads7843 to general I/O ports because the SPIs available on sh2a7203 have been be used for other functions;
It is not a big problem, you can also bitbang on the gpio pin.
Quoted 5 lines
2) My real problem is the following: I wrote an ADS7843 device driver as a button driver of the input subsystem. I configured the ads7843 with INT enabled; so when the touch is pressed I have a burst of IRQ. The IRQ handler read the ads7843 and return to the input subsystem the abs values of the touchscreen.
I think tha rewrite the code it is not so usefull but reuse the code using a bitbang interface
it's more simple and don't need a lot of testing
Michael Trimarchi
Thanks a lot.
But where is a good example for starting from?
Thanks
In data lunedì 26 aprile 2010 12:41:13, Michael Trimarchi ha scritto:
: > hi fabio,
Quoted 21 lines
Quoted 4 lines · Fabio Giovagnini
Hi Dale,
maybe I need to be more clear about my condition.
1) I connected the ads7843 to general I/O ports because the SPIs available on sh2a7203 have been be used for other functions;It is not a big problem, you can also bitbang on the gpio pin.
Quoted 5 lines
2) My real problem is the following: I wrote an ADS7843 device driver as a button driver of the input subsystem. I configured the ads7843 with INT enabled; so when the touch is pressed I have a burst of IRQ. The IRQ handler read the ads7843 and return to the input subsystem the abs values of the touchscreen.
I think tha rewrite the code it is not so usefull but reuse the code using a bitbang interface
it's more simple and don't need a lot of testingMichael Trimarchi
Signature · 7 lines
Fabio Giovagnini Aurion s.r.l. P.I e C.F. 00885711200 Tel. +39.051.594.78.24 Cell. +39.335.83.50.919
Hi
Quoted 5 lines · Fabio Giovagnini
Thanks a lot.
But where is a good example for starting from?Thanks
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&ty646
You can find here an example :)
Michael
Quoted 30 lines
In data lunedì 26 aprile 2010 12:41:13, Michael Trimarchi ha scritto:
: > hi fabio,Quoted 23 lines
Quoted 5 lines · Fabio Giovagnini
Hi Dale,
maybe I need to be more clear about my condition.
1) I connected the ads7843 to general I/O ports because the SPIs available on sh2a7203 have been be used for other functions;It is not a big problem, you can also bitbang on the gpio pin.
Quoted 6 lines
2) My real problem is the following: I wrote an ADS7843 device driver as a button driver of the input subsystem. I configured the ads7843 with INT enabled; so when the touch is pressed I have a burst of IRQ. The IRQ handler read the ads7843 and return to the input subsystem the abs values of the touchscreen.
I think tha rewrite the code it is not so usefull but reuse the code using a bitbang interface
it's more simple and don't need a lot of testingMichael Trimarchi
Quoted 1 line · Fabio Giovagnini
Hi Dale,
Hi Fabio,
Sorry for the delay in responding. I was at the ESC conference this week.
Quoted 3 lines
maybe I need to be more clear about my condition.
1) I connected the ads7843 to general I/O ports because the SPIs available on sh2a7203 have been be used for other functions;
2) My real problem is the following: I wrote an ADS7843 device driver as a button driver of the input subsystem. I configured the ads7843 with INT
You wrote the driver? I just used the existing one in the 2.6.28.2 kernel.
Quoted 1 line
enabled; so when the touch is pressed I have a burst of IRQ. The IRQ handler read the ads7843 and return to the input subsystem the abs values of the touchscreen.
I seem to recall you need disable the interrupt upon #PENIRQ and allow the polling code to do the job of determining the pen up event.
Quoted 1 line
The user program open the file
/dev/input/event0and with the select waits for data; what I see is: during all the time I have a finger on the touch only IRQ handler is exeuted and no action is done in the user program. I tried also opening/dev/input/event0withO_NONBLOCKflag but nothing changes.
The existing driver uses the event system. The easiest way to see what I did is to unpack a 2.6.28.2 linux tarball and apply the patch I've attached to this post.
Dale Larson
Johnson Controls, Inc
arch/sh/boards/board-jcinap7760.c +554 -0
@@ -0,0 +1,554 @@ +/* +* Johnson Controls NAP7760 (N40) Board Support +* (Based on Renesas Europe EDOSK7760 Board Support) +* +* Copyright (C) 2008 SPES Societa' Progettazione Elettronica e Software Ltd. +* Author: Luca Santini <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +#include <linux/init.h> +#include <linux/types.h> +#include <linux/platform_device.h> +#include <linux/smc91x.h> +#include <linux/interrupt.h> +//#include <linux/gpio.h> +#include <linux/i2c.h> +#include <linux/mtd/physmap.h> +#include <linux/serial_8250.h> +#include <linux/leds.h> +#include <linux/i2c/pca953x.h> +#include <linux/spi/spi.h> +#include <linux/spi/ads7846.h> +#include <asm/spi.h> +#include <asm/machvec.h> +#include <asm/io.h> +#include <asm/addrspace.h> +#include <asm/delay.h> +#include <asm/i2c-sh7760.h> +#include <asm/sizes.h> +#include <linux/fb.h> +#include <asm/sh7760fb.h> + +#define SMC_IOADDR 0x10000300 +#define SMC_IRQ 2/* IRL0# on JCI NAP */ + +#define DUART_A_IOADDR 0x18000008 +#define DUART_A_IRQ 5/* IRL2# on JCI NAP */ + +#define DUART_B_IOADDR 0x18000000 +#define DUART_B_IRQ 8/* IRL1# on JCI NAP */ + +#define IPSELR 0xFE400034 + +#define PBCR 0xFE400004 +#define PCCR 0xFE400008 +#define PDCR 0xFE40000C +#define PECR 0xFE400010 +#define PFCR 0xFE400014 +#define PGCR 0xFE400018 + +#define PBDR 0xFE400044 +#define PGDR 0xFE400058 + +#define PTB5 0x20 + +#define DMARSRA 0xFE090000 +#define DMARSRB 0xFE090004 +#define DMATCR0 0xFFA00008 +#define DMAOR 0xFFA00040 + +#define BKLIGHT_MASK 0x20/* Pin assigned to backlight */ +#define BKLIGHT_CTRL_MASK 0x0C00/* Control bits for backlight pin */ +#define BKLIGHT_CTRL_VALUE 0x0400/* Set pin to output mode */ +#define IPSELR_LCDC_MASK 0x0203 + +/* NOR flash */ +static struct mtd_partition jcinap7760_nor_flash_partitions[] = { + { + .name ="bootloader" , + .offset =0 , + .size =512 *1024 , + .mask_flags =MTD_WRITEABLE ,/* Read-only */ + }, { + .name ="turboboot" , + .offset =MTDPART_OFS_APPEND , + .size =6 *256 *1024 ,/* Six more blocks for linux kernel */ + }, { + .name ="linux" , + .offset =MTDPART_OFS_APPEND , + .size =4 *1024 *1024 ,/* 4 MB for linux kernel */ + }, { + .name ="jffs2" , + .offset =MTDPART_OFS_APPEND , + .size =110 *1024 *1024 ,/* JFFS2 is 110MB for now */ + }, { + .name ="tbparttbl" , + .offset =MTDPART_OFS_APPEND , + .size =MTDPART_SIZ_FULL , + .mask_flags =MTD_WRITEABLE ,/* Read-only */ + }, +}; + +static struct physmap_flash_data jcinap7760_nor_flash_data = { + .width =4 , + .parts = jcinap7760_nor_flash_partitions, + .nr_parts =ARRAY_SIZE (jcinap7760_nor_flash_partitions), +}; + +static struct resource jcinap7760_nor_flash_resources[] = { + [0 ] = { + .name ="NAP-NOR-Flash" , + .start =0x00000000 , + .end =0x00000000 +SZ_128M -1 , + .flags =IORESOURCE_MEM , + } +}; + +static struct platform_device jcinap7760_nor_flash_device = { + .name ="physmap-flash" , + .resource = jcinap7760_nor_flash_resources, + .num_resources =ARRAY_SIZE (jcinap7760_nor_flash_resources), + .dev = { + .platform_data = &jcinap7760_nor_flash_data, + }, +}; + +/* i2c initialization functions */ +static struct sh7760_i2c_platdata i2c_pd = { + .speed_khz =400 , +}; + +static struct resource sh7760_i2c1_res[] = { + { + .start =SH7760_I2C1_MMIO , + .end =SH7760_I2C1_MMIOEND , + .flags =IORESOURCE_MEM , + },{ + .start =SH7760_I2C1_IRQ , + .end =SH7760_I2C1_IRQ , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct platform_device sh7760_i2c1_dev = { + .dev = { + .platform_data = &i2c_pd, + }, + + .name =SH7760_I2C_DEVNAME , + .id =1 , + .resource = sh7760_i2c1_res, + .num_resources =ARRAY_SIZE (sh7760_i2c1_res), +}; + +static struct resource sh7760_i2c0_res[] = { + { + .start =SH7760_I2C0_MMIO , + .end =SH7760_I2C0_MMIOEND , + .flags =IORESOURCE_MEM , + }, { + .start =SH7760_I2C0_IRQ , + .end =SH7760_I2C0_IRQ , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct platform_device sh7760_i2c0_dev = { + .dev = { + .platform_data = &i2c_pd, + }, + .name =SH7760_I2C_DEVNAME , + .id =0 , + .resource = sh7760_i2c0_res, + .num_resources =ARRAY_SIZE (sh7760_i2c0_res), +}; + +static struct led_info jcinap7760_led_info[] = { + { .name ="peer_com" }, + { .name ="run" }, + { .name ="gen_fault" }, + { .name ="bat_fault" }, + { .name ="eth_10" }, + { .name ="bat_chg_n" },/* Used as binary (low active) output */ + { .name ="bat_load_n" },/* Used as binary (low active) output */ + { .name ="bo_on_n" },/* Used as binary (low active) output */ +}; + +static struct led_platform_data jcinap7760_led_platform_data = { + .num_leds =8 , + .leds = jcinap7760_led_info, +}; + +static struct i2c_board_info __initdata sh7760_i2c0_devices[] = { + { +I2C_BOARD_INFO ("pca9551" ,0x60 ),/* Use 7-bit addresses */ + .platform_data = &jcinap7760_led_platform_data, + }, +}; + +static struct pca953x_platform_data jcinap_ccs_gpio_pdata = { + .gpio_base =0 , +}; + +static struct i2c_board_info __initdata sh7760_ccs_i2c0_devices[] = { + { +I2C_BOARD_INFO ("pca9539" ,0x77 ),/* Use 7-bit addresses */ + .platform_data = &jcinap_ccs_gpio_pdata, + }, +}; + +static struct i2c_board_info __initdata sh7760_i2c1_devices[] = { + { +I2C_BOARD_INFO ("rx8581" ,0x51 ),/* Use 7-bit addresses */ + }, +}; + +/* Ethernet initialization functions */ + +static struct smc91x_platdata smc91x_info = { + .flags =SMC91X_USE_16BIT |SMC91X_IO_SHIFT_0 |IORESOURCE_IRQ_LOWLEVEL , +}; + +static struct resource smc91x_res[] = { + [0 ] = { + .start =SMC_IOADDR , + .end =SMC_IOADDR +SZ_32 -1 , + .flags =IORESOURCE_MEM , + }, + [1 ] = { + .start =SMC_IRQ , + .end =SMC_IRQ , + .flags =IORESOURCE_IRQ , + } +}; + +static struct platform_device smc91x_dev = { + .name ="smc91x" , + .id =-1 , + .num_resources =ARRAY_SIZE (smc91x_res), + .resource = smc91x_res, + + .dev = { + .platform_data = &smc91x_info, + }, +}; + +/* DUART */ +static struct plat_serial8250_port serial_platform_data[] = { + { + .mapbase =DUART_A_IOADDR , + .irq =DUART_A_IRQ , + .uartclk =3686400 , + .regshift =0 , + .iotype =UPIO_MEM , + .flags =UPF_BOOT_AUTOCONF |UPF_IOREMAP |UPF_SKIP_TEST , + }, + { + .mapbase =DUART_B_IOADDR , + .irq =DUART_B_IRQ , + .uartclk =3686400 , + .regshift =0 , + .iotype =UPIO_MEM , + .flags =UPF_BOOT_AUTOCONF |UPF_IOREMAP |UPF_SKIP_TEST , + }, + { }, +}; + +static struct platform_device serial_devices = { + .name ="serial8250" , + .id =PLAT8250_DEV_PLATFORM , + .dev = { + .platform_data = serial_platform_data, + }, +}; + +/* SH7760 LCDC */ +static struct resource sh7760_fb_resources[] = { + [0 ] = { + .start =0xFE300800 , + .end =0xFE300CFF , + .flags =IORESOURCE_MEM , + }, + [1 ] = { + .start =65 , + .end =65 , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct fb_videomode sh7760_fb_videomode = { + .name ="XVGA Monitor" , + .xres =800 , + .yres =480 , + .pixclock =30066 ,/* pico seconds */ + .left_margin =288 , + .right_margin =64 , + .upper_margin =33 , + .lower_margin =4 , + .hsync_len =88 , + .vsync_len =6 , + .sync =FB_SYNC_HOR_HIGH_ACT |FB_SYNC_VERT_HIGH_ACT , + .vmode =FB_VMODE_NONINTERLACED , + .flag =0 , +}; + +static struct sh7760fb_platdata sh7760_fb_def_pdata = { + .def_mode = &sh7760_fb_videomode, + .ldickr =0x1111 , + .ldmtr =0xC42B ,/* was...(LDMTR_TFT_COLOR_16|LDMTR_MCNT),*/ + .lddfr =LDDFR_8BPP , + .ldpmmr =0x0070 , + .ldpspr =0xF66F , + .ldaclnr =0x000C , + .rotate =0 , + .novsync =1 , + .blank =NULL , +}; + +static struct platform_device sh7760_fb_device = { + .name ="sh7760-lcdc" , + .resource = sh7760_fb_resources, + .num_resources =ARRAY_SIZE (sh7760_fb_resources), + .dev = { + .platform_data = &sh7760_fb_def_pdata, + }, +}; + +/* USB Host Controller */ +static struct resource usb_host_resources[] = { + [0 ] = { + .start =0xfe340000 , + .end =0xfe342fff , + .flags =IORESOURCE_MEM , + }, + [1 ] = { + .start =64 , + .end =64 , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct platform_device usb_host_device = { + .name ="sh_ohci" , + .id =-1 , + .num_resources =ARRAY_SIZE (usb_host_resources), + .resource = usb_host_resources, +}; + +/* SPI devices - Touch Screen (CCS only) */ + +static int ads7843_pendown_state (void ) +{ +return (ctrl_inb (PGDR ) &0x40 ) ?0 :1 ; +} + +static struct ads7846_platform_data ads_info = { + .model =7843 , + .x_min =150 , + .x_max =3830 , + .y_min =190 , + .y_max =3830 , + .vref_delay_usecs =100 , + .keep_vref_on =1 ,/* To match CCS WinCE impl. */ + .x_plate_ohms =576 , + .y_plate_ohms =366 , + .pressure_max =15000 ,/* Generally nonsense on the 7843 */ + .debounce_max =1 , + .debounce_rep =0 , + .debounce_tol = (~0 ), + .get_pendown_state = ads7843_pendown_state, +}; + +static struct spi_board_info jcinap_spi_devices[] = { + { +/* Touchscreen controller */ + .modalias ="ads7846" , + .chip_select =0 , + .bus_num =0 , + .max_speed_hz =1000000 ,/* 1Mhz */ + .platform_data = &ads_info, + .irq =11 + }, +}; + +/* SPI Interface */ + +static struct resource spi_res[] = { + [0 ] = { + .start =0xFE180000 , + .end =0xFE180013 , + .flags =IORESOURCE_MEM , + }, + [1 ] = { + .start =84 , + .end =84 , + .flags =IORESOURCE_IRQ , + } +}; + +static struct platform_device spi_dev = { + .name ="spi_hspi" , + .id =0 , + .num_resources =ARRAY_SIZE (spi_res), + .resource = spi_res, +}; + +/* Platform init code */ +static struct platform_device *jcinap7760_devices[]__initdata = { + &serial_devices, + &smc91x_dev, + &jcinap7760_nor_flash_device, + &usb_host_device, +}; + +static struct platform_device *jcinap7760_ccs_devices[]__initdata = { + &serial_devices, + &spi_dev, + &smc91x_dev, + &jcinap7760_nor_flash_device, + &usb_host_device, + &sh7760_fb_device, +}; + + +/* NAP's watchdog control option */ +static int jciwatchdog =1 ;// On by default +static int __init jciwatchdogoff (char *str) { + jciwatchdog =0 ; +return 0 ; +} + +early_param ("jciwatchdogoff" , jciwatchdogoff); + +/* Identify NAP CCS variation. */ + +#define NAP_FACTORY_DATA_ADDRESS (0xA0080000 - 1)/* accessing via in P2 region */ + +typedef struct _NAP_FACTORY_DATA { +u8 MinorVer;/* Minor Version */ +u8 MajorVer;/* Major Version */ + +union { +struct { +u16 Day :5 ;/* 4:0 Day of Month. */ +u16 Month :4 ;/* 8:5 Month of Year */ +u16 Year :7 ;/* 15:9 Year */ + }; +u16 wDate; + }; + +u8 MAC[6 ];/* MAC Address */ +u8 ProductCode[32 ];/* Product Codes */ +u16 wBattDeltaRes;/* Battery Delta Resolution */ +u16 wBattDeltaOff;/* Battery Delta Offset */ +u16 wBattVoltRes;/* Battery Volt Resolution */ +u16 wBattVoltOff;/* Battery Volt Offset */ +}NAP_FACTORY_DATA ; + +static int __init is_ccs_nap (void ) +{ +NAP_FACTORY_DATA * fdata_ptr; +u8 * ptr = (u8 *)NAP_FACTORY_DATA_ADDRESS -1 ; + +if (memcmp (ptr,"JC" ,2 ) ==0 ) { + ptr -=2 ; +/* Subtract offset from offset's addr to get factory data structure address */ + ptr = ptr - *(u16 *)(ptr); + fdata_ptr = (NAP_FACTORY_DATA *)ptr; +return memcmp (fdata_ptr->ProductCode,"YK" ,2 ) ==0 ||memcmp (fdata_ptr->ProductCode,"LC" ,2 ) ==0 ; + } +else +return 0 ; +} + +/**** Platform device initialization. *****/ + +static int __init init_jcinap7760_devices (void ) +{ +int is_ccs =is_ccs_nap (); + +if (is_ccs) { +/* Enable LCDC function pins */ +ctrl_outw (0 ,PCCR ); +ctrl_outw (0 ,PDCR ); +ctrl_outw (0 ,PECR ); +ctrl_outw (ctrl_inw (IPSELR ) & ~IPSELR_LCDC_MASK ,IPSELR ); + +/* Set up DMA for the LCDC */ +ctrl_outl (0x94808080 ,DMARSRA ); +ctrl_outl (0x80808080 ,DMARSRB ); +ctrl_outl (0 ,DMATCR0 ); +ctrl_outl (0x0000C001 ,DMAOR );/* DMABRG | DME */ + +/* Set up and (for now) turn on the LCD backlight. */ +if ((ctrl_inw (PGCR ) &BKLIGHT_CTRL_MASK ) !=BKLIGHT_CTRL_VALUE ) { +/* We don't mess with PFC for GPIO G if it has already been initialized properly */ +ctrl_outw ((ctrl_inw (PGCR ) & ~BKLIGHT_CTRL_MASK ) |BKLIGHT_CTRL_VALUE ,PGCR ); + } +/* Turn on the LCD backlight TODO: Hook into standard Linux backlight control */ +ctrl_outb (ctrl_inb (PGDR ) |BKLIGHT_MASK ,PGDR ); + +/* Enable Pen input GPIO PTG6 */ +ctrl_outw (ctrl_inw (PGCR ) |0x3000 ,PGCR ); + +/* Register the SPI devices */ +spi_register_board_info (jcinap_spi_devices,ARRAY_SIZE (jcinap_spi_devices)); + +/* Now set up the our board's other devices. */ +platform_add_devices (jcinap7760_ccs_devices,ARRAY_SIZE (jcinap7760_ccs_devices)); + } +else { +/* Now set up the our board's other devices. */ +platform_add_devices (jcinap7760_devices,ARRAY_SIZE (jcinap7760_devices)); + } + +/* I2C Based devices are last. */ +if (is_ccs) +i2c_register_board_info (0 , sh7760_ccs_i2c0_devices,ARRAY_SIZE (sh7760_ccs_i2c0_devices)); +else +i2c_register_board_info (0 , sh7760_i2c0_devices,ARRAY_SIZE (sh7760_i2c0_devices)); + +platform_device_register (&sh7760_i2c0_dev); + +i2c_register_board_info (1 , sh7760_i2c1_devices,ARRAY_SIZE (sh7760_i2c1_devices)); +platform_device_register (&sh7760_i2c1_dev); + +return 0 ; +} +__initcall (init_jcinap7760_devices); + +static void __init init_jcinap7760_irqs (void ) +{ +plat_irq_setup_pins (IRQ_MODE_IRQ ); +if (jciwatchdog) { +/* Enable PORTB Bit 5 as output and drive high. Timer interrupt toggles bit. */ +ctrl_outb (ctrl_inb (PBDR ) |PTB5 ,PBDR );// First set as high +ctrl_outw ((ctrl_inw (PBCR ) &0xF3FF ) |0x0400 ,PBCR ); + } +else { +/* Cobra's watchdog defeat is wired so ensure PORTB bit 5 is an input. */ +ctrl_outw ((ctrl_inw (PBCR ) &0xF3FF ) |0x0800 ,PBCR ); + } +} + +/* +* The Machine Vector +*/ +struct sh_machine_vector mv_jcinap7760 __initmv = { + .mv_name ="JCINAP7760" , + .mv_nr_irqs =128 , + .mv_init_irq = &init_jcinap7760_irqs, +};
arch/sh/boards/Kconfig +6 -0
@@ -194,6 +194,12 @@ Select if configuring for a Renesas EDOSK7760 evaluation board. +config SH_JCINAP7760 + bool "JCINAP7760" + depends on CPU_SUBTYPE_SH7760 + help + Select if configuring for a Johnson Controls NAP (SH7760) N40 Platform. + config SH_SH4202_MICRODEV bool "SH4-202 MicroDev" depends on CPU_SUBTYPE_SH4_202
arch/sh/boards/Makefile +1 -0
@@ -7,3 +7,4 @@ obj-$(CONFIG_SH_SH7785LCR) += board-sh7785lcr.o obj-$(CONFIG_SH_SHMIN) += board-shmin.o obj-$(CONFIG_SH_EDOSK7760) += board-edosk7760.o +obj-$(CONFIG_SH_JCINAP7760) += board-jcinap7760.o
arch/sh/boot/compressed/head_32.S +10 -1
@@ -80,6 +80,12 @@ jsr @r0 nop +#ifdef CONFIG_SH_JCINAP7760 + /* Copy the TurboBoot kernel parameters to actual kernel address. */ + mov.l copy_turboboot_kernel_parameters_addr, r0 + jsr @r0 + nop +#endif /* Jump to the start of the decompressed kernel */ mov.l kernel_start_addr, r0 jmp @r0
@@ -98,7 +104,10 @@ .long decompress_kernel kernel_start_addr: .long _text+PAGE_SIZE - +#ifdef CONFIG_SH_JCINAP7760 +copy_turboboot_kernel_parameters_addr: + .long copy_turboboot_kernel_parameters +#endif .align 9 fake_headers_as_bzImage: .word 0
arch/sh/boot/compressed/misc_32.c +116 -17
179 lines not on this page · raw message
arch/sh/configs/jcinap7760_defconfig +1332 -0
1,332 lines not on this page · raw message
arch/sh/include/asm/serial.h +5 -0
@@ -7,6 +7,10 @@#ifndef _ASM_SERIAL_H#define _ASM_SERIAL_H +#ifdef CONFIG_SH_JCINAP7760 +/* This is the crystal frequency of the Cobra board's DUART */ +#define BASE_BAUD ( 3686400 / 16 ) +#else /* * This assumes you have a 1.8432 MHz clock for your UART. *
@@ -15,5 +19,6 @@* megabits/second; but this requires the faster clock. */ #define BASE_BAUD ( 1843200 / 16 ) +#endif #endif /* _ASM_SERIAL_H */
arch/sh/Kconfig +1 -0
@@ -299,6 +299,7 @@ config CPU_SUBTYPE_SH7760 bool "Support SH7760 processor" select CPU_SH4 +# select ARCH_REQUIRE_GPIOLIB config CPU_SUBTYPE_SH4_202 bool "Support SH4-202 processor"
arch/sh/kernel/cpu/sh4/softfloat.c +21 -21
54 lines not on this page · raw message
arch/sh/kernel/Makefile_32 +4 -0
@@ -23,6 +23,10 @@ obj-$(CONFIG_STACKTRACE) += stacktrace.o obj-$(CONFIG_IO_TRAPPED) += io_trapped.o obj-$(CONFIG_KPROBES) += kprobes.o + +ifneq ($(CONFIG_SH_JCINAP7760),y) obj-$(CONFIG_GENERIC_GPIO) += gpio.o +endif EXTRA_CFLAGS += -Werror +
arch/sh/kernel/timers/timer-tmu.c +10 -0
@@ -146,6 +146,16 @@_tmu_clear_status (TMU0 );_tmu_set_irq (TMU0 ,tmu0_clockevent.mode !=CLOCK_EVT_MODE_ONESHOT ); +#ifdef CONFIG_SH_JCINAP7760 +#define PBCR 0xFE400004 +#define PBDR 0xFE400044 +#define PTB5 0x20 +/* Check if the Cobra watchdog bit is set as an output. If not don't toggle the line. */ +if ((ctrl_inw (PBCR ) &0x0C00 ) ==0x0400 ) { +ctrl_outb (ctrl_inb (PBDR ) ^PTB5 ,PBDR );/* Toggle watchdog bit. */ + } +#endif + evt->event_handler (evt);return IRQ_HANDLED ;
arch/sh/tools/mach-types +1 -0
@@ -30,6 +30,7 @@ SNAPGEAR SH_SECUREEDGE5410 EDOSK7705 SH_EDOSK7705 EDOSK7760 SH_EDOSK7760 +JCINAP7760 SH_JCINAP7760 SH4202_MICRODEV SH_SH4202_MICRODEV SH03 SH_SH03 LANDISK SH_LANDISK
drivers/input/touchscreen/ads7846.c +2 -2
@@ -29,7 +29,7 @@#include <linux/spi/ads7846.h> #include <asm/irq.h> - +#define VERBOSE 1/* DLL20090427 */ /* * This code has been heavily tested on a Nokia 770, and lightly * tested on other ads7846 devices (OSK/Mistral, Lubbock).
@@ -953,7 +953,7 @@ input_dev->phys = ts->phys; input_dev->dev.parent = &spi->dev; - input_dev->evbit[0 ] =BIT_MASK (EV_KEY ) |BIT_MASK (EV_ABS ); + input_dev->evbit[0 ] =BIT_MASK (EV_KEY ) |BIT_MASK (EV_ABS ) |BIT_MASK (EV_SYN ); input_dev->keybit[BIT_WORD (BTN_TOUCH )] =BIT_MASK (BTN_TOUCH ); input_set_abs_params(input_dev, ABS_X, pdata->x_min ? : 0,
drivers/spi/Kconfig +8 -0
@@ -100,6 +100,14 @@ inexpensive battery powered microcontroller evaluation board. This same cable can be used to flash new firmware. +config SPI_HSPI + tristate "SuperH on-chip HSPI controller" + depends on SPI_MASTER && SUPERH + select SPI_BITBANG + help + Driver for the Hitachi HSPI controller core found on various + SuperH processors. + config SPI_IMX tristate "Freescale iMX SPI controller" depends on ARCH_IMX && EXPERIMENTAL
drivers/spi/Makefile +1 -0
@@ -29,6 +29,7 @@ obj-$(CONFIG_SPI_TXX9) += spi_txx9.o obj-$(CONFIG_SPI_XILINX) += xilinx_spi.o obj-$(CONFIG_SPI_SH_SCI) += spi_sh_sci.o +obj-$(CONFIG_SPI_HSPI) += spi_hspi.o # ... add above this line ... # SPI protocol drivers (device/link on bus)
drivers/spi/spi_hspi.c +434 -0
434 lines not on this page · raw message
drivers/usb/host/ohci-hcd.c +1 -0
@@ -1049,6 +1049,7 @@#if defined(CONFIG_CPU_SUBTYPE_SH7720 ) || \ defined(CONFIG_CPU_SUBTYPE_SH7721 ) || \ + defined(CONFIG_CPU_SUBTYPE_SH7760 ) || \ defined(CONFIG_CPU_SUBTYPE_SH7763 )#include "ohci-sh.c" #define PLATFORM_DRIVER ohci_hcd_sh_driver
drivers/usb/host/ohci-sh.c +9 -1
@@ -26,6 +26,11 @@ {struct ohci_hcd *ohci =hcd_to_ohci (hcd); +#ifdef CONFIG_CPU_SUBTYPE_SH7760 +dma_declare_coherent_memory (hcd->self.controller, (dma_addr_t )0xfe341000 , + (dma_addr_t )0x0 ,0x2000 ,DMA_MEMORY_MAP |DMA_MEMORY_EXCLUSIVE ); +#endif +ohci_hcd_init (ohci);ohci_init (ohci);ohci_run (ohci);
@@ -42,8 +47,11 @@* generic hardware linkage */ .irq = ohci_irq, +#ifndef CONFIG_CPU_SUBTYPE_SH7760 .flags = HCD_USB11 | HCD_MEMORY, - +#else + .flags = HCD_USB11 | HCD_MEMORY | HCD_LOCAL_MEM, +#endif /* * basic lifecycle operations */
drivers/usb/Kconfig +1 -0
@@ -46,6 +46,7 @@ # SH: default y if CPU_SUBTYPE_SH7720 default y if CPU_SUBTYPE_SH7721 + default y if CPU_SUBTYPE_SH7760 default y if CPU_SUBTYPE_SH7763 # more: default PCI
drivers/video/sh7760fb.c +49 -2
74 lines not on this page · raw message
include/asm-sh/spi_hspi.h +13 -0
@@ -0,0 +1,13 @@ +/* +* platform data for spi_hspi driver. +*/ + +#ifndef _SPI_HSPI_H_ +#define _SPI_HSPI_H_ + +struct hspi_platdata { +int num_cs; +void (*set_cs)(struct hspi_platdata *pd,int cs,int pol); +}; + +#endif
Hi Dale,
for this application I need neccessarly to deliver ASAP, I'm using linux 2.6.17; so I do not have al lot of stuff present into the newer ones. I''ll migrate to state of art as soon as I deliver this application and I'll start teh new one.
I wrote a simple driver that works pritty much good
Thanks a lot
In data sabato 01 maggio 2010 16:45:03, Dale ha scritto:
Quoted 34 lines · : > Fabio Giovagnini wrote:
Quoted 1 line
Hi Dale,
Hi Fabio,
Sorry for the delay in responding. I was at the ESC conference this week.
Quoted 5 lines
maybe I need to be more clear about my condition.
1) I connected the ads7843 to general I/O ports because the SPIs available on sh2a7203 have been be used for other functions;
2) My real problem is the following: I wrote an ADS7843 device driver as a button driver of the input subsystem. I configured the ads7843 with INTYou wrote the driver? I just used the existing one in the 2.6.28.2 kernel.
Quoted 3 lines
enabled; so when the touch is pressed I have a burst of IRQ. The IRQ handler read the ads7843 and return to the input subsystem the abs values of the touchscreen.
I seem to recall you need disable the interrupt upon #PENIRQ and allow the polling code to do the job of determining the pen up event.
Quoted 5 lines
The user program open the file
/dev/input/event0and with the select waits for data; what I see is: during all the time I have a finger on the touch only IRQ handler is exeuted and no action is done in the user program. I tried also opening/dev/input/event0withO_NONBLOCKflag but nothing changes.The existing driver uses the event system. The easiest way to see what I
did is to unpack a 2.6.28.2 linux tarball and apply the patch I've attached to this post.Dale Larson
Johnson Controls, Inc
Signature · 7 lines
Fabio Giovagnini Aurion s.r.l. P.I e C.F. 00885711200 Tel. +39.051.594.78.24 Cell. +39.335.83.50.919