omap drivers going upstream
Subsystems (22)
cover omap drivers going upstream
From: Felipe Balbi <[email protected]>
The following drivers are going upstream for integration. They have been sitting on linux-omap for quite a while just increasing the diff against mainline and probability of merge conflicts.
Idealy, we would have people maintaining those drivers but unfortunately it looks like it won't happen soon.
linux-omap will be kept on the loop so we can comment on the patches and see the comments coming for the proper mailing lists.
If anyone has objections to the patches, please say now before I send them to mainline. I'm planning to send them on next 9/11.
Here's the dirstat between l-o and mainline tree before and after the patches:
before:
$ git diff --dirstat linus | sort -n 3.2% drivers/input/keyboard/ 4.2% arch/arm/plat-omap/ 4.2% drivers/cbus/ 4.2% drivers/spi/ 4.8% sound/oss/ 6.0% drivers/i2c/chips/ 7.0% sound/arm/omap/ 7.2% drivers/media/video/ 8.4% drivers/dsp/dspgateway/ 9.0% arch/arm/configs/ 15.6% arch/arm/mach-omap2/ 20.6% drivers/
after:
$ git diff --dirstat linus | sort -n 4.8% drivers/bluetooth/ 7.0% arch/arm/plat-omap/ 7.7% drivers/ 7.9% sound/oss/ 11.6% sound/arm/omap/ 13.9% drivers/dsp/dspgateway/ 14.9% arch/arm/configs/ 25.7% arch/arm/mach-omap2/
Felipe Balbi (33):
add lp5521 driver
Add cbus driver
add omap-sha1 driver
add omap gpio expander driver
add tlv320aic23 driver
add tsl2563 driver
add twl4030 drivers
add innovator ps2 keypad driver
add lm8323 keypad driver
Add twl4030 keypad driver
add tsc2301 keypad driver
Add tsc2005 touchscreen driver
Add omap touchscreen driver
add tsc210x touchscreen driver
add tsc2301 touchscreen driver
add omap led drivers
add tea5761 radio driver
add ov9640 sensor driver
add omap video drivers
add omap Serial Trace Interface driver
add OMAP HighSpeed mmc controller driver
add omap nand drivers
add omap irda driver
add bq27x00 battery driver
add TWL4030 Battery Charger Interface driver
add TWL4030 RealTime Clock driver
add tsc210x driver
add tsc2301 driver
add omap ehci bus glue
add omap backlight support
add several omap lcd drivers
add omap 1-wire interface driver
add bq27000 1-wire slave driver
arch/arm/mach-omap2/board-2430sdp.c | 59 + arch/arm/plat-omap/include/mach/irqs.h | 2 + arch/arm/plat-omap/include/mach/keypad.h | 1 + drivers/Makefile | 2 +- drivers/cbus/Kconfig | 89 ++ drivers/cbus/Makefile | 14 + drivers/cbus/cbus.c | 293 ++++ drivers/cbus/cbus.h | 36 + drivers/cbus/retu-headset.c | 355 +++++ drivers/cbus/retu-pwrbutton.c | 118 ++ drivers/cbus/retu-rtc.c | 477 +++++++ drivers/cbus/retu-user.c | 423 ++++++ drivers/cbus/retu-wdt.c | 202 +++ drivers/cbus/retu.c | 466 +++++++ drivers/cbus/retu.h | 77 ++ drivers/cbus/tahvo-usb.c | 777 +++++++++++ drivers/cbus/tahvo-user.c | 405 ++++++ drivers/cbus/tahvo.c | 441 ++++++ drivers/cbus/tahvo.h | 61 + drivers/cbus/user_retu_tahvo.h | 75 ++ drivers/crypto/Kconfig | 7 + drivers/crypto/Makefile | 1 + drivers/crypto/omap-sha1-md5.c | 575 ++++++++ drivers/i2c/chips/Kconfig | 90 ++ drivers/i2c/chips/Makefile | 11 +- drivers/i2c/chips/gpio_expander_omap.c | 71 + drivers/i2c/chips/lp5521.c | 585 ++++++++ drivers/i2c/chips/tlv320aic23.c | 675 ++++++++++ drivers/i2c/chips/tsl2563.c | 739 +++++++++++ drivers/i2c/chips/twl4030-core.c | 1006 ++++++++++++++ drivers/i2c/chips/twl4030-gpio.c | 788 +++++++++++ drivers/i2c/chips/twl4030-madc.c | 455 +++++++ drivers/i2c/chips/twl4030-poweroff.c | 76 ++ drivers/i2c/chips/twl4030-pwrbutton.c | 163 +++ drivers/i2c/chips/twl4030-pwrirq.c | 226 ++++ drivers/i2c/chips/twl4030-usb.c | 779 +++++++++++ drivers/input/keyboard/Kconfig | 33 + drivers/input/keyboard/Makefile | 4 + drivers/input/keyboard/innovator_ps2.c | 1280 ++++++++++++++++++ drivers/input/keyboard/lm8323.c | 925 +++++++++++++ drivers/input/keyboard/omap-twl4030keypad.c | 415 ++++++ drivers/input/keyboard/tsc2301_kp.c | 475 +++++++ drivers/input/keyboard/twl4030-keypad.h | 82 ++ drivers/input/touchscreen/Kconfig | 25 + drivers/input/touchscreen/Makefile | 4 + drivers/input/touchscreen/omap/Makefile | 10 + drivers/input/touchscreen/omap/omap_ts.c | 267 ++++ drivers/input/touchscreen/omap/omap_ts.h | 57 + drivers/input/touchscreen/omap/ts_hx.c | 184 +++ drivers/input/touchscreen/tsc2005.c | 736 +++++++++++ drivers/input/touchscreen/tsc210x_ts.c | 160 +++ drivers/input/touchscreen/tsc2301_ts.c | 676 ++++++++++ drivers/leds/Kconfig | 21 + drivers/leds/Makefile | 2 + drivers/leds/leds-omap-pwm.c | 376 ++++++ drivers/leds/leds-omap.c | 135 ++ drivers/media/radio/Kconfig | 13 + drivers/media/radio/Makefile | 1 + drivers/media/radio/radio-tea5761.c | 517 ++++++++ drivers/media/video/Kconfig | 19 + drivers/media/video/Makefile | 3 + drivers/media/video/omap/Kconfig | 7 + drivers/media/video/omap/Makefile | 9 + drivers/media/video/omap/camera_core.c | 1280 ++++++++++++++++++ drivers/media/video/omap/camera_core.h | 156 +++ drivers/media/video/omap/camera_hw_if.h | 50 + drivers/media/video/omap/omap16xxcam.c | 579 ++++++++ drivers/media/video/omap/omap16xxcam.h | 106 ++ drivers/media/video/omap24xxcam-dma.c | 601 +++++++++ drivers/media/video/omap24xxcam.c | 1908 +++++++++++++++++++++++++++ drivers/media/video/omap24xxcam.h | 593 +++++++++ drivers/media/video/ov9640.c | 1279 ++++++++++++++++++ drivers/media/video/ov9640.h | 194 +++ drivers/misc/Kconfig | 14 + drivers/misc/Makefile | 1 + drivers/misc/sti/Makefile | 8 + drivers/misc/sti/sdti.c | 185 +++ drivers/misc/sti/sti-console.c | 189 +++ drivers/misc/sti/sti-fifo.c | 117 ++ drivers/misc/sti/sti-netlink.c | 152 +++ drivers/misc/sti/sti.c | 432 ++++++ drivers/mmc/host/Kconfig | 13 +- drivers/mmc/host/Makefile | 1 + drivers/mmc/host/omap_hsmmc.c | 1069 +++++++++++++++ drivers/mtd/nand/Kconfig | 19 + drivers/mtd/nand/Makefile | 3 + drivers/mtd/nand/omap-hw.c | 860 ++++++++++++ drivers/mtd/nand/omap-nand-flash.c | 186 +++ drivers/mtd/nand/omap2.c | 757 +++++++++++ drivers/net/irda/Kconfig | 10 + drivers/net/irda/Makefile | 1 + drivers/net/irda/omap-ir.c | 901 +++++++++++++ drivers/power/Kconfig | 29 + drivers/power/Makefile | 2 + drivers/power/bq27x00_battery.c | 564 ++++++++ drivers/power/twl4030_bci_battery.c | 1080 +++++++++++++++ drivers/rtc/Kconfig | 10 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-twl4030.c | 649 +++++++++ drivers/spi/Kconfig | 41 + drivers/spi/Makefile | 4 + drivers/spi/tsc210x.c | 1262 ++++++++++++++++++ drivers/spi/tsc2301-core.c | 301 +++++ drivers/spi/tsc2301-mixer.c | 1004 ++++++++++++++ drivers/usb/host/Kconfig | 19 + drivers/usb/host/ehci-hcd.c | 5 + drivers/usb/host/ehci-omap.c | 562 ++++++++ drivers/usb/host/ehci-omap.h | 125 ++ drivers/video/backlight/Kconfig | 9 + drivers/video/backlight/Makefile | 1 + drivers/video/backlight/omap_bl.c | 218 +++ drivers/video/omap/Kconfig | 18 + drivers/video/omap/Makefile | 11 + drivers/video/omap/lcd_2430sdp.c | 182 +++ drivers/video/omap/lcd_ams_delta.c | 140 ++ drivers/video/omap/lcd_apollon.c | 137 ++ drivers/video/omap/lcd_h2.c | 155 +++ drivers/video/omap/lcd_mipid.c | 617 +++++++++ drivers/video/omap/lcd_omap2evm.c | 195 +++ drivers/video/omap/lcd_omap3beagle.c | 133 ++ drivers/video/omap/lcd_omap3evm.c | 197 +++ drivers/video/omap/lcd_p2.c | 342 +++++ drivers/w1/masters/Kconfig | 7 + drivers/w1/masters/Makefile | 1 + drivers/w1/masters/omap_hdq.c | 704 ++++++++++ drivers/w1/slaves/Kconfig | 8 + drivers/w1/slaves/Makefile | 2 +- drivers/w1/slaves/w1_bq27000.c | 120 ++ drivers/w1/w1.h | 1 + drivers/w1/w1_io.c | 3 +- include/linux/i2c/lm8323.h | 37 + include/linux/i2c/twl4030-gpio.h | 76 ++ include/linux/i2c/twl4030-madc.h | 134 ++ include/linux/i2c/twl4030-pwrirq.h | 37 + include/linux/i2c/twl4030-rtc.h | 230 ++++ include/linux/i2c/twl4030.h | 137 ++ include/linux/spi/tsc2005.h | 29 + include/linux/spi/tsc210x.h | 231 ++++ 138 files changed, 38485 insertions(+), 5 deletions(-) create mode 100644 drivers/cbus/Kconfig create mode 100644 drivers/cbus/Makefile create mode 100644 drivers/cbus/cbus.c create mode 100644 drivers/cbus/cbus.h create mode 100644 drivers/cbus/retu-headset.c create mode 100644 drivers/cbus/retu-pwrbutton.c create mode 100644 drivers/cbus/retu-rtc.c create mode 100644 drivers/cbus/retu-user.c create mode 100644 drivers/cbus/retu-wdt.c create mode 100644 drivers/cbus/retu.c create mode 100644 drivers/cbus/retu.h create mode 100644 drivers/cbus/tahvo-usb.c create mode 100644 drivers/cbus/tahvo-user.c create mode 100644 drivers/cbus/tahvo.c create mode 100644 drivers/cbus/tahvo.h create mode 100644 drivers/cbus/user_retu_tahvo.h create mode 100644 drivers/crypto/omap-sha1-md5.c create mode 100644 drivers/i2c/chips/gpio_expander_omap.c create mode 100644 drivers/i2c/chips/lp5521.c create mode 100644 drivers/i2c/chips/tlv320aic23.c create mode 100644 drivers/i2c/chips/tsl2563.c create mode 100644 drivers/i2c/chips/twl4030-core.c create mode 100644 drivers/i2c/chips/twl4030-gpio.c create mode 100644 drivers/i2c/chips/twl4030-madc.c create mode 100644 drivers/i2c/chips/twl4030-poweroff.c create mode 100644 drivers/i2c/chips/twl4030-pwrbutton.c create mode 100644 drivers/i2c/chips/twl4030-pwrirq.c create mode 100644 drivers/i2c/chips/twl4030-usb.c create mode 100644 drivers/input/keyboard/innovator_ps2.c create mode 100644 drivers/input/keyboard/lm8323.c create mode 100644 drivers/input/keyboard/omap-twl4030keypad.c create mode 100644 drivers/input/keyboard/tsc2301_kp.c create mode 100644 drivers/input/keyboard/twl4030-keypad.h create mode 100644 drivers/input/touchscreen/omap/Makefile create mode 100644 drivers/input/touchscreen/omap/omap_ts.c create mode 100644 drivers/input/touchscreen/omap/omap_ts.h create mode 100644 drivers/input/touchscreen/omap/ts_hx.c create mode 100644 drivers/input/touchscreen/tsc2005.c create mode 100644 drivers/input/touchscreen/tsc210x_ts.c create mode 100644 drivers/input/touchscreen/tsc2301_ts.c create mode 100644 drivers/leds/leds-omap-pwm.c create mode 100644 drivers/leds/leds-omap.c create mode 100644 drivers/media/radio/radio-tea5761.c create mode 100644 drivers/media/video/omap/Kconfig create mode 100644 drivers/media/video/omap/Makefile create mode 100644 drivers/media/video/omap/camera_core.c create mode 100644 drivers/media/video/omap/camera_core.h create mode 100644 drivers/media/video/omap/camera_hw_if.h create mode 100644 drivers/media/video/omap/omap16xxcam.c create mode 100644 drivers/media/video/omap/omap16xxcam.h create mode 100644 drivers/media/video/omap24xxcam-dma.c create mode 100644 drivers/media/video/omap24xxcam.c create mode 100644 drivers/media/video/omap24xxcam.h create mode 100644 drivers/media/video/ov9640.c create mode 100644 drivers/media/video/ov9640.h create mode 100644 drivers/misc/sti/Makefile create mode 100644 drivers/misc/sti/sdti.c create mode 100644 drivers/misc/sti/sti-console.c create mode 100644 drivers/misc/sti/sti-fifo.c create mode 100644 drivers/misc/sti/sti-netlink.c create mode 100644 drivers/misc/sti/sti.c create mode 100644 drivers/mmc/host/omap_hsmmc.c create mode 100644 drivers/mtd/nand/omap-hw.c create mode 100644 drivers/mtd/nand/omap-nand-flash.c create mode 100644 drivers/mtd/nand/omap2.c create mode 100644 drivers/net/irda/omap-ir.c create mode 100644 drivers/power/bq27x00_battery.c create mode 100644 drivers/power/twl4030_bci_battery.c create mode 100644 drivers/rtc/rtc-twl4030.c create mode 100644 drivers/spi/tsc210x.c create mode 100644 drivers/spi/tsc2301-core.c create mode 100644 drivers/spi/tsc2301-mixer.c create mode 100644 drivers/usb/host/ehci-omap.c create mode 100644 drivers/usb/host/ehci-omap.h create mode 100644 drivers/video/backlight/omap_bl.c create mode 100644 drivers/video/omap/lcd_2430sdp.c create mode 100644 drivers/video/omap/lcd_ams_delta.c create mode 100644 drivers/video/omap/lcd_apollon.c create mode 100644 drivers/video/omap/lcd_h2.c create mode 100644 drivers/video/omap/lcd_mipid.c create mode 100644 drivers/video/omap/lcd_omap2evm.c create mode 100644 drivers/video/omap/lcd_omap3beagle.c create mode 100644 drivers/video/omap/lcd_omap3evm.c create mode 100644 drivers/video/omap/lcd_p2.c create mode 100644 drivers/w1/masters/omap_hdq.c create mode 100644 drivers/w1/slaves/w1_bq27000.c create mode 100644 include/linux/i2c/lm8323.h create mode 100644 include/linux/i2c/twl4030-gpio.h create mode 100644 include/linux/i2c/twl4030-madc.h create mode 100644 include/linux/i2c/twl4030-pwrirq.h create mode 100644 include/linux/i2c/twl4030-rtc.h create mode 100644 include/linux/i2c/twl4030.h create mode 100644 include/linux/spi/tsc2005.h create mode 100644 include/linux/spi/tsc210x.h
PATCH 1/33 add lp5521 driver
From: Felipe Balbi <[email protected]>
--- drivers/i2c/chips/Kconfig | 7 + drivers/i2c/chips/Makefile | 2 +- drivers/i2c/chips/lp5521.c | 585 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 593 insertions(+), 1 deletions(-) create mode 100644 drivers/i2c/chips/lp5521.c
drivers/i2c/chips/Kconfig +7 -0
@@ -162,6 +162,13 @@ config SENSORS_TSL2550 This driver can also be built as a module. If so, the module will be called tsl2550. +config LP5521 + tristate "LP5521 LED driver chip" + depends on I2C + help + If you say yes here you get support for the National Semiconductor + LP5521 LED driver. + config MENELAUS bool "TWL92330/Menelaus PM chip" depends on I2C=y && ARCH_OMAP24XX
drivers/i2c/chips/Makefile +1 -1
@@ -21,8 +21,8 @@ obj-$(CONFIG_ISP1301_OMAP) += isp1301_omap.o obj-$(CONFIG_TPS65010) += tps65010.o obj-$(CONFIG_MENELAUS) += menelaus.o obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o +obj-$(CONFIG_LP5521) += lp5521.o ifeq ($(CONFIG_I2C_DEBUG_CHIP),y) EXTRA_CFLAGS += -DDEBUG endif -
drivers/i2c/chips/lp5521.c new file +585 -0
585 lines not on this page · raw message
Signature · 1 line
1.6.0.1.141.g445ca
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 3/33 add omap-sha1 driver
From: Felipe Balbi <[email protected]>
--- drivers/crypto/Kconfig | 7 + drivers/crypto/Makefile | 1 + drivers/crypto/omap-sha1-md5.c | 575 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 583 insertions(+), 0 deletions(-) create mode 100644 drivers/crypto/omap-sha1-md5.c
drivers/crypto/Kconfig +7 -0
@@ -83,6 +83,13 @@ config ZCRYPT_MONOLITHIC that contains all parts of the crypto device driver (ap bus, request router and all the card drivers). +config OMAP_SHA1_MD5 + tristate "Support for OMAP SHA1/MD5 hw engine" + depends on ARCH_OMAP24XX && CRYPTO_SHA1 && CRYPTO_MD5 + help + OMAP processors have SHA1/MD5 module accelerator. Select this if you + want to use the OMAP module for SHA1/MD5 algorithms. + config CRYPTO_SHA1_S390 tristate "SHA1 digest algorithm" depends on S390
drivers/crypto/Makefile +1 -0
@@ -1,6 +1,7 @@ obj-$(CONFIG_CRYPTO_DEV_PADLOCK_AES) += padlock-aes.o obj-$(CONFIG_CRYPTO_DEV_PADLOCK_SHA) += padlock-sha.o obj-$(CONFIG_CRYPTO_DEV_GEODE) += geode-aes.o +obj-$(CONFIG_OMAP_SHA1_MD5) += omap-sha1-md5.o obj-$(CONFIG_CRYPTO_DEV_HIFN_795X) += hifn_795x.o obj-$(CONFIG_CRYPTO_DEV_TALITOS) += talitos.o obj-$(CONFIG_CRYPTO_DEV_IXP4XX) += ixp4xx_crypto.o
drivers/crypto/omap-sha1-md5.c new file +575 -0
575 lines not on this page · raw message
Signature · 1 line
1.6.0.1.141.g445ca
PATCH 4/33 add omap gpio expander driver
From: Felipe Balbi <[email protected]>
--- drivers/i2c/chips/Kconfig | 7 +++ drivers/i2c/chips/Makefile | 1 + drivers/i2c/chips/gpio_expander_omap.c | 71 ++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+), 0 deletions(-) create mode 100644 drivers/i2c/chips/gpio_expander_omap.c
drivers/i2c/chips/Kconfig +7 -0
@@ -137,6 +137,13 @@ config TPS65010 This driver can also be built as a module. If so, the module will be called tps65010. +config GPIOEXPANDER_OMAP + bool "GPIO Expander PCF8574PWR for OMAP" + depends on I2C && (ARCH_OMAP16XX || ARCH_OMAP24XX) + help + If you say yes here you get support for I/O expander calls + to configure IrDA, Camera and audio devices. + config SENSORS_MAX6875 tristate "Maxim MAX6875 Power supply supervisor" depends on EXPERIMENTAL
drivers/i2c/chips/Makefile +1 -0
@@ -19,6 +19,7 @@ obj-$(CONFIG_PCF8575) += pcf8575.o obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o obj-$(CONFIG_ISP1301_OMAP) += isp1301_omap.o obj-$(CONFIG_TPS65010) += tps65010.o +obj-$(CONFIG_GPIOEXPANDER_OMAP) += gpio_expander_omap.o obj-$(CONFIG_MENELAUS) += menelaus.o obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o obj-$(CONFIG_LP5521) += lp5521.o
drivers/i2c/chips/gpio_expander_omap.c new file +71 -0
71 lines not on this page · raw message
Signature · 1 line
1.6.0.1.141.g445ca
PATCH 5/33 add tlv320aic23 driver
From: Felipe Balbi <[email protected]>
--- drivers/i2c/chips/Kconfig | 7 + drivers/i2c/chips/Makefile | 1 + drivers/i2c/chips/tlv320aic23.c | 675 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 683 insertions(+), 0 deletions(-) create mode 100644 drivers/i2c/chips/tlv320aic23.c
drivers/i2c/chips/Kconfig +7 -0
@@ -137,6 +137,13 @@ config TPS65010 This driver can also be built as a module. If so, the module will be called tps65010. +config SENSORS_TLV320AIC23 + tristate "Texas Instruments TLV320AIC23 Codec" + depends on I2C && I2C_OMAP + help + If you say yes here you get support for the I2C control + interface for Texas Instruments TLV320AIC23 audio codec. + config GPIOEXPANDER_OMAP bool "GPIO Expander PCF8574PWR for OMAP" depends on I2C && (ARCH_OMAP16XX || ARCH_OMAP24XX)
drivers/i2c/chips/Makefile +1 -0
@@ -19,6 +19,7 @@ obj-$(CONFIG_PCF8575) += pcf8575.o obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o obj-$(CONFIG_ISP1301_OMAP) += isp1301_omap.o obj-$(CONFIG_TPS65010) += tps65010.o +obj-$(CONFIG_SENSORS_TLV320AIC23) += tlv320aic23.o obj-$(CONFIG_GPIOEXPANDER_OMAP) += gpio_expander_omap.o obj-$(CONFIG_MENELAUS) += menelaus.o obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o
drivers/i2c/chips/tlv320aic23.c new file +675 -0
675 lines not on this page · raw message
Signature · 1 line
1.6.0.1.141.g445ca
PATCH 6/33 add tsl2563 driver
From: Felipe Balbi <[email protected]>
--- drivers/i2c/chips/Kconfig | 10 + drivers/i2c/chips/Makefile | 1 + drivers/i2c/chips/tsl2563.c | 739 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 750 insertions(+), 0 deletions(-) create mode 100644 drivers/i2c/chips/tsl2563.c
drivers/i2c/chips/Kconfig +10 -0
@@ -176,6 +176,16 @@ config SENSORS_TSL2550 This driver can also be built as a module. If so, the module will be called tsl2550. +config SENSORS_TSL2563 + tristate "Taos TSL2563 ambient light sensor" + depends on I2C && HWMON + help + If you say yes here you get support for the Taos TSL2563 + ambient light sensor. + + This driver can also be built as a module. If so, the module + will be called tsl2563. + config LP5521 tristate "LP5521 LED driver chip" depends on I2C
drivers/i2c/chips/Makefile +1 -0
@@ -23,6 +23,7 @@ obj-$(CONFIG_SENSORS_TLV320AIC23) += tlv320aic23.o obj-$(CONFIG_GPIOEXPANDER_OMAP) += gpio_expander_omap.o obj-$(CONFIG_MENELAUS) += menelaus.o obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o +obj-$(CONFIG_SENSORS_TSL2563) += tsl2563.o obj-$(CONFIG_LP5521) += lp5521.o ifeq ($(CONFIG_I2C_DEBUG_CHIP),y)
drivers/i2c/chips/tsl2563.c new file +739 -0
739 lines not on this page · raw message
Signature · 1 line
1.6.0.1.141.g445ca
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 8/33 add innovator ps2 keypad driver
From: Felipe Balbi <[email protected]>
--- drivers/input/keyboard/Kconfig | 10 + drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/innovator_ps2.c | 1280 ++++++++++++++++++++++++++++++++ 3 files changed, 1291 insertions(+), 0 deletions(-) create mode 100644 drivers/input/keyboard/innovator_ps2.c
drivers/input/keyboard/Kconfig +10 -0
@@ -259,6 +259,16 @@ config KEYBOARD_OMAP To compile this driver as a module, choose M here: the module will be called omap-keypad. +config OMAP_PS2 + tristate "TI OMAP Innovator 1510 PS/2 keyboard & mouse support" + depends on ARCH_OMAP15XX && MACH_OMAP_INNOVATOR + help + Say Y here if you want to use the OMAP Innovator 1510 PS/2 + keyboard and mouse. + + To compile this driver as a module, choose M here: the + module will be called innovator_ps2. + config KEYBOARD_PXA27x tristate "PXA27x/PXA3xx keypad support" depends on PXA27x || PXA3xx
drivers/input/keyboard/Makefile +1 -0
@@ -19,6 +19,7 @@ obj-$(CONFIG_KEYBOARD_TOSA) += tosakbd.o obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o obj-$(CONFIG_KEYBOARD_OMAP) += omap-keypad.o +obj-$(CONFIG_OMAP_PS2) += innovator_ps2.o obj-$(CONFIG_KEYBOARD_PXA27x) += pxa27x_keypad.o obj-$(CONFIG_KEYBOARD_AAED2000) += aaed2000_kbd.o obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o
drivers/input/keyboard/innovator_ps2.c new file +1280 -0
1,280 lines not on this page · raw message
Signature · 6 lines
1.6.0.1.141.g445ca -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 9/33 add lm8323 keypad driver
From: Felipe Balbi <[email protected]>
--- drivers/input/keyboard/Kconfig | 7 + drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/lm8323.c | 925 +++++++++++++++++++++++++++++++++++++++ include/linux/i2c/lm8323.h | 37 ++ 4 files changed, 970 insertions(+), 0 deletions(-) create mode 100644 drivers/input/keyboard/lm8323.c create mode 100644 include/linux/i2c/lm8323.h
drivers/input/keyboard/Kconfig +7 -0
@@ -269,6 +269,13 @@ config OMAP_PS2 To compile this driver as a module, choose M here: the module will be called innovator_ps2. +config KEYBOARD_LM8323 + tristate "LM8323 keypad chip" + depends on I2C + help + If you say yes here you get support for the National Semiconductor + LM8323 keypad controller. + config KEYBOARD_PXA27x tristate "PXA27x/PXA3xx keypad support" depends on PXA27x || PXA3xx
drivers/input/keyboard/Makefile +1 -0
@@ -20,6 +20,7 @@ obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o obj-$(CONFIG_KEYBOARD_OMAP) += omap-keypad.o obj-$(CONFIG_OMAP_PS2) += innovator_ps2.o +obj-$(CONFIG_KEYBOARD_LM8323) += lm8323.o obj-$(CONFIG_KEYBOARD_PXA27x) += pxa27x_keypad.o obj-$(CONFIG_KEYBOARD_AAED2000) += aaed2000_kbd.o obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o
drivers/input/keyboard/lm8323.c new file +925 -0
925 lines not on this page · raw message
include/linux/i2c/lm8323.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* include/lm8323.h +* +* Configuration for LM8323 keypad driver. +*/ + +#ifndef __LINUX_LM8323_H +#define __LINUX_LM8323_H + +#include <linux/types.h> + +/* +* Largest keycode that the chip can send, plus one, +* so keys can be mapped directly at the index of the +* LM8323 keycode instead of subtracting one. +*/ +#define LM8323_KEYMAP_SIZE (0x7f + 1) + +struct lm8323_platform_data { +int debounce_time;/* Time to watch for key bouncing, in ms. */ +int active_time;/* Idle time until sleep, in ms. */ + +int size_x; +int size_y; +int repeat :1 ; +const s16 *keymap; + +char *pwm1_name;/* Device name for PWM1. */ +char *pwm2_name;/* Device name for PWM2. */ +char *pwm3_name;/* Device name for PWM3. */ + +char *name;/* Device name. */ +}; + +void __init lm8323_set_platform_data (struct lm8323_platform_data *pdata); + +#endif /* __LINUX_LM8323_H */
Signature · 1 line
1.6.0.1.141.g445ca
PATCH 10/33 Add twl4030 keypad driver
From: Felipe Balbi <[email protected]>
--- arch/arm/mach-omap2/board-2430sdp.c | 59 ++++ arch/arm/plat-omap/include/mach/keypad.h | 1 + drivers/input/keyboard/Kconfig | 10 + drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/omap-twl4030keypad.c | 415 +++++++++++++++++++++++++++ drivers/input/keyboard/twl4030-keypad.h | 82 ++++++ 6 files changed, 568 insertions(+), 0 deletions(-) create mode 100644 drivers/input/keyboard/omap-twl4030keypad.c create mode 100644 drivers/input/keyboard/twl4030-keypad.h
arch/arm/mach-omap2/board-2430sdp.c +59 -0
@@ -19,6 +19,8 @@#include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h> #include <linux/delay.h> +#include <linux/input.h> +#include <linux/i2c/twl4030.h> #include <linux/err.h> #include <linux/clk.h>
@@ -32,6 +34,7 @@#include <mach/mux.h> #include <mach/board.h> #include <mach/common.h> +#include <mach/keypad.h> #include <mach/gpmc.h> #include <asm/io.h>
@@ -114,8 +117,64 @@ static struct platform_device sdp2430_smc91x_device = { .resource = sdp2430_smc91x_resources, }; +/* +* Key mapping for 2430 SDP board +*/ + +static int sdp2430_keymap[] = { +KEY (0 ,0 ,KEY_LEFT ), +KEY (0 ,1 ,KEY_RIGHT ), +KEY (0 ,2 ,KEY_A ), +KEY (0 ,3 ,KEY_B ), +KEY (0 ,4 ,KEY_C ), +KEY (1 ,0 ,KEY_DOWN ), +KEY (1 ,1 ,KEY_UP ), +KEY (1 ,2 ,KEY_E ), +KEY (1 ,3 ,KEY_F ), +KEY (1 ,4 ,KEY_G ), +KEY (2 ,0 ,KEY_ENTER ), +KEY (2 ,1 ,KEY_I ), +KEY (2 ,2 ,KEY_J ), +KEY (2 ,3 ,KEY_K ), +KEY (2 ,4 ,KEY_3 ), +KEY (3 ,0 ,KEY_M ), +KEY (3 ,1 ,KEY_N ), +KEY (3 ,2 ,KEY_O ), +KEY (3 ,3 ,KEY_P ), +KEY (3 ,4 ,KEY_Q ), +KEY (4 ,0 ,KEY_R ), +KEY (4 ,1 ,KEY_4 ), +KEY (4 ,2 ,KEY_T ), +KEY (4 ,3 ,KEY_U ), +KEY (4 ,4 ,KEY_D ), +KEY (5 ,0 ,KEY_V ), +KEY (5 ,1 ,KEY_W ), +KEY (5 ,2 ,KEY_L ), +KEY (5 ,3 ,KEY_S ), +KEY (5 ,4 ,KEY_H ), +0 +}; + +static struct omap_kp_platform_data sdp2430_kp_data = { + .rows =5 , + .cols =6 , + .keymap = sdp2430_keymap, + .keymapsize =ARRAY_SIZE (sdp2430_keymap), + .rep =1 , + .irq =TWL4030_MODIRQ_KEYPAD , +}; + +static struct platform_device sdp2430_kp_device = { + .name ="omap_twl4030keypad" , + .id =-1 , + .dev = { + .platform_data = &sdp2430_kp_data, + }, +}; +static struct platform_device *sdp2430_devices[]__initdata = { &sdp2430_smc91x_device, + &sdp2430_kp_device, &sdp2430_flash_device, };
arch/arm/plat-omap/include/mach/keypad.h +1 -0
@@ -14,6 +14,7 @@ struct omap_kp_platform_data {int rows;int cols;int *keymap; +int irq;unsigned int keymapsize; unsigned int rep:1;unsigned long delay;
drivers/input/keyboard/Kconfig +10 -0
@@ -259,6 +259,16 @@ config KEYBOARD_OMAP To compile this driver as a module, choose M here: the module will be called omap-keypad. +config KEYBOARD_TWL4030 + tristate "TI TWL4030 keypad support" + depends on TWL4030_CORE && (MACH_OMAP_2430SDP || MACH_OMAP2EVM || MACH_OMAP_3430SDP || MACH_OMAP3EVM) + help + Say Y here if you want to use the OMAP TWL4030 keypad. + + To compile this driver as a module, choose M here: the + module will be called omap-twl4030keypad. This driver depends on + TWL4030 Core and TWL4030 GPIO I2C client driver + config OMAP_PS2 tristate "TI OMAP Innovator 1510 PS/2 keyboard & mouse support" depends on ARCH_OMAP15XX && MACH_OMAP_INNOVATOR
drivers/input/keyboard/Makefile +1 -0
@@ -21,6 +21,7 @@ obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o obj-$(CONFIG_KEYBOARD_OMAP) += omap-keypad.o obj-$(CONFIG_OMAP_PS2) += innovator_ps2.o obj-$(CONFIG_KEYBOARD_LM8323) += lm8323.o +obj-$(CONFIG_KEYBOARD_TWL4030) += omap-twl4030keypad.o obj-$(CONFIG_KEYBOARD_PXA27x) += pxa27x_keypad.o obj-$(CONFIG_KEYBOARD_AAED2000) += aaed2000_kbd.o obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o
drivers/input/keyboard/omap-twl4030keypad.c new file +415 -0
415 lines not on this page · raw message
drivers/input/keyboard/twl4030-keypad.h new file +82 -0
82 lines not on this page · raw message
Signature · 1 line
1.6.0.1.141.g445ca
PATCH 11/33 add tsc2301 keypad driver
From: Felipe Balbi <[email protected]>
--- drivers/input/keyboard/Kconfig | 6 + drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/tsc2301_kp.c | 475 +++++++++++++++++++++++++++++++++++ 3 files changed, 482 insertions(+), 0 deletions(-) create mode 100644 drivers/input/keyboard/tsc2301_kp.c
drivers/input/keyboard/Kconfig +6 -0
@@ -279,6 +279,12 @@ config OMAP_PS2 To compile this driver as a module, choose M here: the module will be called innovator_ps2. +config KEYBOARD_TSC2301 + tristate "TSC2301 keypad support" + depends on SPI_TSC2301 + help + Say Y here for if you are using the keypad features of TSC2301. + config KEYBOARD_LM8323 tristate "LM8323 keypad chip" depends on I2C
drivers/input/keyboard/Makefile +1 -0
@@ -20,6 +20,7 @@ obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o obj-$(CONFIG_KEYBOARD_OMAP) += omap-keypad.o obj-$(CONFIG_OMAP_PS2) += innovator_ps2.o +obj-$(CONFIG_KEYBOARD_TSC2301) += tsc2301_kp.o obj-$(CONFIG_KEYBOARD_LM8323) += lm8323.o obj-$(CONFIG_KEYBOARD_TWL4030) += omap-twl4030keypad.o obj-$(CONFIG_KEYBOARD_PXA27x) += pxa27x_keypad.o
drivers/input/keyboard/tsc2301_kp.c new file +475 -0
475 lines not on this page · raw message
Signature · 1 line
1.6.0.1.141.g445ca
PATCH 12/33 Add tsc2005 touchscreen driver
From: Felipe Balbi <[email protected]>
--- drivers/input/touchscreen/Kconfig | 5 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/tsc2005.c | 736 +++++++++++++++++++++++++++++++++++ include/linux/spi/tsc2005.h | 29 ++ 4 files changed, 771 insertions(+), 0 deletions(-) create mode 100644 drivers/input/touchscreen/tsc2005.c create mode 100644 include/linux/spi/tsc2005.h
drivers/input/touchscreen/Kconfig +5 -0
@@ -217,6 +217,11 @@ config TOUCHSCREEN_ATMEL_TSADCC To compile this driver as a module, choose M here: the module will be called atmel_tsadcc. +config TOUCHSCREEN_TSC2005 + tristate "TSC2005 touchscreen support" + help + Say Y here for if you are using the touchscreen features of TSC2301. + config TOUCHSCREEN_UCB1400 tristate "Philips UCB1400 touchscreen" select AC97_BUS
drivers/input/touchscreen/Makefile +1 -0
@@ -26,6 +26,7 @@ obj-$(CONFIG_TOUCHSCREEN_TOUCHIT213) += touchit213.o obj-$(CONFIG_TOUCHSCREEN_TOUCHRIGHT) += touchright.o obj-$(CONFIG_TOUCHSCREEN_TOUCHWIN) += touchwin.o obj-$(CONFIG_TOUCHSCREEN_UCB1400) += ucb1400_ts.o +obj-$(CONFIG_TOUCHSCREEN_TSC2005) += tsc2005.o obj-$(CONFIG_TOUCHSCREEN_WM97XX) += wm97xx-ts.o wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9705) += wm9705.o wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9712) += wm9712.o
drivers/input/touchscreen/tsc2005.c new file +736 -0
736 lines not on this page · raw message
include/linux/spi/tsc2005.h new file +29 -0
@@ -0,0 +1,29 @@ +#ifndef _LINUX_SPI_TSC2005_H +#define _LINUX_SPI_TSC2005_H + +#include <linux/types.h> + +struct tsc2005_platform_data { +s16 reset_gpio; +s16 dav_gpio; +s16 pen_int_gpio; +u16 ts_x_plate_ohm; +u32 ts_stab_time;/* voltage settling time */ +u8 ts_hw_avg;/* HW assiseted averaging. Can be +0, 4, 8, 16 samples per reading */ +u32 ts_touch_pressure;/* Pressure limit until we report a +touch event. After that we switch +to ts_max_pressure. */ +u32 ts_pressure_max;/* Samples with bigger pressure value will +be ignored, since the corresponding X, Y +values are unreliable */ +u32 ts_pressure_fudge; +u32 ts_x_max; +u32 ts_x_fudge; +u32 ts_y_max; +u32 ts_y_fudge; + +unsigned ts_ignore_last :1 ; +}; + +#endif
Signature · 1 line
1.6.0.1.141.g445ca
PATCH 13/33 Add omap touchscreen driver
From: Felipe Balbi <[email protected]>
--- drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/omap/Makefile | 10 + drivers/input/touchscreen/omap/omap_ts.c | 267 ++++++++++++++++++++++++++++++ drivers/input/touchscreen/omap/omap_ts.h | 57 +++++++ drivers/input/touchscreen/omap/ts_hx.c | 184 ++++++++++++++++++++ 5 files changed, 519 insertions(+), 0 deletions(-) create mode 100644 drivers/input/touchscreen/omap/Makefile create mode 100644 drivers/input/touchscreen/omap/omap_ts.c create mode 100644 drivers/input/touchscreen/omap/omap_ts.h create mode 100644 drivers/input/touchscreen/omap/ts_hx.c
drivers/input/touchscreen/Makefile +1 -0
@@ -27,6 +27,7 @@ obj-$(CONFIG_TOUCHSCREEN_TOUCHRIGHT) += touchright.o obj-$(CONFIG_TOUCHSCREEN_TOUCHWIN) += touchwin.o obj-$(CONFIG_TOUCHSCREEN_UCB1400) += ucb1400_ts.o obj-$(CONFIG_TOUCHSCREEN_TSC2005) += tsc2005.o +obj-$(CONFIG_TOUCHSCREEN_OMAP) += omap/ obj-$(CONFIG_TOUCHSCREEN_WM97XX) += wm97xx-ts.o wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9705) += wm9705.o wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9712) += wm9712.o
drivers/input/touchscreen/omap/Makefile new file +10 -0
@@ -0,0 +1,10 @@ +# +# Makefile for the OMAP touchscreen input driver +# + +obj-$(CONFIG_TOUCHSCREEN_OMAP) += omapts.o + +objs-$(CONFIG_ARCH_OMAP16XX)$(CONFIG_MACH_OMAP_H2) += ts_hx.o +objs-$(CONFIG_ARCH_OMAP16XX)$(CONFIG_MACH_OMAP_H3) += ts_hx.o + +omapts-objs := omap_ts.o $(objs-yy)
drivers/input/touchscreen/omap/omap_ts.c new file +267 -0
267 lines not on this page · raw message
drivers/input/touchscreen/omap/omap_ts.h new file +57 -0
57 lines not on this page · raw message
drivers/input/touchscreen/omap/ts_hx.c new file +184 -0
184 lines not on this page · raw message
Signature · 1 line
1.6.0.1.141.g445ca
PATCH 14/33 add tsc210x touchscreen driver
From: Felipe Balbi <[email protected]>
--- drivers/input/touchscreen/Kconfig | 14 ++ drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/tsc210x_ts.c | 160 ++++++++++++++++++++++ include/linux/spi/tsc210x.h | 231 ++++++++++++++++++++++++++++++++ 4 files changed, 406 insertions(+), 0 deletions(-) create mode 100644 drivers/input/touchscreen/tsc210x_ts.c create mode 100644 include/linux/spi/tsc210x.h
drivers/input/touchscreen/Kconfig +14 -0
@@ -222,6 +222,20 @@ config TOUCHSCREEN_TSC2005 help Say Y here for if you are using the touchscreen features of TSC2301. +config TOUCHSCREEN_TSC210X + tristate "TI TSC210x based touchscreens" + depends on SPI_MASTER + select SPI_TSC210X + help + Say Y here if you have a touchscreen interface using a + TI TSC210x controller, and your board-specific initialisation + code includes that in its table of SPI devices. + + If unsure, say N (but it's safe to say "Y"). + + To compile this driver as a module, choose M here: the + module will be called tsc210x_ts. + config TOUCHSCREEN_UCB1400 tristate "Philips UCB1400 touchscreen" select AC97_BUS
drivers/input/touchscreen/Makefile +1 -0
@@ -28,6 +28,7 @@ obj-$(CONFIG_TOUCHSCREEN_TOUCHWIN) += touchwin.o obj-$(CONFIG_TOUCHSCREEN_UCB1400) += ucb1400_ts.o obj-$(CONFIG_TOUCHSCREEN_TSC2005) += tsc2005.o obj-$(CONFIG_TOUCHSCREEN_OMAP) += omap/ +obj-$(CONFIG_TOUCHSCREEN_TSC210X) += tsc210x_ts.o obj-$(CONFIG_TOUCHSCREEN_WM97XX) += wm97xx-ts.o wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9705) += wm9705.o wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9712) += wm9712.o
drivers/input/touchscreen/tsc210x_ts.c new file +160 -0
160 lines not on this page · raw message
include/linux/spi/tsc210x.h new file +231 -0
231 lines not on this page · raw message
Signature · 1 line
1.6.0.1.141.g445ca
PATCH 15/33 add tsc2301 touchscreen driver
From: Felipe Balbi <[email protected]>
--- drivers/input/touchscreen/Kconfig | 6 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/tsc2301_ts.c | 676 ++++++++++++++++++++++++++++++++ 3 files changed, 683 insertions(+), 0 deletions(-) create mode 100644 drivers/input/touchscreen/tsc2301_ts.c
drivers/input/touchscreen/Kconfig +6 -0
@@ -236,6 +236,12 @@ config TOUCHSCREEN_TSC210X To compile this driver as a module, choose M here: the module will be called tsc210x_ts. +config TOUCHSCREEN_TSC2301 + tristate "TSC2301 touchscreen support" + depends on SPI_TSC2301 + help + Say Y here for if you are using the touchscreen features of TSC2301. + config TOUCHSCREEN_UCB1400 tristate "Philips UCB1400 touchscreen" select AC97_BUS
drivers/input/touchscreen/Makefile +1 -0
@@ -29,6 +29,7 @@ obj-$(CONFIG_TOUCHSCREEN_UCB1400) += ucb1400_ts.o obj-$(CONFIG_TOUCHSCREEN_TSC2005) += tsc2005.o obj-$(CONFIG_TOUCHSCREEN_OMAP) += omap/ obj-$(CONFIG_TOUCHSCREEN_TSC210X) += tsc210x_ts.o +obj-$(CONFIG_TOUCHSCREEN_TSC2301) += tsc2301_ts.o obj-$(CONFIG_TOUCHSCREEN_WM97XX) += wm97xx-ts.o wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9705) += wm9705.o wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9712) += wm9712.o
drivers/input/touchscreen/tsc2301_ts.c new file +676 -0
676 lines not on this page · raw message
Signature · 1 line
1.6.0.1.141.g445ca
PATCH 16/33 add omap led drivers
From: Felipe Balbi <[email protected]>
--- drivers/leds/Kconfig | 21 +++ drivers/leds/Makefile | 2 + drivers/leds/leds-omap-pwm.c | 376 ++++++++++++++++++++++++++++++++++++++++++ drivers/leds/leds-omap.c | 135 +++++++++++++++ 4 files changed, 534 insertions(+), 0 deletions(-) create mode 100644 drivers/leds/leds-omap-pwm.c create mode 100644 drivers/leds/leds-omap.c
drivers/leds/Kconfig +21 -0
@@ -77,6 +77,27 @@ config LEDS_WRAP help This option enables support for the PCEngines WRAP programmable LEDs. +config LEDS_OMAP_DEBUG + boolean "LED Support for OMAP debug board LEDs" + depends on LEDS_CLASS=y && ARCH_OMAP + help + Enables support for the LEDs on the debug board used with OMAP + reference boards like H2/H3/H4 and Perseus2. Up to six of these + may be claimed by the original ARM debug LED API. + +config LEDS_OMAP + tristate "LED Support for OMAP GPIO LEDs" + depends on LEDS_CLASS && ARCH_OMAP + help + This option enables support for the LEDs on OMAP processors. + +config LEDS_OMAP_PWM + tristate "LED Support for OMAP PWM-controlled LEDs" + depends on LEDS_CLASS && ARCH_OMAP && OMAP_DM_TIMER + help + This options enables support for LEDs connected to GPIO lines + controlled by a PWM timer on OMAP CPUs. + config LEDS_H1940 tristate "LED Support for iPAQ H1940 device" depends on LEDS_CLASS && ARCH_H1940
drivers/leds/Makefile +2 -0
@@ -13,6 +13,8 @@ obj-$(CONFIG_LEDS_S3C24XX) += leds-s3c24xx.o obj-$(CONFIG_LEDS_AMS_DELTA) += leds-ams-delta.o obj-$(CONFIG_LEDS_NET48XX) += leds-net48xx.o obj-$(CONFIG_LEDS_WRAP) += leds-wrap.o +obj-$(CONFIG_LEDS_OMAP) += leds-omap.o +obj-$(CONFIG_LEDS_OMAP_PWM) += leds-omap-pwm.o obj-$(CONFIG_LEDS_H1940) += leds-h1940.o obj-$(CONFIG_LEDS_COBALT_QUBE) += leds-cobalt-qube.o obj-$(CONFIG_LEDS_COBALT_RAQ) += leds-cobalt-raq.o
drivers/leds/leds-omap-pwm.c new file +376 -0
376 lines not on this page · raw message
drivers/leds/leds-omap.c new file +135 -0
135 lines not on this page · raw message
Signature · 1 line
1.6.0.1.141.g445ca
PATCH 17/33 add tea5761 radio driver
From: Felipe Balbi <[email protected]>
--- drivers/media/radio/Kconfig | 13 + drivers/media/radio/Makefile | 1 + drivers/media/radio/radio-tea5761.c | 517 +++++++++++++++++++++++++++++++++++ 3 files changed, 531 insertions(+), 0 deletions(-) create mode 100644 drivers/media/radio/radio-tea5761.c
drivers/media/radio/Kconfig +13 -0
@@ -339,6 +339,19 @@ config RADIO_ZOLTRIX_PORT help Enter the I/O port of your Zoltrix radio card. +config RADIO_TEA5761 + tristate "Philips Semiconductors TEA5761 I2C FM Radio" + help + Choose Y here if you have one of these AM/FM radio cards. + + In order to control your radio card, you will need to use programs + that are compatible with the Video For Linux 2 API. Information on + this API and pointers to "v4l" programs may be found at + <file:Documentation/video4linux/API.html>. + + To compile this driver as a module, choose M here: the + module will be called radio-tea5761. + config USB_DSBR tristate "D-Link/GemTek USB FM radio support" depends on USB && VIDEO_V4L2
drivers/media/radio/Makefile +1 -0
@@ -20,6 +20,7 @@ obj-$(CONFIG_RADIO_GEMTEK) += radio-gemtek.o obj-$(CONFIG_RADIO_GEMTEK_PCI) += radio-gemtek-pci.o obj-$(CONFIG_RADIO_TRUST) += radio-trust.o obj-$(CONFIG_RADIO_MAESTRO) += radio-maestro.o +obj-$(CONFIG_RADIO_TEA5761) += radio-tea5761.o obj-$(CONFIG_USB_DSBR) += dsbr100.o obj-$(CONFIG_USB_SI470X) += radio-si470x.o
drivers/media/radio/radio-tea5761.c new file +517 -0
517 lines not on this page · raw message
Signature · 6 lines
1.6.0.1.141.g445ca -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 18/33 add ov9640 sensor driver
From: Felipe Balbi <[email protected]>
--- drivers/media/video/Kconfig | 8 + drivers/media/video/Makefile | 1 + drivers/media/video/ov9640.c | 1279 ++++++++++++++++++++++++++++++++++++++++++ drivers/media/video/ov9640.h | 194 +++++++ 4 files changed, 1482 insertions(+), 0 deletions(-) create mode 100644 drivers/media/video/ov9640.c create mode 100644 drivers/media/video/ov9640.h
drivers/media/video/Kconfig +8 -0
@@ -295,6 +295,14 @@ config VIDEO_TCM825X This is a driver for the Toshiba TCM825x VGA camera sensor. It is used for example in Nokia N800. +config VIDEO_OV9640 + tristate "OmniVision OV9640 sensor support" + depends on I2C && VIDEO_V4L2 + ---help--- + This is a Video4Linux2 sensor-level driver for the OmniVision + OV9640 camera. It is currently working with the TI OMAP2 + camera controller. + config VIDEO_SAA7110 tristate "Philips SAA7110 video decoder" depends on VIDEO_V4L1 && I2C
drivers/media/video/Makefile +1 -0
@@ -106,6 +106,7 @@ obj-$(CONFIG_VIDEO_CAFE_CCIC) += cafe_ccic.o obj-$(CONFIG_VIDEO_OV7670) += ov7670.o obj-$(CONFIG_VIDEO_TCM825X) += tcm825x.o +obj-$(CONFIG_VIDEO_OV9640) += ov9640.o obj-$(CONFIG_USB_DABUSB) += dabusb.o obj-$(CONFIG_USB_OV511) += ov511.o
drivers/media/video/ov9640.c new file +1279 -0
1,279 lines not on this page · raw message
drivers/media/video/ov9640.h new file +194 -0
194 lines not on this page · raw message
Signature · 1 line
1.6.0.1.141.g445ca
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 20/33 add omap Serial Trace Interface driver
From: Felipe Balbi <[email protected]>
--- drivers/misc/Kconfig | 14 ++ drivers/misc/Makefile | 1 + drivers/misc/sti/Makefile | 8 + drivers/misc/sti/sdti.c | 185 +++++++++++++++++ drivers/misc/sti/sti-console.c | 189 ++++++++++++++++++ drivers/misc/sti/sti-fifo.c | 117 +++++++++++ drivers/misc/sti/sti-netlink.c | 152 ++++++++++++++ drivers/misc/sti/sti.c | 432 ++++++++++++++++++++++++++++++++++++++++ 8 files changed, 1098 insertions(+), 0 deletions(-) create mode 100644 drivers/misc/sti/Makefile create mode 100644 drivers/misc/sti/sdti.c create mode 100644 drivers/misc/sti/sti-console.c create mode 100644 drivers/misc/sti/sti-fifo.c create mode 100644 drivers/misc/sti/sti-netlink.c create mode 100644 drivers/misc/sti/sti.c
drivers/misc/Kconfig +14 -0
@@ -415,6 +415,20 @@ config EEEPC_LAPTOP If you have an Eee PC laptop, say Y or M here. +config OMAP_STI + bool "Serial Trace Interface support" + depends on ARCH_OMAP16XX || ARCH_OMAP24XX || ARCH_OMAP34XX + default n + help + Serial Trace Interface. The protocols suported for OMAP1/2/3 are + STI/CSTI/XTIv2 correspondingly. + +config OMAP_STI_CONSOLE + bool "STI console support" + depends on OMAP_STI + help + This enables a console driver by way of STI/XTI. + config ENCLOSURE_SERVICES tristate "Enclosure Services" default n
drivers/misc/Makefile +1 -0
@@ -5,6 +5,7 @@ obj- := misc.o # Dummy rule to force built-in.o to be made obj-$(CONFIG_IBM_ASM) += ibmasm/ obj-$(CONFIG_HDPU_FEATURES) += hdpuftrs/ +obj-$(CONFIG_OMAP_STI) += sti/ obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o obj-$(CONFIG_EEEPC_LAPTOP) += eeepc-laptop.o obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o
drivers/misc/sti/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +ifeq ($(CONFIG_ARCH_OMAP3),y) +obj-$(CONFIG_OMAP_STI) += sdti.o +else +obj-$(CONFIG_OMAP_STI) += sti.o sti-fifo.o +obj-$(CONFIG_NET) += sti-netlink.o +endif + +obj-$(CONFIG_OMAP_STI_CONSOLE) += sti-console.o
drivers/misc/sti/sdti.c new file +185 -0
185 lines not on this page · raw message
drivers/misc/sti/sti-console.c new file +189 -0
189 lines not on this page · raw message
drivers/misc/sti/sti-fifo.c new file +117 -0
117 lines not on this page · raw message
drivers/misc/sti/sti-netlink.c new file +152 -0
152 lines not on this page · raw message
drivers/misc/sti/sti.c new file +432 -0
432 lines not on this page · raw message
Signature · 6 lines
1.6.0.1.141.g445ca -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 21/33 add OMAP HighSpeed mmc controller driver
From: Felipe Balbi <[email protected]>
--- drivers/mmc/host/Kconfig | 13 +- drivers/mmc/host/Makefile | 1 + drivers/mmc/host/omap_hsmmc.c | 1069 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1082 insertions(+), 1 deletions(-) create mode 100644 drivers/mmc/host/omap_hsmmc.c
drivers/mmc/host/Kconfig +12 -1
@@ -67,7 +67,7 @@ config MMC_RICOH_MMC config MMC_OMAP tristate "TI OMAP Multimedia Card Interface support" - depends on ARCH_OMAP + depends on ARCH_OMAP1 || (ARCH_OMAP2 && ARCH_OMAP2420) select TPS65010 if MACH_OMAP_H2 help This selects the TI OMAP Multimedia card Interface.
@@ -76,6 +76,17 @@ config MMC_OMAP If unsure, say N. +config MMC_OMAP_HS + tristate "TI OMAP High Speed Multimedia Card Interface support" + depends on (ARCH_OMAP2 && ARCH_OMAP2430) || ARCH_OMAP3 + select TWL4030_CORE if MACH_OMAP_2430SDP || MACH_OMAP_3430SDP + help + This selects the TI OMAP High Speed Multimedia card Interface. + If you have an OMAP2(2430) or OMAP3 board with a Multimedia Card slot, + say Y or M here. + + If unsure, say N. + config MMC_WBSD tristate "Winbond W83L51xD SD/MMC Card Interface support" depends on ISA_DMA_API
drivers/mmc/host/Makefile +1 -0
@@ -15,6 +15,7 @@ obj-$(CONFIG_MMC_RICOH_MMC) += ricoh_mmc.o obj-$(CONFIG_MMC_WBSD) += wbsd.o obj-$(CONFIG_MMC_AU1X) += au1xmmc.o obj-$(CONFIG_MMC_OMAP) += omap.o +obj-$(CONFIG_MMC_OMAP_HS) += omap_hsmmc.o obj-$(CONFIG_MMC_AT91) += at91_mci.o obj-$(CONFIG_MMC_ATMELMCI) += atmel-mci.o obj-$(CONFIG_MMC_TIFM_SD) += tifm_sd.o
drivers/mmc/host/omap_hsmmc.c new file +1069 -0
1,069 lines not on this page · raw message
Signature · 1 line
1.6.0.1.141.g445ca
PATCH 22/33 add omap nand drivers
From: Felipe Balbi <[email protected]>
--- drivers/mtd/nand/Kconfig | 19 + drivers/mtd/nand/Makefile | 3 + drivers/mtd/nand/omap-hw.c | 860 ++++++++++++++++++++++++++++++++++++ drivers/mtd/nand/omap-nand-flash.c | 186 ++++++++ drivers/mtd/nand/omap2.c | 757 +++++++++++++++++++++++++++++++ 5 files changed, 1825 insertions(+), 0 deletions(-) create mode 100644 drivers/mtd/nand/omap-hw.c create mode 100644 drivers/mtd/nand/omap-nand-flash.c create mode 100644 drivers/mtd/nand/omap2.c
drivers/mtd/nand/Kconfig +19 -0
@@ -68,6 +68,25 @@ config MTD_NAND_AMS_DELTA help Support for NAND flash on Amstrad E3 (Delta). +config MTD_NAND_OMAP2 + tristate "NAND Flash device on OMAP2 and OMAP3" + depends on ARM && MTD_NAND && (ARCH_OMAP2 || ARCH_OMAP3) + help + Support for NAND flash on Texas Instruments OMAP2 and OMAP3 platforms. + +config MTD_NAND_OMAP + tristate "NAND Flash device on OMAP H3/H2/P2 boards" + depends on ARM && ARCH_OMAP1 && MTD_NAND && (MACH_OMAP_H2 || MACH_OMAP_H3 || MACH_OMAP_PERSEUS2) + help + Support for NAND flash on Texas Instruments H3/H2/P2 platforms. + +config MTD_NAND_OMAP_HW + bool "OMAP HW NAND Flash controller support" + depends on ARM && ARCH_OMAP16XX && MTD_NAND + + help + Driver for TI OMAP16xx hardware NAND flash controller. + config MTD_NAND_TOTO tristate "NAND Flash device on TOTO board" depends on ARCH_OMAP && BROKEN
drivers/mtd/nand/Makefile +3 -0
@@ -24,6 +24,9 @@ obj-$(CONFIG_MTD_NAND_NANDSIM) += nandsim.o obj-$(CONFIG_MTD_NAND_CS553X) += cs553x_nand.o obj-$(CONFIG_MTD_NAND_NDFC) += ndfc.o obj-$(CONFIG_MTD_NAND_ATMEL) += atmel_nand.o +obj-$(CONFIG_MTD_NAND_OMAP) += omap-nand-flash.o +obj-$(CONFIG_MTD_NAND_OMAP2) += omap2.o +obj-$(CONFIG_MTD_NAND_OMAP_HW) += omap-hw.o obj-$(CONFIG_MTD_NAND_CM_X270) += cmx270_nand.o obj-$(CONFIG_MTD_NAND_BASLER_EXCITE) += excite_nandflash.o obj-$(CONFIG_MTD_NAND_PXA3xx) += pxa3xx_nand.o
drivers/mtd/nand/omap-hw.c new file +860 -0
860 lines not on this page · raw message
drivers/mtd/nand/omap-nand-flash.c new file +186 -0
186 lines not on this page · raw message
drivers/mtd/nand/omap2.c new file +757 -0
757 lines not on this page · raw message
Signature · 6 lines
1.6.0.1.141.g445ca -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 23/33 add omap irda driver
From: Felipe Balbi <[email protected]>
--- drivers/net/irda/Kconfig | 10 + drivers/net/irda/Makefile | 1 + drivers/net/irda/omap-ir.c | 901 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 912 insertions(+), 0 deletions(-) create mode 100644 drivers/net/irda/omap-ir.c
drivers/net/irda/Kconfig +10 -0
@@ -342,5 +342,15 @@ config MCS_FIR To compile it as a module, choose M here: the module will be called mcs7780. +config OMAP_IR + tristate "OMAP IrDA(SIR/MIR/FIR)" + depends on IRDA && ARCH_OMAP + select GPIOEXPANDER_OMAP if (MACH_OMAP_H3 || MACH_OMAP_H4) + help + Say Y here if you want to build support for the Texas Instruments + OMAP IrDA device driver, which supports SIR/MIR/FIR. This driver + relies on platform specific helper routines so available capabilities + may vary from one OMAP target to another. + endmenu
drivers/net/irda/Makefile +1 -0
@@ -18,6 +18,7 @@ obj-$(CONFIG_VLSI_FIR) += vlsi_ir.o obj-$(CONFIG_VIA_FIR) += via-ircc.o obj-$(CONFIG_PXA_FICP) += pxaficp_ir.o obj-$(CONFIG_MCS_FIR) += mcs7780.o +obj-$(CONFIG_OMAP_IR) += omap-ir.o obj-$(CONFIG_AU1000_FIR) += au1k_ir.o # SIR drivers obj-$(CONFIG_IRTTY_SIR) += irtty-sir.o sir-dev.o
drivers/net/irda/omap-ir.c new file +901 -0
901 lines not on this page · raw message
Signature · 1 line
1.6.0.1.141.g445ca
PATCH 24/33 add bq27x00 battery driver
From: Felipe Balbi <[email protected]>
--- drivers/power/Kconfig | 21 ++ drivers/power/Makefile | 1 + drivers/power/bq27x00_battery.c | 564 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 586 insertions(+), 0 deletions(-) create mode 100644 drivers/power/bq27x00_battery.c
drivers/power/Kconfig +21 -0
@@ -49,6 +49,27 @@ config BATTERY_OLPC help Say Y to enable support for the battery on the OLPC laptop. +config BATTERY_BQ27x00 + tristate "BQ27x00 battery driver" + help + Say Y here to enable support for batteries with BQ27000 or BQ27200 chip. + +config BATTERY_BQ27000 + bool "BQ27000 battery driver" + depends on BATTERY_BQ27x00 + select W1 + select W1_SLAVE_BQ27000 + help + Say Y here to enable support for batteries with BQ27000(HDQ) chip. + +config BATTERY_BQ27200 + bool "BQ27200 battery driver" + depends on BATTERY_BQ27x00 + select I2C + select I2C_OMAP + help + Say Y here to enable support for batteries with BQ27200(I2C) chip. + config BATTERY_TOSA tristate "Sharp SL-6000 (tosa) battery" depends on MACH_TOSA && MFD_TC6393XB
drivers/power/Makefile +1 -0
@@ -20,5 +20,6 @@ obj-$(CONFIG_APM_POWER) += apm_power.o obj-$(CONFIG_BATTERY_DS2760) += ds2760_battery.o obj-$(CONFIG_BATTERY_PMU) += pmu_battery.o obj-$(CONFIG_BATTERY_OLPC) += olpc_battery.o +obj-$(CONFIG_BATTERY_BQ27x00) += bq27x00_battery.o obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.o obj-$(CONFIG_BATTERY_PALMTX) += palmtx_battery.o
drivers/power/bq27x00_battery.c new file +564 -0
564 lines not on this page · raw message
Signature · 1 line
1.6.0.1.141.g445ca
PATCH 25/33 add TWL4030 Battery Charger Interface driver
From: Felipe Balbi <[email protected]>
--- drivers/power/Kconfig | 8 + drivers/power/Makefile | 1 + drivers/power/twl4030_bci_battery.c | 1080 +++++++++++++++++++++++++++++++++++ 3 files changed, 1089 insertions(+), 0 deletions(-) create mode 100644 drivers/power/twl4030_bci_battery.c
drivers/power/Kconfig +8 -0
@@ -70,6 +70,14 @@ config BATTERY_BQ27200 help Say Y here to enable support for batteries with BQ27200(I2C) chip. +config TWL4030_BCI_BATTERY + tristate "OMAP TWL4030 BCI Battery driver" + depends on (MACH_OMAP_2430SDP || MACH_OMAP_3430SDP) && TWL4030_MADC + default y + help + Support for OMAP TWL4030 BCI Battery driver. + This driver can give support for TWL4030 Battery Charge Interface. + config BATTERY_TOSA tristate "Sharp SL-6000 (tosa) battery" depends on MACH_TOSA && MFD_TC6393XB
drivers/power/Makefile +1 -0
@@ -21,5 +21,6 @@ obj-$(CONFIG_BATTERY_DS2760) += ds2760_battery.o obj-$(CONFIG_BATTERY_PMU) += pmu_battery.o obj-$(CONFIG_BATTERY_OLPC) += olpc_battery.o obj-$(CONFIG_BATTERY_BQ27x00) += bq27x00_battery.o +obj-$(CONFIG_TWL4030_BCI_BATTERY) += twl4030_bci_battery.o obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.o obj-$(CONFIG_BATTERY_PALMTX) += palmtx_battery.o
drivers/power/twl4030_bci_battery.c new file +1080 -0
1,080 lines not on this page · raw message
Signature · 1 line
1.6.0.1.141.g445ca
PATCH 26/33 add TWL4030 RealTime Clock driver
From: Felipe Balbi <[email protected]>
--- drivers/rtc/Kconfig | 10 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-twl4030.c | 649 +++++++++++++++++++++++++++++++++++++++ include/linux/i2c/twl4030-rtc.h | 230 ++++++++++++++ 4 files changed, 890 insertions(+), 0 deletions(-) create mode 100644 drivers/rtc/rtc-twl4030.c create mode 100644 include/linux/i2c/twl4030-rtc.h
drivers/rtc/Kconfig +10 -0
@@ -246,6 +246,16 @@ config RTC_DRV_TWL92330 platforms. The support is integrated with the rest of the Menelaus driver; it's not separate module. +config RTC_DRV_TWL4030 + tristate "OMAP TWL4030 Real Time Clock" + depends on RTC_CLASS && TWL4030_CORE + help + If you say yes here you get support for internal Real-Time + Clock of TWL4030 chip. + + This driver can also be built as a module. If so, the module + will be called rtc-twl4030. + config RTC_DRV_S35390A tristate "Seiko Instruments S-35390A" select BITREVERSE
drivers/rtc/Makefile +1 -0
@@ -56,6 +56,7 @@ obj-$(CONFIG_RTC_DRV_SA1100) += rtc-sa1100.o obj-$(CONFIG_RTC_DRV_SH) += rtc-sh.o obj-$(CONFIG_RTC_DRV_STK17TA8) += rtc-stk17ta8.o obj-$(CONFIG_RTC_DRV_TEST) += rtc-test.o +obj-$(CONFIG_RTC_DRV_TWL4030) += rtc-twl4030.o obj-$(CONFIG_RTC_DRV_V3020) += rtc-v3020.o obj-$(CONFIG_RTC_DRV_VR41XX) += rtc-vr41xx.o obj-$(CONFIG_RTC_DRV_X1205) += rtc-x1205.o
drivers/rtc/rtc-twl4030.c new file +649 -0
649 lines not on this page · raw message
include/linux/i2c/twl4030-rtc.h new file +230 -0
230 lines not on this page · raw message
Signature · 1 line
1.6.0.1.141.g445ca
PATCH 27/33 add tsc210x driver
From: Felipe Balbi <[email protected]>
--- drivers/spi/Kconfig | 19 + drivers/spi/Makefile | 1 + drivers/spi/tsc210x.c | 1262 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1282 insertions(+), 0 deletions(-) create mode 100644 drivers/spi/tsc210x.c
drivers/spi/Kconfig +19 -0
@@ -225,6 +225,25 @@ config SPI_AT25 This driver can also be built as a module. If so, the module will be called at25. +config SPI_TSC210X + depends on SPI_MASTER && EXPERIMENTAL + tristate "TI TSC210x (TSC2101/TSC2102) support" + help + Say Y here if you want support for the TSC210x chips. Some + boards use these for touchscreen and audio support. + + These are members of a family of highly integrated PDA analog + interface circuit. They include a 12-bit ADC used for battery, + temperature, touchscreen, and other sensors. They also have + an audio DAC and amplifier, and in some models an audio ADC. + The audio support is highly chip-specific, but most of the + sensor support works the same. + + Note that the device has to be present in the board's SPI + devices table for this driver to load. This driver doesn't + automatically enable touchscreen, sensors or audio + functionality - enable these in their respective menus. + config SPI_SPIDEV tristate "User mode SPI device driver support" depends on EXPERIMENTAL
drivers/spi/Makefile +1 -0
@@ -35,6 +35,7 @@ obj-$(CONFIG_SPI_SH_SCI) += spi_sh_sci.o obj-$(CONFIG_SPI_AT25) += at25.o obj-$(CONFIG_SPI_SPIDEV) += spidev.o obj-$(CONFIG_SPI_TLE62X0) += tle62x0.o +obj-$(CONFIG_SPI_TSC210X) += tsc210x.o # ... add above this line ... # SPI slave controller drivers (upstream link)
drivers/spi/tsc210x.c new file +1262 -0
1,262 lines not on this page · raw message
Signature · 1 line
1.6.0.1.141.g445ca
PATCH 28/33 add tsc2301 driver
From: Felipe Balbi <[email protected]>
--- drivers/spi/Kconfig | 22 + drivers/spi/Makefile | 3 + drivers/spi/tsc2301-core.c | 301 +++++++++++++ drivers/spi/tsc2301-mixer.c | 1004 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1330 insertions(+), 0 deletions(-) create mode 100644 drivers/spi/tsc2301-core.c create mode 100644 drivers/spi/tsc2301-mixer.c
drivers/spi/Kconfig +22 -0
@@ -244,6 +244,28 @@ config SPI_TSC210X automatically enable touchscreen, sensors or audio functionality - enable these in their respective menus. +config SPI_TSC2301 + tristate "TSC2301 driver" + depends on SPI_MASTER + help + Say Y here if you have a TSC2301 chip connected to an SPI + bus on your board. + + The TSC2301 is a highly integrated PDA analog interface circuit. + It contains a complete 12-bit A/D resistive touch screen + converter (ADC) including drivers, touch pressure measurement + capability, keypad controller, and 8-bit D/A converter (DAC) output + for LCD contrast control. + + To compile this driver as a module, choose M here: the + module will be called tsc2301. + +config SPI_TSC2301_AUDIO + boolean "TSC2301 audio support" + depends on SPI_TSC2301 && SND + help + Say Y here for if you are using the audio features of TSC2301. + config SPI_SPIDEV tristate "User mode SPI device driver support" depends on EXPERIMENTAL
drivers/spi/Makefile +3 -0
@@ -36,6 +36,9 @@ obj-$(CONFIG_SPI_AT25) += at25.o obj-$(CONFIG_SPI_SPIDEV) += spidev.o obj-$(CONFIG_SPI_TLE62X0) += tle62x0.o obj-$(CONFIG_SPI_TSC210X) += tsc210x.o +obj-$(CONFIG_SPI_TSC2301) += tsc2301.o +tsc2301-objs := tsc2301-core.o +tsc2301-$(CONFIG_SPI_TSC2301_AUDIO) += tsc2301-mixer.o # ... add above this line ... # SPI slave controller drivers (upstream link)
drivers/spi/tsc2301-core.c new file +301 -0
301 lines not on this page · raw message
drivers/spi/tsc2301-mixer.c new file +1004 -0
1,004 lines not on this page · raw message
Signature · 6 lines
1.6.0.1.141.g445ca -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 29/33 add omap ehci bus glue
From: Felipe Balbi <[email protected]>
--- drivers/usb/host/Kconfig | 19 ++ drivers/usb/host/ehci-hcd.c | 5 + drivers/usb/host/ehci-omap.c | 562 ++++++++++++++++++++++++++++++++++++++++++ drivers/usb/host/ehci-omap.h | 125 ++++++++++ 4 files changed, 711 insertions(+), 0 deletions(-) create mode 100644 drivers/usb/host/ehci-omap.c create mode 100644 drivers/usb/host/ehci-omap.h
drivers/usb/host/Kconfig +19 -0
@@ -41,6 +41,25 @@ config USB_EHCI_HCD To compile this driver as a module, choose M here: the module will be called ehci-hcd. +choice + prompt "PHY/TLL mode" + depends on USB_EHCI_HCD && EXPERIMENTAL && ARCH_OMAP34XX + ---help--- + Choose PHY or TLL mode of operation + +config OMAP_EHCI_PHY_MODE + bool "PHY mode: ISP1504 on Port1/2 (NEW 3430ES2.0)" + depends on USB_EHCI_HCD && EXPERIMENTAL && ARCH_OMAP34XX + ---help--- + EHCI PHY mode. Port1 and Port2 are connected to ISP1504 transcievers + +config OMAP_EHCI_TLL_MODE + bool "TLL mode: (EXPERIMENTAL)" + depends on USB_EHCI_HCD && EXPERIMENTAL && ARCH_OMAP34XX + ---help--- + OMAP EHCI controller has TLL mode of operation for all 3 ports. + Use this mode when no transciever is present +endchoice config USB_EHCI_ROOT_HUB_TT bool "Root Hub Transaction Translators"
drivers/usb/host/ehci-hcd.c +5 -0
@@ -1009,6 +1009,11 @@ MODULE_LICENSE ("GPL");#define PLATFORM_DRIVER ehci_hcd_au1xxx_driver#endif +#ifdef CONFIG_ARCH_OMAP34XX +#include "ehci-omap.c" +#define PLATFORM_DRIVER ehci_hcd_omap_driver +#endif +#ifdef CONFIG_PPC_PS3 #include "ehci-ps3.c" #define PS3_SYSTEM_BUS_DRIVER ps3_ehci_driver
drivers/usb/host/ehci-omap.c new file +562 -0
562 lines not on this page · raw message
drivers/usb/host/ehci-omap.h new file +125 -0
125 lines not on this page · raw message
Signature · 1 line
1.6.0.1.141.g445ca
PATCH 30/33 add omap backlight support
From: Felipe Balbi <[email protected]>
--- drivers/video/backlight/Kconfig | 9 ++ drivers/video/backlight/Makefile | 1 + drivers/video/backlight/omap_bl.c | 218 +++++++++++++++++++++++++++++++++++++ 3 files changed, 228 insertions(+), 0 deletions(-) create mode 100644 drivers/video/backlight/omap_bl.c
drivers/video/backlight/Kconfig +9 -0
@@ -133,6 +133,15 @@ config BACKLIGHT_HP680 If you have a HP Jornada 680, say y to enable the backlight driver. +config BACKLIGHT_OMAP + tristate "OMAP LCD Backlight" + depends on BACKLIGHT_CLASS_DEVICE && (ARCH_OMAP1 || ARCH_OMAP2) + default y + help + This driver controls the LCD backlight level and power + for the PWL module of OMAP processors. Say Y if you plan + to use power saving. + config BACKLIGHT_PROGEAR tristate "Frontpath ProGear Backlight Driver" depends on BACKLIGHT_CLASS_DEVICE && PCI && X86
drivers/video/backlight/Makefile +1 -0
@@ -12,6 +12,7 @@ obj-$(CONFIG_BACKLIGHT_CORGI) += corgi_bl.o obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o obj-$(CONFIG_BACKLIGHT_OMAP1) += omap1_bl.o +obj-$(CONFIG_BACKLIGHT_OMAP) += omap_bl.o obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o
drivers/video/backlight/omap_bl.c new file +218 -0
218 lines not on this page · raw message
Signature · 1 line
1.6.0.1.141.g445ca
PATCH 31/33 add several omap lcd drivers
From: Felipe Balbi <[email protected]>
--- drivers/video/omap/Kconfig | 18 + drivers/video/omap/Makefile | 11 + drivers/video/omap/lcd_2430sdp.c | 182 ++++++++++ drivers/video/omap/lcd_ams_delta.c | 140 ++++++++ drivers/video/omap/lcd_apollon.c | 137 ++++++++ drivers/video/omap/lcd_h2.c | 155 +++++++++ drivers/video/omap/lcd_mipid.c | 617 ++++++++++++++++++++++++++++++++++ drivers/video/omap/lcd_omap2evm.c | 195 +++++++++++ drivers/video/omap/lcd_omap3beagle.c | 133 ++++++++ drivers/video/omap/lcd_omap3evm.c | 197 +++++++++++ drivers/video/omap/lcd_p2.c | 342 +++++++++++++++++++ 11 files changed, 2127 insertions(+), 0 deletions(-) create mode 100644 drivers/video/omap/lcd_2430sdp.c create mode 100644 drivers/video/omap/lcd_ams_delta.c create mode 100644 drivers/video/omap/lcd_apollon.c create mode 100644 drivers/video/omap/lcd_h2.c create mode 100644 drivers/video/omap/lcd_mipid.c create mode 100644 drivers/video/omap/lcd_omap2evm.c create mode 100644 drivers/video/omap/lcd_omap3beagle.c create mode 100644 drivers/video/omap/lcd_omap3evm.c create mode 100644 drivers/video/omap/lcd_p2.c
drivers/video/omap/Kconfig +18 -0
@@ -56,3 +56,21 @@ config FB_OMAP_LCDC_BLIZZARD help Say Y here if you want to have support for the external Epson Blizzard LCD controller. + +config FB_OMAP_MANUAL_UPDATE + bool "Default to manual update mode" + depends on FB_OMAP && FB_OMAP_LCDC_EXTERNAL + help + Say Y here, if your user-space applications are capable of + notifying the frame buffer driver when a change has occured in + the frame buffer content and thus a reload of the image data to + the external frame buffer is required. If unsure, say N. + +config FB_OMAP_LCD_MIPID + bool "MIPI DBI-C/DCS compatible LCD support" + depends on FB_OMAP && SPI_MASTER && CBUS_TAHVO + help + Say Y here if you want to have support for LCDs compatible with + the Mobile Industry Processor Interface DBI-C/DCS + specification. (Supported LCDs: Philips LPH8923, Sharp LS041Y3) +
drivers/video/omap/Makefile +11 -0
@@ -8,6 +8,7 @@ objs-yy := omapfb_main.o objs-y$(CONFIG_ARCH_OMAP1) += lcdc.o objs-y$(CONFIG_ARCH_OMAP2) += dispc.o +objs-y$(CONFIG_ARCH_OMAP3) += dispc.o objs-$(CONFIG_ARCH_OMAP1)$(CONFIG_FB_OMAP_LCDC_EXTERNAL) += sossi.o objs-$(CONFIG_ARCH_OMAP2)$(CONFIG_FB_OMAP_LCDC_EXTERNAL) += rfbi.o
@@ -15,8 +16,10 @@ objs-$(CONFIG_ARCH_OMAP2)$(CONFIG_FB_OMAP_LCDC_EXTERNAL) += rfbi.o objs-y$(CONFIG_FB_OMAP_LCDC_HWA742) += hwa742.o objs-y$(CONFIG_FB_OMAP_LCDC_BLIZZARD) += blizzard.o +objs-y$(CONFIG_MACH_AMS_DELTA) += lcd_ams_delta.o objs-y$(CONFIG_MACH_OMAP_H4) += lcd_h4.o objs-y$(CONFIG_MACH_OMAP_H3) += lcd_h3.o +objs-y$(CONFIG_MACH_OMAP_H2) += lcd_h2.o objs-y$(CONFIG_MACH_OMAP_PALMTE) += lcd_palmte.o objs-y$(CONFIG_MACH_OMAP_PALMTT) += lcd_palmtt.o objs-y$(CONFIG_MACH_OMAP_PALMZ71) += lcd_palmz71.o
@@ -25,5 +28,13 @@ objs-$(CONFIG_ARCH_OMAP15XX)$(CONFIG_MACH_OMAP_INNOVATOR) += lcd_inn1510.o objs-y$(CONFIG_MACH_OMAP_OSK) += lcd_osk.o objs-y$(CONFIG_MACH_SX1) += lcd_sx1.o +objs-y$(CONFIG_MACH_OMAP_APOLLON) += lcd_apollon.o +objs-y$(CONFIG_MACH_OMAP_2430SDP) += lcd_2430sdp.o +objs-y$(CONFIG_MACH_OMAP_3430SDP) += lcd_2430sdp.o +objs-y$(CONFIG_MACH_OMAP2EVM) += lcd_omap2evm.o +objs-y$(CONFIG_MACH_OMAP3EVM) += lcd_omap3evm.o +objs-y$(CONFIG_MACH_OMAP3_BEAGLE) += lcd_omap3beagle.o +objs-y$(CONFIG_FB_OMAP_LCD_MIPID) += lcd_mipid.o + omapfb-objs := $(objs-yy)
drivers/video/omap/lcd_2430sdp.c new file +182 -0
182 lines not on this page · raw message
drivers/video/omap/lcd_ams_delta.c new file +140 -0
140 lines not on this page · raw message
drivers/video/omap/lcd_apollon.c new file +137 -0
137 lines not on this page · raw message
drivers/video/omap/lcd_h2.c new file +155 -0
155 lines not on this page · raw message
drivers/video/omap/lcd_mipid.c new file +617 -0
617 lines not on this page · raw message
drivers/video/omap/lcd_omap2evm.c new file +195 -0
195 lines not on this page · raw message
drivers/video/omap/lcd_omap3beagle.c new file +133 -0
133 lines not on this page · raw message
drivers/video/omap/lcd_omap3evm.c new file +197 -0
197 lines not on this page · raw message
drivers/video/omap/lcd_p2.c new file +342 -0
342 lines not on this page · raw message
Signature · 1 line
1.6.0.1.141.g445ca
PATCH 32/33 add omap 1-wire interface driver
From: Felipe Balbi <[email protected]>
--- arch/arm/plat-omap/include/mach/irqs.h | 2 + drivers/w1/masters/Kconfig | 7 + drivers/w1/masters/Makefile | 1 + drivers/w1/masters/omap_hdq.c | 704 ++++++++++++++++++++++++++++++++ 4 files changed, 714 insertions(+), 0 deletions(-) create mode 100644 drivers/w1/masters/omap_hdq.c
arch/arm/plat-omap/include/mach/irqs.h +2 -0
@@ -54,6 +54,8 @@#define INT_TIMER2 30#define INT_LCD_CTRL 31 +#define INT_24XX_HDQ_IRQ 58/* Temporarily here for driver to build */ +/* * OMAP-1510 specific IRQ numbers for interrupt handler 1 */
drivers/w1/masters/Kconfig +7 -0
@@ -42,6 +42,13 @@ config W1_MASTER_DS1WM in HP iPAQ devices like h5xxx, h2200, and ASIC3-based like hx4700. +config HDQ_MASTER_OMAP + tristate "OMAP HDQ driver" + depends on ARCH_OMAP2430 || ARCH_OMAP34XX + help + Say Y here if you want support for the 1-wire or HDQ Interface + on an OMAP processor. + config W1_MASTER_GPIO tristate "GPIO 1-wire busmaster" depends on GENERIC_GPIO
drivers/w1/masters/Makefile +1 -0
@@ -6,4 +6,5 @@ obj-$(CONFIG_W1_MASTER_MATROX) += matrox_w1.o obj-$(CONFIG_W1_MASTER_DS2490) += ds2490.o obj-$(CONFIG_W1_MASTER_DS2482) += ds2482.o obj-$(CONFIG_W1_MASTER_DS1WM) += ds1wm.o +obj-$(CONFIG_HDQ_MASTER_OMAP) += omap_hdq.o obj-$(CONFIG_W1_MASTER_GPIO) += w1-gpio.o
drivers/w1/masters/omap_hdq.c new file +704 -0
704 lines not on this page · raw message
Signature · 1 line
1.6.0.1.141.g445ca
PATCH 33/33 add bq27000 1-wire slave driver
From: Felipe Balbi <[email protected]>
--- drivers/w1/slaves/Kconfig | 8 +++ drivers/w1/slaves/Makefile | 2 +- drivers/w1/slaves/w1_bq27000.c | 120 ++++++++++++++++++++++++++++++++++++++++ drivers/w1/w1.h | 1 + drivers/w1/w1_io.c | 3 +- 5 files changed, 132 insertions(+), 2 deletions(-) create mode 100644 drivers/w1/slaves/w1_bq27000.c
drivers/w1/slaves/Kconfig +8 -0
@@ -44,4 +44,12 @@ config W1_SLAVE_DS2760 If you are unsure, say N. +config W1_SLAVE_BQ27000 + tristate "BQ27000 slave support" + depends on W1 + help + Say Y here if you want to use a hdq + bq27000 slave support. + + endmenu
drivers/w1/slaves/Makefile +1 -1
@@ -6,4 +6,4 @@ obj-$(CONFIG_W1_SLAVE_THERM) += w1_therm.o obj-$(CONFIG_W1_SLAVE_SMEM) += w1_smem.o obj-$(CONFIG_W1_SLAVE_DS2433) += w1_ds2433.o obj-$(CONFIG_W1_SLAVE_DS2760) += w1_ds2760.o - +obj-$(CONFIG_W1_SLAVE_BQ27000) += w1_bq27000.o
drivers/w1/slaves/w1_bq27000.c new file +120 -0
120 lines not on this page · raw message
drivers/w1/w1.h +1 -0
@@ -189,6 +189,7 @@ struct w1_master *w1_search_master_id(u32 id);u8 w1_triplet (struct w1_master *dev,int bdir);void w1_write_8 (struct w1_master *,u8 ); +u8 w1_read_8 (struct w1_master *);int w1_reset_bus (struct w1_master *);u8 w1_calc_crc8 (u8 *,int );void w1_write_block (struct w1_master *,const u8 *,int );
drivers/w1/w1_io.c +2 -1
@@ -177,7 +177,7 @@ u8 w1_triplet(struct w1_master *dev, int bdir)* @param dev the master device * @return the byte read */ -static u8 w1_read_8 (struct w1_master * dev) +u8 w1_read_8 (struct w1_master *dev) {int i;u8 res =0 ;
@@ -190,6 +190,7 @@ static u8 w1_read_8(struct w1_master * dev)return res; } +EXPORT_SYMBOL_GPL (w1_read_8);/** * Writes a series of bytes.
Signature · 1 line
1.6.0.1.141.g445ca
Re: [PATCH 32/33] add omap 1-wire interface driver
In reply to Felipe BalbiHi,
The HDQ patchset that I posted to Tony were given ACK by Evgeniy Polyakov on the omap list. I hope that helps.
Regards,
Madhu
----- Original Message -----
From: "Felipe Balbi" <[email protected]>
To: <[email protected]>
Cc: "Felipe Balbi" <[email protected]>
Sent: Saturday, August 30, 2008 10:46 PM
Subject: [PATCH 32/33] add omap 1-wire interface driver
Quoted 771 lines
From: Felipe Balbi <[email protected]>
Signed-off-by Felipe Balbi <[email protected]>---
arch/arm/plat-omap/include/mach/irqs.h | 2 + drivers/w1/masters/Kconfig | 7 + drivers/w1/masters/Makefile | 1 + drivers/w1/masters/omap_hdq.c | 704 ++++++++++++++++++++++++++++++++ 4 files changed, 714 insertions(+), 0 deletions(-)create mode 100644
drivers/w1/masters/omap_hdq.carch/arm/plat-omap/include/mach/irqs.h +2
-0@@ -54,6 +54,8 @@#define INT_TIMER2 30#define INT_LCD_CTRL 31 +#define INT_24XX_HDQ_IRQ 58/* Temporarily here for driver to build */ +/* * OMAP-1510 specific IRQ numbers for interrupt handler 1 */ drivers/w1/masters/Kconfig +7
-0@@ -42,6 +42,13 @@ config W1_MASTER_DS1WM in HP iPAQ devices like h5xxx, h2200, and ASIC3-based like hx4700. +config HDQ_MASTER_OMAP + tristate "OMAP HDQ driver" + depends on ARCH_OMAP2430 || ARCH_OMAP34XX + help + Say Y here if you want support for the 1-wire or HDQ Interface + on an OMAP processor. +config
W1_MASTER_GPIO
tristate "GPIO 1-wire busmaster"
depends onGENERIC_GPIOdrivers/w1/masters/Makefile +0
-0@@ -6,4 +6,5 @@ obj-$(CONFIG_W1_MASTER_MATROX) += matrox_w1.oobj-$(CONFIG_W1_MASTER_DS2490) += ds2490.o
obj-$(CONFIG_W1_MASTER_DS2482) += ds2482.o
obj-$(CONFIG_W1_MASTER_DS1WM) += ds1wm.o
+obj-$(CONFIG_HDQ_MASTER_OMAP) += omap_hdq.o
obj-$(CONFIG_W1_MASTER_GPIO) += w1-gpio.odrivers/w1/masters/omap_hdq.c new file +704
-0@@ -0,0 +1,704 @@ +/* +* drivers/w1/masters/omap_hdq.c +* +* Copyright (C) 2007 Texas Instruments, Inc. +* +* This file is licensed under the terms of the GNU General Public License +* version 2. This program is licensed "as is" without any warranty of any +* kind, whether express or implied. +* +*/ +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/interrupt.h> +#include <linux/err.h> +#include <linux/clk.h> +#include <linux/io.h> +#include <asm/irq.h> +#include <mach/hardware.h> + +#include "../w1.h" +#include "../w1_int.h" + +#define MOD_NAME "OMAP_HDQ:" + +#define OMAP_HDQ_REVISION 0x00 +#define OMAP_HDQ_TX_DATA 0x04 +#define OMAP_HDQ_RX_DATA 0x08 +#define OMAP_HDQ_CTRL_STATUS 0x0c +#define OMAP_HDQ_CTRL_STATUS_INTERRUPTMASK (1<<6) +#define OMAP_HDQ_CTRL_STATUS_CLOCKENABLE (1<<5) +#define OMAP_HDQ_CTRL_STATUS_GO (1<<4) +#define OMAP_HDQ_CTRL_STATUS_INITIALIZATION (1<<2) +#define OMAP_HDQ_CTRL_STATUS_DIR (1<<1) +#define OMAP_HDQ_CTRL_STATUS_MODE (1<<0) +#define OMAP_HDQ_INT_STATUS 0x10 +#define OMAP_HDQ_INT_STATUS_TXCOMPLETE (1<<2) +#define OMAP_HDQ_INT_STATUS_RXCOMPLETE (1<<1) +#define OMAP_HDQ_INT_STATUS_TIMEOUT (1<<0) +#define OMAP_HDQ_SYSCONFIG 0x14 +#define OMAP_HDQ_SYSCONFIG_SOFTRESET (1<<1) +#define OMAP_HDQ_SYSCONFIG_AUTOIDLE (1<<0) +#define OMAP_HDQ_SYSSTATUS 0x18 +#define OMAP_HDQ_SYSSTATUS_RESETDONE (1<<0) + +#define OMAP_HDQ_FLAG_CLEAR 0 +#define OMAP_HDQ_FLAG_SET 1 +#define OMAP_HDQ_TIMEOUT (HZ/5) + +#define OMAP_HDQ_MAX_USER 4 + +DECLARE_WAIT_QUEUE_HEAD (hdq_wait_queue); +int W1_ID ; + +struct hdq_data { +resource_size_t hdq_base; +struct semaphore hdq_semlock; +int hdq_usecount; +struct clk *hdq_ick; +struct clk *hdq_fck; +u8 hdq_irqstatus; +spinlock_t hdq_spinlock; +}; + +static struct hdq_data *hdq_data; + +static int omap_hdq_get (void ); +static int omap_hdq_put (void ); +static int omap_hdq_break (void ); + +static int __init omap_hdq_probe (struct platform_device *pdev); +static int omap_hdq_remove (struct platform_device *pdev); + +static struct platform_driver omap_hdq_driver = { + .probe = omap_hdq_probe, + .remove = omap_hdq_remove, + .suspend =NULL , + .resume =NULL , + .driver = { + .name ="omap_hdq" , + }, +}; + +static u8 omap_w1_read_byte (void *data); +static void omap_w1_write_byte (void *data,u8 byte); +static u8 omap_w1_reset_bus (void *data); +static void omap_w1_search_bus (void *data,u8 search_type, +w1_slave_found_callback slave_found); + +static struct w1_bus_master omap_w1_master = { + .read_byte = omap_w1_read_byte, + .write_byte = omap_w1_write_byte, + .reset_bus = omap_w1_reset_bus, + .search = omap_w1_search_bus, +}; + +/* +* HDQ register I/O routines +*/ +static inline u8 +hdq_reg_in (u32 offset) +{ +return omap_readb (hdq_data->hdq_base + offset); +} + +static inline u8 +hdq_reg_out (u32 offset,u8 val) +{ +omap_writeb (val, hdq_data->hdq_base + offset); +return val; +} + +static inline u8 +hdq_reg_merge (u32 offset,u8 val,u8 mask) +{ +u8 new_val = (omap_readb (hdq_data->hdq_base + offset) & ~mask) + | (val & mask); +omap_writeb (new_val, hdq_data->hdq_base + offset); +return new_val; +} + +/* +* Wait for one or more bits in flag change. +* HDQ_FLAG_SET: wait until any bit in the flag is set. +* HDQ_FLAG_CLEAR: wait until all bits in the flag are cleared. +* return 0 on success and -ETIMEDOUT in the case of timeout. +*/ +static int +hdq_wait_for_flag (u32 offset,u8 flag,u8 flag_set,u8 *status) +{ +int ret =0 ; +unsigned long timeout = jiffies +OMAP_HDQ_TIMEOUT ; + +if (flag_set ==OMAP_HDQ_FLAG_CLEAR ) { +/* wait for the flag clear */ +while (((*status =hdq_reg_in (offset)) & flag) + &&time_before (jiffies, timeout)) { +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (1 ); + } +if (unlikely (*status & flag)) + ret = -ETIMEDOUT ; + }else if (flag_set ==OMAP_HDQ_FLAG_SET ) { +/* wait for the flag set */ +while (!((*status =hdq_reg_in (offset)) & flag) + &&time_before (jiffies, timeout)) { +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (1 ); + } +if (unlikely (!(*status & flag))) + ret = -ETIMEDOUT ; + }else +return -EINVAL ; + +return ret; +} + +/* +* write out a byte and fill *status with HDQ_INT_STATUS +*/ +static int +hdq_write_byte (u8 val,u8 *status) +{ +int ret; +u8 tmp_status; +unsigned long irqflags; + + *status =0 ; + +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); +/* clear interrupt flags via a dummy read */ +hdq_reg_in (OMAP_HDQ_INT_STATUS ); +/* ISR loads it with new INT_STATUS */ + hdq_data->hdq_irqstatus =0 ; +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); + +hdq_reg_out (OMAP_HDQ_TX_DATA , val); + +/* set the GO bit */ +hdq_reg_merge (OMAP_HDQ_CTRL_STATUS ,OMAP_HDQ_CTRL_STATUS_GO , +OMAP_HDQ_CTRL_STATUS_DIR |OMAP_HDQ_CTRL_STATUS_GO ); +/* wait for the TXCOMPLETE bit */ + ret =wait_event_interruptible_timeout (hdq_wait_queue, + hdq_data->hdq_irqstatus,OMAP_HDQ_TIMEOUT ); +if (unlikely (ret <0 )) { +pr_debug ("wait interrupted" ); +return -EINTR ; + } + +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); + *status = hdq_data->hdq_irqstatus; +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); +/* check irqstatus */ +if (!(*status &OMAP_HDQ_INT_STATUS_TXCOMPLETE )) { +pr_debug ("timeout waiting for TXCOMPLETE/RXCOMPLETE, %x" , + *status); +return -ETIMEDOUT ; + } + +/* wait for the GO bit return to zero */ + ret =hdq_wait_for_flag (OMAP_HDQ_CTRL_STATUS ,OMAP_HDQ_CTRL_STATUS_GO , +OMAP_HDQ_FLAG_CLEAR , &tmp_status); +if (ret) { +pr_debug ("timeout waiting GO bit return to zero, %x" , + tmp_status); +return ret; + } + +return ret; +} + +/* +* HDQ Interrupt service routine. +*/ +static irqreturn_t +hdq_isr (int irq,void *arg) +{ +unsigned long irqflags; + +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); + hdq_data->hdq_irqstatus =hdq_reg_in (OMAP_HDQ_INT_STATUS ); +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); +pr_debug ("hdq_isr: %x" , hdq_data->hdq_irqstatus); + +if (hdq_data->hdq_irqstatus & + (OMAP_HDQ_INT_STATUS_TXCOMPLETE |OMAP_HDQ_INT_STATUS_RXCOMPLETE + |OMAP_HDQ_INT_STATUS_TIMEOUT )) { +/* wake up sleeping process */ +wake_up_interruptible (&hdq_wait_queue); + } + +return IRQ_HANDLED ; +} + +/* +* HDQ Mode: always return success. +*/ +static u8 omap_w1_reset_bus (void *data) +{ +return 0 ; +} + +/* +* W1 search callback function. +*/ +static void omap_w1_search_bus (void *data,u8 search_type, +w1_slave_found_callback slave_found) +{ +u64 module_id, rn_le, cs, id; + +if (W1_ID ) + module_id =W1_ID ; +else + module_id =0x1 ; + + rn_le =cpu_to_le64 (module_id); +/* +* HDQ might not obey truly the 1-wire spec. +* So calculate CRC based on module parameter. +*/ + cs =w1_calc_crc8 ((u8 *)&rn_le,7 ); + id = (cs <<56 ) | module_id; + +slave_found (data, id); +} + +static int +_omap_hdq_reset (void ) +{ +int ret; +u8 tmp_status; + +hdq_reg_out (OMAP_HDQ_SYSCONFIG ,OMAP_HDQ_SYSCONFIG_SOFTRESET ); +/* +* Select HDQ mode & enable clocks. +* It is observed that INT flags can't be cleared via a read and GO/INIT +* won't return to zero if interrupt is disabled. So we always enable +* interrupt. +*/ +hdq_reg_out (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_CLOCKENABLE | +OMAP_HDQ_CTRL_STATUS_INTERRUPTMASK ); + +/* wait for reset to complete */ + ret =hdq_wait_for_flag (OMAP_HDQ_SYSSTATUS , +OMAP_HDQ_SYSSTATUS_RESETDONE ,OMAP_HDQ_FLAG_SET , &tmp_status); +if (ret) +pr_debug ("timeout waiting HDQ reset, %x" , tmp_status); +else { +hdq_reg_out (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_CLOCKENABLE | +OMAP_HDQ_CTRL_STATUS_INTERRUPTMASK ); +hdq_reg_out (OMAP_HDQ_SYSCONFIG ,OMAP_HDQ_SYSCONFIG_AUTOIDLE ); + } + +return ret; +} + +/* +* Issue break pulse to the device. +*/ +static int +omap_hdq_break () +{ +int ret; +u8 tmp_status; +unsigned long irqflags; + + ret =down_interruptible (&hdq_data->hdq_semlock); +if (ret <0 ) +return -EINTR ; + +if (!hdq_data->hdq_usecount) { +up (&hdq_data->hdq_semlock); +return -EINVAL ; + } + +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); +/* clear interrupt flags via a dummy read */ +hdq_reg_in (OMAP_HDQ_INT_STATUS ); +/* ISR loads it with new INT_STATUS */ + hdq_data->hdq_irqstatus =0 ; +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); + +/* set the INIT and GO bit */ +hdq_reg_merge (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_INITIALIZATION |OMAP_HDQ_CTRL_STATUS_GO , +OMAP_HDQ_CTRL_STATUS_DIR |OMAP_HDQ_CTRL_STATUS_INITIALIZATION | +OMAP_HDQ_CTRL_STATUS_GO ); + +/* wait for the TIMEOUT bit */ + ret =wait_event_interruptible_timeout (hdq_wait_queue, + hdq_data->hdq_irqstatus,OMAP_HDQ_TIMEOUT ); +if (unlikely (ret <0 )) { +pr_debug ("wait interrupted" ); +up (&hdq_data->hdq_semlock); +return -EINTR ; + } + +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); + tmp_status = hdq_data->hdq_irqstatus; +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); +/* check irqstatus */ +if (!(tmp_status &OMAP_HDQ_INT_STATUS_TIMEOUT )) { +pr_debug ("timeout waiting for TIMEOUT, %x" , tmp_status); +up (&hdq_data->hdq_semlock); +return -ETIMEDOUT ; + } +/* +* wait for both INIT and GO bits rerurn to zero. +* zero wait time expected for interrupt mode. +*/ + ret =hdq_wait_for_flag (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_INITIALIZATION | +OMAP_HDQ_CTRL_STATUS_GO ,OMAP_HDQ_FLAG_CLEAR , + &tmp_status); +if (ret) +pr_debug ("timeout waiting INIT&GO bits return to zero, %x" , + tmp_status); + +up (&hdq_data->hdq_semlock); +return ret; +} + +static int hdq_read_byte (u8 *val) +{ +int ret; +u8 status; +unsigned long irqflags; + + ret =down_interruptible (&hdq_data->hdq_semlock); +if (ret <0 ) +return -EINTR ; + +if (!hdq_data->hdq_usecount) { +up (&hdq_data->hdq_semlock); +return -EINVAL ; + } + +if (!(hdq_data->hdq_irqstatus &OMAP_HDQ_INT_STATUS_RXCOMPLETE )) { +hdq_reg_merge (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_DIR |OMAP_HDQ_CTRL_STATUS_GO , +OMAP_HDQ_CTRL_STATUS_DIR |OMAP_HDQ_CTRL_STATUS_GO ); +/* +* The RX comes immediately after TX. It +* triggers another interrupt before we +* sleep. So we have to wait for RXCOMPLETE bit. +*/ + { +unsigned long timeout = jiffies +OMAP_HDQ_TIMEOUT ; +while (!(hdq_data->hdq_irqstatus + &OMAP_HDQ_INT_STATUS_RXCOMPLETE ) + &&time_before (jiffies, timeout)) { +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (1 ); + } + } +hdq_reg_merge (OMAP_HDQ_CTRL_STATUS ,0 , +OMAP_HDQ_CTRL_STATUS_DIR ); +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); + status = hdq_data->hdq_irqstatus; +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); +/* check irqstatus */ +if (!(status &OMAP_HDQ_INT_STATUS_RXCOMPLETE )) { +pr_debug ("timeout waiting for RXCOMPLETE, %x" , status); +up (&hdq_data->hdq_semlock); +return -ETIMEDOUT ; + } + } +/* the data is ready. Read it in! */ + *val =hdq_reg_in (OMAP_HDQ_RX_DATA ); +up (&hdq_data->hdq_semlock); + +return 0 ; + +} + +/* +* Enable clocks and set the controller to HDQ mode. +*/ +static int +omap_hdq_get () +{ +int ret =0 ; + + ret =down_interruptible (&hdq_data->hdq_semlock); +if (ret <0 ) +return -EINTR ; + +if (OMAP_HDQ_MAX_USER == hdq_data->hdq_usecount) { +pr_debug ("attempt to exceed the max use count" ); +up (&hdq_data->hdq_semlock); + ret = -EINVAL ; + }else { + hdq_data->hdq_usecount++; +try_module_get (THIS_MODULE ); +if (1 == hdq_data->hdq_usecount) { +if (clk_enable (hdq_data->hdq_ick)) { +pr_debug ("Can not enable ick\n" ); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +up (&hdq_data->hdq_semlock); +return -ENODEV ; + } +if (clk_enable (hdq_data->hdq_fck)) { +pr_debug ("Can not enable fck\n" ); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +up (&hdq_data->hdq_semlock); +return -ENODEV ; + } + +/* make sure HDQ is out of reset */ +if (!(hdq_reg_in (OMAP_HDQ_SYSSTATUS ) & +OMAP_HDQ_SYSSTATUS_RESETDONE )) { + ret =_omap_hdq_reset (); +if (ret) +/* back up the count */ + hdq_data->hdq_usecount--; + }else { +/* select HDQ mode & enable clocks */ +hdq_reg_out (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_CLOCKENABLE | +OMAP_HDQ_CTRL_STATUS_INTERRUPTMASK ); +hdq_reg_out (OMAP_HDQ_SYSCONFIG , +OMAP_HDQ_SYSCONFIG_AUTOIDLE ); +hdq_reg_in (OMAP_HDQ_INT_STATUS ); + } + } + } +up (&hdq_data->hdq_semlock); +return ret; +} + +/* +* Disable clocks to the module. +*/ +static int +omap_hdq_put () +{ +int ret =0 ; + + ret =down_interruptible (&hdq_data->hdq_semlock); +if (ret <0 ) +return -EINTR ; + +if (0 == hdq_data->hdq_usecount) { +pr_debug ("attempt to decrement use count when it is zero" ); + ret = -EINVAL ; + }else { + hdq_data->hdq_usecount--; +module_put (THIS_MODULE ); +if (0 == hdq_data->hdq_usecount) { +clk_disable (hdq_data->hdq_ick); +clk_disable (hdq_data->hdq_fck); + } + } +up (&hdq_data->hdq_semlock); +return ret; +} + +/* +* Used to control the call to omap_hdq_get and omap_hdq_put. +* HDQ Protocol: Write the CMD|REG_address first, followed by +* the data wrire or read. +*/ +static int init_trans; + +/* +* Read a byte of data from the device. +*/ +static u8 omap_w1_read_byte (void *data) +{ +u8 val; +int ret; + + ret =hdq_read_byte (&val); +if (ret) { + init_trans =0 ; +omap_hdq_put (); +return -1 ; + } + +/* Write followed by a read, release the module */ +if (init_trans) { + init_trans =0 ; +omap_hdq_put (); + } + +return val; +} + +/* +* Write a byte of data to the device. +*/ +static void omap_w1_write_byte (void *data,u8 byte) +{ +u8 status; + +/* First write to initialize the transfer */ +if (init_trans ==0 ) +omap_hdq_get (); + + init_trans++; + +hdq_write_byte (byte, &status); +pr_debug ("Ctrl status %x\n" , status); + +/* Second write, data transfered. Release the module */ +if (init_trans >1 ) { +omap_hdq_put (); + init_trans =0 ; + } + +return ; +} + +static int __init omap_hdq_probe (struct platform_device *pdev) +{ +struct resource *res; +int ret, irq; +u8 rev; + +if (!pdev) +return -ENODEV ; + + hdq_data =kmalloc (sizeof (*hdq_data),GFP_KERNEL ); +if (!hdq_data) +return -ENODEV ; + +platform_set_drvdata (pdev, hdq_data); + + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (res ==NULL ) { +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return -ENXIO ; + } + + hdq_data->hdq_base = res->start; + +/* get interface & functional clock objects */ + hdq_data->hdq_ick =clk_get (&pdev->dev,"hdq_ick" ); + hdq_data->hdq_fck =clk_get (&pdev->dev,"hdq_fck" ); + +if (IS_ERR (hdq_data->hdq_ick) ||IS_ERR (hdq_data->hdq_fck)) { +pr_debug ("Can't get HDQ clock objects\n" ); +if (IS_ERR (hdq_data->hdq_ick)) { + ret =PTR_ERR (hdq_data->hdq_ick); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return ret; + } +if (IS_ERR (hdq_data->hdq_fck)) { + ret =PTR_ERR (hdq_data->hdq_fck); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return ret; + } + } + + hdq_data->hdq_usecount =0 ; +sema_init (&hdq_data->hdq_semlock,1 ); + +if (clk_enable (hdq_data->hdq_ick)) { +pr_debug ("Can not enable ick\n" ); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return -ENODEV ; + } + +if (clk_enable (hdq_data->hdq_fck)) { +pr_debug ("Can not enable fck\n" ); +clk_disable (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return -ENODEV ; + } + + rev =hdq_reg_in (OMAP_HDQ_REVISION ); +pr_info ("OMAP HDQ Hardware Revision %c.%c. Driver in %s mode.\n" , + (rev >>4 ) +'0' , (rev &0x0f ) +'0' ,"Interrupt" ); + +spin_lock_init (&hdq_data->hdq_spinlock); +omap_hdq_break (); + + irq =platform_get_irq (pdev,0 ); +if (irq <0 ) { +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return -ENXIO ; + } + +if (request_irq (irq, hdq_isr,IRQF_DISABLED ,"OMAP HDQ" , + &hdq_data->hdq_semlock)) { +pr_debug ("request_irq failed\n" ); +clk_disable (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return -ENODEV ; + } + +/* don't clock the HDQ until it is needed */ +clk_disable (hdq_data->hdq_ick); +clk_disable (hdq_data->hdq_fck); + + ret =w1_add_master_device (&omap_w1_master); +if (ret) { +pr_debug ("Failure in registering w1 master\n" ); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return ret; + } + +return 0 ; +} + +static int omap_hdq_remove (struct platform_device *pdev) +{ +down_interruptible (&hdq_data->hdq_semlock); +if (0 != hdq_data->hdq_usecount) { +pr_debug ("removed when use count is not zero\n" ); +return -EBUSY ; + } +up (&hdq_data->hdq_semlock); + +/* remove module dependency */ +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +free_irq (INT_24XX_HDQ_IRQ , &hdq_data->hdq_semlock); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); + +return 0 ; +} + +static int __init +omap_hdq_init (void ) +{ +return platform_driver_register (&omap_hdq_driver); +} + +static void __exit +omap_hdq_exit (void ) +{ +platform_driver_unregister (&omap_hdq_driver); +} + +module_init (omap_hdq_init); +module_exit (omap_hdq_exit); + +module_param (W1_ID , int,S_IRUSR ); + +MODULE_AUTHOR ("Texas Instruments" ); +MODULE_DESCRIPTION ("HDQ driver Library" ); +MODULE_LICENSE ("GPL" );Signature · 6 lines
1.6.0.1.141.g445ca -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Tony Lindgren
maintainerRe: [PATCH 32/33] add omap 1-wire interface driver
Quoted 3 lines · Madhusudhan Chikkature
Hi,
The HDQ patchset that I posted to Tony were given ACK by Evgeniy Polyakov on the omap list. I hope that helps.
Madhu, can you post your 1-wire driver to LKML and Cc Evgeniy Polyakov so we can get that integrated? Also Cc l-o list.
Thanks,
Tony
Quoted 787 lines
Regards,
Madhu----- Original Message -----
From: "Felipe Balbi" <[email protected]>
To: <[email protected]>
Cc: "Felipe Balbi" <[email protected]>
Sent: Saturday, August 30, 2008 10:46 PM
Subject: [PATCH 32/33] add omap 1-wire interface driverQuoted 771 lines
From: Felipe Balbi <[email protected]>
Signed-off-by Felipe Balbi <[email protected]>---
arch/arm/plat-omap/include/mach/irqs.h | 2 + drivers/w1/masters/Kconfig | 7 + drivers/w1/masters/Makefile | 1 + drivers/w1/masters/omap_hdq.c | 704 ++++++++++++++++++++++++++++++++ 4 files changed, 714 insertions(+), 0 deletions(-)create mode 100644
drivers/w1/masters/omap_hdq.carch/arm/plat-omap/include/mach/irqs.h +2
-0@@ -54,6 +54,8 @@#define INT_TIMER2 30#define INT_LCD_CTRL 31 +#define INT_24XX_HDQ_IRQ 58/* Temporarily here for driver to build */ +/* * OMAP-1510 specific IRQ numbers for interrupt handler 1 */ drivers/w1/masters/Kconfig +7
-0@@ -42,6 +42,13 @@ config W1_MASTER_DS1WM in HP iPAQ devices like h5xxx, h2200, and ASIC3-based like hx4700. +config HDQ_MASTER_OMAP + tristate "OMAP HDQ driver" + depends on ARCH_OMAP2430 || ARCH_OMAP34XX + help + Say Y here if you want support for the 1-wire or HDQ Interface + on an OMAP processor. +config
W1_MASTER_GPIO
tristate "GPIO 1-wire busmaster"
depends onGENERIC_GPIOdrivers/w1/masters/Makefile +0
-0@@ -6,4 +6,5 @@ obj-$(CONFIG_W1_MASTER_MATROX) += matrox_w1.oobj-$(CONFIG_W1_MASTER_DS2490) += ds2490.o
obj-$(CONFIG_W1_MASTER_DS2482) += ds2482.o
obj-$(CONFIG_W1_MASTER_DS1WM) += ds1wm.o
+obj-$(CONFIG_HDQ_MASTER_OMAP) += omap_hdq.o
obj-$(CONFIG_W1_MASTER_GPIO) += w1-gpio.odrivers/w1/masters/omap_hdq.c new file +704
-0@@ -0,0 +1,704 @@ +/* +* drivers/w1/masters/omap_hdq.c +* +* Copyright (C) 2007 Texas Instruments, Inc. +* +* This file is licensed under the terms of the GNU General Public License +* version 2. This program is licensed "as is" without any warranty of any +* kind, whether express or implied. +* +*/ +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/interrupt.h> +#include <linux/err.h> +#include <linux/clk.h> +#include <linux/io.h> +#include <asm/irq.h> +#include <mach/hardware.h> + +#include "../w1.h" +#include "../w1_int.h" + +#define MOD_NAME "OMAP_HDQ:" + +#define OMAP_HDQ_REVISION 0x00 +#define OMAP_HDQ_TX_DATA 0x04 +#define OMAP_HDQ_RX_DATA 0x08 +#define OMAP_HDQ_CTRL_STATUS 0x0c +#define OMAP_HDQ_CTRL_STATUS_INTERRUPTMASK (1<<6) +#define OMAP_HDQ_CTRL_STATUS_CLOCKENABLE (1<<5) +#define OMAP_HDQ_CTRL_STATUS_GO (1<<4) +#define OMAP_HDQ_CTRL_STATUS_INITIALIZATION (1<<2) +#define OMAP_HDQ_CTRL_STATUS_DIR (1<<1) +#define OMAP_HDQ_CTRL_STATUS_MODE (1<<0) +#define OMAP_HDQ_INT_STATUS 0x10 +#define OMAP_HDQ_INT_STATUS_TXCOMPLETE (1<<2) +#define OMAP_HDQ_INT_STATUS_RXCOMPLETE (1<<1) +#define OMAP_HDQ_INT_STATUS_TIMEOUT (1<<0) +#define OMAP_HDQ_SYSCONFIG 0x14 +#define OMAP_HDQ_SYSCONFIG_SOFTRESET (1<<1) +#define OMAP_HDQ_SYSCONFIG_AUTOIDLE (1<<0) +#define OMAP_HDQ_SYSSTATUS 0x18 +#define OMAP_HDQ_SYSSTATUS_RESETDONE (1<<0) + +#define OMAP_HDQ_FLAG_CLEAR 0 +#define OMAP_HDQ_FLAG_SET 1 +#define OMAP_HDQ_TIMEOUT (HZ/5) + +#define OMAP_HDQ_MAX_USER 4 + +DECLARE_WAIT_QUEUE_HEAD (hdq_wait_queue); +int W1_ID ; + +struct hdq_data { +resource_size_t hdq_base; +struct semaphore hdq_semlock; +int hdq_usecount; +struct clk *hdq_ick; +struct clk *hdq_fck; +u8 hdq_irqstatus; +spinlock_t hdq_spinlock; +}; + +static struct hdq_data *hdq_data; + +static int omap_hdq_get (void ); +static int omap_hdq_put (void ); +static int omap_hdq_break (void ); + +static int __init omap_hdq_probe (struct platform_device *pdev); +static int omap_hdq_remove (struct platform_device *pdev); + +static struct platform_driver omap_hdq_driver = { + .probe = omap_hdq_probe, + .remove = omap_hdq_remove, + .suspend =NULL , + .resume =NULL , + .driver = { + .name ="omap_hdq" , + }, +}; + +static u8 omap_w1_read_byte (void *data); +static void omap_w1_write_byte (void *data,u8 byte); +static u8 omap_w1_reset_bus (void *data); +static void omap_w1_search_bus (void *data,u8 search_type, +w1_slave_found_callback slave_found); + +static struct w1_bus_master omap_w1_master = { + .read_byte = omap_w1_read_byte, + .write_byte = omap_w1_write_byte, + .reset_bus = omap_w1_reset_bus, + .search = omap_w1_search_bus, +}; + +/* +* HDQ register I/O routines +*/ +static inline u8 +hdq_reg_in (u32 offset) +{ +return omap_readb (hdq_data->hdq_base + offset); +} + +static inline u8 +hdq_reg_out (u32 offset,u8 val) +{ +omap_writeb (val, hdq_data->hdq_base + offset); +return val; +} + +static inline u8 +hdq_reg_merge (u32 offset,u8 val,u8 mask) +{ +u8 new_val = (omap_readb (hdq_data->hdq_base + offset) & ~mask) + | (val & mask); +omap_writeb (new_val, hdq_data->hdq_base + offset); +return new_val; +} + +/* +* Wait for one or more bits in flag change. +* HDQ_FLAG_SET: wait until any bit in the flag is set. +* HDQ_FLAG_CLEAR: wait until all bits in the flag are cleared. +* return 0 on success and -ETIMEDOUT in the case of timeout. +*/ +static int +hdq_wait_for_flag (u32 offset,u8 flag,u8 flag_set,u8 *status) +{ +int ret =0 ; +unsigned long timeout = jiffies +OMAP_HDQ_TIMEOUT ; + +if (flag_set ==OMAP_HDQ_FLAG_CLEAR ) { +/* wait for the flag clear */ +while (((*status =hdq_reg_in (offset)) & flag) + &&time_before (jiffies, timeout)) { +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (1 ); + } +if (unlikely (*status & flag)) + ret = -ETIMEDOUT ; + }else if (flag_set ==OMAP_HDQ_FLAG_SET ) { +/* wait for the flag set */ +while (!((*status =hdq_reg_in (offset)) & flag) + &&time_before (jiffies, timeout)) { +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (1 ); + } +if (unlikely (!(*status & flag))) + ret = -ETIMEDOUT ; + }else +return -EINVAL ; + +return ret; +} + +/* +* write out a byte and fill *status with HDQ_INT_STATUS +*/ +static int +hdq_write_byte (u8 val,u8 *status) +{ +int ret; +u8 tmp_status; +unsigned long irqflags; + + *status =0 ; + +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); +/* clear interrupt flags via a dummy read */ +hdq_reg_in (OMAP_HDQ_INT_STATUS ); +/* ISR loads it with new INT_STATUS */ + hdq_data->hdq_irqstatus =0 ; +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); + +hdq_reg_out (OMAP_HDQ_TX_DATA , val); + +/* set the GO bit */ +hdq_reg_merge (OMAP_HDQ_CTRL_STATUS ,OMAP_HDQ_CTRL_STATUS_GO , +OMAP_HDQ_CTRL_STATUS_DIR |OMAP_HDQ_CTRL_STATUS_GO ); +/* wait for the TXCOMPLETE bit */ + ret =wait_event_interruptible_timeout (hdq_wait_queue, + hdq_data->hdq_irqstatus,OMAP_HDQ_TIMEOUT ); +if (unlikely (ret <0 )) { +pr_debug ("wait interrupted" ); +return -EINTR ; + } + +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); + *status = hdq_data->hdq_irqstatus; +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); +/* check irqstatus */ +if (!(*status &OMAP_HDQ_INT_STATUS_TXCOMPLETE )) { +pr_debug ("timeout waiting for TXCOMPLETE/RXCOMPLETE, %x" , + *status); +return -ETIMEDOUT ; + } + +/* wait for the GO bit return to zero */ + ret =hdq_wait_for_flag (OMAP_HDQ_CTRL_STATUS ,OMAP_HDQ_CTRL_STATUS_GO , +OMAP_HDQ_FLAG_CLEAR , &tmp_status); +if (ret) { +pr_debug ("timeout waiting GO bit return to zero, %x" , + tmp_status); +return ret; + } + +return ret; +} + +/* +* HDQ Interrupt service routine. +*/ +static irqreturn_t +hdq_isr (int irq,void *arg) +{ +unsigned long irqflags; + +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); + hdq_data->hdq_irqstatus =hdq_reg_in (OMAP_HDQ_INT_STATUS ); +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); +pr_debug ("hdq_isr: %x" , hdq_data->hdq_irqstatus); + +if (hdq_data->hdq_irqstatus & + (OMAP_HDQ_INT_STATUS_TXCOMPLETE |OMAP_HDQ_INT_STATUS_RXCOMPLETE + |OMAP_HDQ_INT_STATUS_TIMEOUT )) { +/* wake up sleeping process */ +wake_up_interruptible (&hdq_wait_queue); + } + +return IRQ_HANDLED ; +} + +/* +* HDQ Mode: always return success. +*/ +static u8 omap_w1_reset_bus (void *data) +{ +return 0 ; +} + +/* +* W1 search callback function. +*/ +static void omap_w1_search_bus (void *data,u8 search_type, +w1_slave_found_callback slave_found) +{ +u64 module_id, rn_le, cs, id; + +if (W1_ID ) + module_id =W1_ID ; +else + module_id =0x1 ; + + rn_le =cpu_to_le64 (module_id); +/* +* HDQ might not obey truly the 1-wire spec. +* So calculate CRC based on module parameter. +*/ + cs =w1_calc_crc8 ((u8 *)&rn_le,7 ); + id = (cs <<56 ) | module_id; + +slave_found (data, id); +} + +static int +_omap_hdq_reset (void ) +{ +int ret; +u8 tmp_status; + +hdq_reg_out (OMAP_HDQ_SYSCONFIG ,OMAP_HDQ_SYSCONFIG_SOFTRESET ); +/* +* Select HDQ mode & enable clocks. +* It is observed that INT flags can't be cleared via a read and GO/INIT +* won't return to zero if interrupt is disabled. So we always enable +* interrupt. +*/ +hdq_reg_out (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_CLOCKENABLE | +OMAP_HDQ_CTRL_STATUS_INTERRUPTMASK ); + +/* wait for reset to complete */ + ret =hdq_wait_for_flag (OMAP_HDQ_SYSSTATUS , +OMAP_HDQ_SYSSTATUS_RESETDONE ,OMAP_HDQ_FLAG_SET , &tmp_status); +if (ret) +pr_debug ("timeout waiting HDQ reset, %x" , tmp_status); +else { +hdq_reg_out (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_CLOCKENABLE | +OMAP_HDQ_CTRL_STATUS_INTERRUPTMASK ); +hdq_reg_out (OMAP_HDQ_SYSCONFIG ,OMAP_HDQ_SYSCONFIG_AUTOIDLE ); + } + +return ret; +} + +/* +* Issue break pulse to the device. +*/ +static int +omap_hdq_break () +{ +int ret; +u8 tmp_status; +unsigned long irqflags; + + ret =down_interruptible (&hdq_data->hdq_semlock); +if (ret <0 ) +return -EINTR ; + +if (!hdq_data->hdq_usecount) { +up (&hdq_data->hdq_semlock); +return -EINVAL ; + } + +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); +/* clear interrupt flags via a dummy read */ +hdq_reg_in (OMAP_HDQ_INT_STATUS ); +/* ISR loads it with new INT_STATUS */ + hdq_data->hdq_irqstatus =0 ; +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); + +/* set the INIT and GO bit */ +hdq_reg_merge (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_INITIALIZATION |OMAP_HDQ_CTRL_STATUS_GO , +OMAP_HDQ_CTRL_STATUS_DIR |OMAP_HDQ_CTRL_STATUS_INITIALIZATION | +OMAP_HDQ_CTRL_STATUS_GO ); + +/* wait for the TIMEOUT bit */ + ret =wait_event_interruptible_timeout (hdq_wait_queue, + hdq_data->hdq_irqstatus,OMAP_HDQ_TIMEOUT ); +if (unlikely (ret <0 )) { +pr_debug ("wait interrupted" ); +up (&hdq_data->hdq_semlock); +return -EINTR ; + } + +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); + tmp_status = hdq_data->hdq_irqstatus; +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); +/* check irqstatus */ +if (!(tmp_status &OMAP_HDQ_INT_STATUS_TIMEOUT )) { +pr_debug ("timeout waiting for TIMEOUT, %x" , tmp_status); +up (&hdq_data->hdq_semlock); +return -ETIMEDOUT ; + } +/* +* wait for both INIT and GO bits rerurn to zero. +* zero wait time expected for interrupt mode. +*/ + ret =hdq_wait_for_flag (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_INITIALIZATION | +OMAP_HDQ_CTRL_STATUS_GO ,OMAP_HDQ_FLAG_CLEAR , + &tmp_status); +if (ret) +pr_debug ("timeout waiting INIT&GO bits return to zero, %x" , + tmp_status); + +up (&hdq_data->hdq_semlock); +return ret; +} + +static int hdq_read_byte (u8 *val) +{ +int ret; +u8 status; +unsigned long irqflags; + + ret =down_interruptible (&hdq_data->hdq_semlock); +if (ret <0 ) +return -EINTR ; + +if (!hdq_data->hdq_usecount) { +up (&hdq_data->hdq_semlock); +return -EINVAL ; + } + +if (!(hdq_data->hdq_irqstatus &OMAP_HDQ_INT_STATUS_RXCOMPLETE )) { +hdq_reg_merge (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_DIR |OMAP_HDQ_CTRL_STATUS_GO , +OMAP_HDQ_CTRL_STATUS_DIR |OMAP_HDQ_CTRL_STATUS_GO ); +/* +* The RX comes immediately after TX. It +* triggers another interrupt before we +* sleep. So we have to wait for RXCOMPLETE bit. +*/ + { +unsigned long timeout = jiffies +OMAP_HDQ_TIMEOUT ; +while (!(hdq_data->hdq_irqstatus + &OMAP_HDQ_INT_STATUS_RXCOMPLETE ) + &&time_before (jiffies, timeout)) { +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (1 ); + } + } +hdq_reg_merge (OMAP_HDQ_CTRL_STATUS ,0 , +OMAP_HDQ_CTRL_STATUS_DIR ); +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); + status = hdq_data->hdq_irqstatus; +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); +/* check irqstatus */ +if (!(status &OMAP_HDQ_INT_STATUS_RXCOMPLETE )) { +pr_debug ("timeout waiting for RXCOMPLETE, %x" , status); +up (&hdq_data->hdq_semlock); +return -ETIMEDOUT ; + } + } +/* the data is ready. Read it in! */ + *val =hdq_reg_in (OMAP_HDQ_RX_DATA ); +up (&hdq_data->hdq_semlock); + +return 0 ; + +} + +/* +* Enable clocks and set the controller to HDQ mode. +*/ +static int +omap_hdq_get () +{ +int ret =0 ; + + ret =down_interruptible (&hdq_data->hdq_semlock); +if (ret <0 ) +return -EINTR ; + +if (OMAP_HDQ_MAX_USER == hdq_data->hdq_usecount) { +pr_debug ("attempt to exceed the max use count" ); +up (&hdq_data->hdq_semlock); + ret = -EINVAL ; + }else { + hdq_data->hdq_usecount++; +try_module_get (THIS_MODULE ); +if (1 == hdq_data->hdq_usecount) { +if (clk_enable (hdq_data->hdq_ick)) { +pr_debug ("Can not enable ick\n" ); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +up (&hdq_data->hdq_semlock); +return -ENODEV ; + } +if (clk_enable (hdq_data->hdq_fck)) { +pr_debug ("Can not enable fck\n" ); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +up (&hdq_data->hdq_semlock); +return -ENODEV ; + } + +/* make sure HDQ is out of reset */ +if (!(hdq_reg_in (OMAP_HDQ_SYSSTATUS ) & +OMAP_HDQ_SYSSTATUS_RESETDONE )) { + ret =_omap_hdq_reset (); +if (ret) +/* back up the count */ + hdq_data->hdq_usecount--; + }else { +/* select HDQ mode & enable clocks */ +hdq_reg_out (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_CLOCKENABLE | +OMAP_HDQ_CTRL_STATUS_INTERRUPTMASK ); +hdq_reg_out (OMAP_HDQ_SYSCONFIG , +OMAP_HDQ_SYSCONFIG_AUTOIDLE ); +hdq_reg_in (OMAP_HDQ_INT_STATUS ); + } + } + } +up (&hdq_data->hdq_semlock); +return ret; +} + +/* +* Disable clocks to the module. +*/ +static int +omap_hdq_put () +{ +int ret =0 ; + + ret =down_interruptible (&hdq_data->hdq_semlock); +if (ret <0 ) +return -EINTR ; + +if (0 == hdq_data->hdq_usecount) { +pr_debug ("attempt to decrement use count when it is zero" ); + ret = -EINVAL ; + }else { + hdq_data->hdq_usecount--; +module_put (THIS_MODULE ); +if (0 == hdq_data->hdq_usecount) { +clk_disable (hdq_data->hdq_ick); +clk_disable (hdq_data->hdq_fck); + } + } +up (&hdq_data->hdq_semlock); +return ret; +} + +/* +* Used to control the call to omap_hdq_get and omap_hdq_put. +* HDQ Protocol: Write the CMD|REG_address first, followed by +* the data wrire or read. +*/ +static int init_trans; + +/* +* Read a byte of data from the device. +*/ +static u8 omap_w1_read_byte (void *data) +{ +u8 val; +int ret; + + ret =hdq_read_byte (&val); +if (ret) { + init_trans =0 ; +omap_hdq_put (); +return -1 ; + } + +/* Write followed by a read, release the module */ +if (init_trans) { + init_trans =0 ; +omap_hdq_put (); + } + +return val; +} + +/* +* Write a byte of data to the device. +*/ +static void omap_w1_write_byte (void *data,u8 byte) +{ +u8 status; + +/* First write to initialize the transfer */ +if (init_trans ==0 ) +omap_hdq_get (); + + init_trans++; + +hdq_write_byte (byte, &status); +pr_debug ("Ctrl status %x\n" , status); + +/* Second write, data transfered. Release the module */ +if (init_trans >1 ) { +omap_hdq_put (); + init_trans =0 ; + } + +return ; +} + +static int __init omap_hdq_probe (struct platform_device *pdev) +{ +struct resource *res; +int ret, irq; +u8 rev; + +if (!pdev) +return -ENODEV ; + + hdq_data =kmalloc (sizeof (*hdq_data),GFP_KERNEL ); +if (!hdq_data) +return -ENODEV ; + +platform_set_drvdata (pdev, hdq_data); + + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (res ==NULL ) { +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return -ENXIO ; + } + + hdq_data->hdq_base = res->start; + +/* get interface & functional clock objects */ + hdq_data->hdq_ick =clk_get (&pdev->dev,"hdq_ick" ); + hdq_data->hdq_fck =clk_get (&pdev->dev,"hdq_fck" ); + +if (IS_ERR (hdq_data->hdq_ick) ||IS_ERR (hdq_data->hdq_fck)) { +pr_debug ("Can't get HDQ clock objects\n" ); +if (IS_ERR (hdq_data->hdq_ick)) { + ret =PTR_ERR (hdq_data->hdq_ick); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return ret; + } +if (IS_ERR (hdq_data->hdq_fck)) { + ret =PTR_ERR (hdq_data->hdq_fck); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return ret; + } + } + + hdq_data->hdq_usecount =0 ; +sema_init (&hdq_data->hdq_semlock,1 ); + +if (clk_enable (hdq_data->hdq_ick)) { +pr_debug ("Can not enable ick\n" ); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return -ENODEV ; + } + +if (clk_enable (hdq_data->hdq_fck)) { +pr_debug ("Can not enable fck\n" ); +clk_disable (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return -ENODEV ; + } + + rev =hdq_reg_in (OMAP_HDQ_REVISION ); +pr_info ("OMAP HDQ Hardware Revision %c.%c. Driver in %s mode.\n" , + (rev >>4 ) +'0' , (rev &0x0f ) +'0' ,"Interrupt" ); + +spin_lock_init (&hdq_data->hdq_spinlock); +omap_hdq_break (); + + irq =platform_get_irq (pdev,0 ); +if (irq <0 ) { +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return -ENXIO ; + } + +if (request_irq (irq, hdq_isr,IRQF_DISABLED ,"OMAP HDQ" , + &hdq_data->hdq_semlock)) { +pr_debug ("request_irq failed\n" ); +clk_disable (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return -ENODEV ; + } + +/* don't clock the HDQ until it is needed */ +clk_disable (hdq_data->hdq_ick); +clk_disable (hdq_data->hdq_fck); + + ret =w1_add_master_device (&omap_w1_master); +if (ret) { +pr_debug ("Failure in registering w1 master\n" ); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return ret; + } + +return 0 ; +} + +static int omap_hdq_remove (struct platform_device *pdev) +{ +down_interruptible (&hdq_data->hdq_semlock); +if (0 != hdq_data->hdq_usecount) { +pr_debug ("removed when use count is not zero\n" ); +return -EBUSY ; + } +up (&hdq_data->hdq_semlock); + +/* remove module dependency */ +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +free_irq (INT_24XX_HDQ_IRQ , &hdq_data->hdq_semlock); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); + +return 0 ; +} + +static int __init +omap_hdq_init (void ) +{ +return platform_driver_register (&omap_hdq_driver); +} + +static void __exit +omap_hdq_exit (void ) +{ +platform_driver_unregister (&omap_hdq_driver); +} + +module_init (omap_hdq_init); +module_exit (omap_hdq_exit); + +module_param (W1_ID , int,S_IRUSR ); + +MODULE_AUTHOR ("Texas Instruments" ); +MODULE_DESCRIPTION ("HDQ driver Library" ); +MODULE_LICENSE ("GPL" );Signature · 6 lines
1.6.0.1.141.g445ca -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 32/33] add omap 1-wire interface driver
----- Original Message -----
From: "Tony Lindgren" <[email protected]>
To: "Madhusudhan Chikkature" <[email protected]>
Cc: "Felipe Balbi" <[email protected]>; <[email protected]>; "Felipe Balbi" <[email protected]>
Sent: Friday, September 05, 2008 11:29 PM
Subject: Re: [PATCH 32/33] add omap 1-wire interface driver
Quoted 7 lines · Madhusudhan Chikkature
Quoted 3 lines
Hi,
The HDQ patchset that I posted to Tony were given ACK by Evgeniy Polyakov on the omap list. I hope that helps.
Madhu, can you post your 1-wire driver to LKML and Cc Evgeniy Polyakov so we can get that integrated? Also Cc l-o list.
I have a question regarding this. In fact it can be a generic question which might apply for other drivers as well. How do we post the OMAP3 related driver patches to LKML or any other driver specific lists if OMAP3 base support is not already present there?
Regards,
Madhu
Quoted 794 lines
Thanks,
Tony
Quoted 787 lines
Regards,
Madhu----- Original Message -----
From: "Felipe Balbi" <[email protected]>
To: <[email protected]>
Cc: "Felipe Balbi" <[email protected]>
Sent: Saturday, August 30, 2008 10:46 PM
Subject: [PATCH 32/33] add omap 1-wire interface driverQuoted 771 lines
From: Felipe Balbi <[email protected]>
Signed-off-by Felipe Balbi <[email protected]>---
arch/arm/plat-omap/include/mach/irqs.h | 2 + drivers/w1/masters/Kconfig | 7 + drivers/w1/masters/Makefile | 1 + drivers/w1/masters/omap_hdq.c | 704 ++++++++++++++++++++++++++++++++ 4 files changed, 714 insertions(+), 0 deletions(-)create mode 100644
drivers/w1/masters/omap_hdq.carch/arm/plat-omap/include/mach/irqs.h +2
-0@@ -54,6 +54,8 @@#define INT_TIMER2 30#define INT_LCD_CTRL 31 +#define INT_24XX_HDQ_IRQ 58/* Temporarily here for driver to build */ +/* * OMAP-1510 specific IRQ numbers for interrupt handler 1 */ drivers/w1/masters/Kconfig +7
-0@@ -42,6 +42,13 @@ config W1_MASTER_DS1WM in HP iPAQ devices like h5xxx, h2200, and ASIC3-based like hx4700. +config HDQ_MASTER_OMAP + tristate "OMAP HDQ driver" + depends on ARCH_OMAP2430 || ARCH_OMAP34XX + help + Say Y here if you want support for the 1-wire or HDQ Interface + on an OMAP processor. +config
W1_MASTER_GPIO
tristate "GPIO 1-wire busmaster"
depends onGENERIC_GPIOdrivers/w1/masters/Makefile +0
-0@@ -6,4 +6,5 @@ obj-$(CONFIG_W1_MASTER_MATROX) += matrox_w1.oobj-$(CONFIG_W1_MASTER_DS2490) += ds2490.o
obj-$(CONFIG_W1_MASTER_DS2482) += ds2482.o
obj-$(CONFIG_W1_MASTER_DS1WM) += ds1wm.o
+obj-$(CONFIG_HDQ_MASTER_OMAP) += omap_hdq.o
obj-$(CONFIG_W1_MASTER_GPIO) += w1-gpio.odrivers/w1/masters/omap_hdq.c new file +704
-0@@ -0,0 +1,704 @@ +/* +* drivers/w1/masters/omap_hdq.c +* +* Copyright (C) 2007 Texas Instruments, Inc. +* +* This file is licensed under the terms of the GNU General Public License +* version 2. This program is licensed "as is" without any warranty of any +* kind, whether express or implied. +* +*/ +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/interrupt.h> +#include <linux/err.h> +#include <linux/clk.h> +#include <linux/io.h> +#include <asm/irq.h> +#include <mach/hardware.h> + +#include "../w1.h" +#include "../w1_int.h" + +#define MOD_NAME "OMAP_HDQ:" + +#define OMAP_HDQ_REVISION 0x00 +#define OMAP_HDQ_TX_DATA 0x04 +#define OMAP_HDQ_RX_DATA 0x08 +#define OMAP_HDQ_CTRL_STATUS 0x0c +#define OMAP_HDQ_CTRL_STATUS_INTERRUPTMASK (1<<6) +#define OMAP_HDQ_CTRL_STATUS_CLOCKENABLE (1<<5) +#define OMAP_HDQ_CTRL_STATUS_GO (1<<4) +#define OMAP_HDQ_CTRL_STATUS_INITIALIZATION (1<<2) +#define OMAP_HDQ_CTRL_STATUS_DIR (1<<1) +#define OMAP_HDQ_CTRL_STATUS_MODE (1<<0) +#define OMAP_HDQ_INT_STATUS 0x10 +#define OMAP_HDQ_INT_STATUS_TXCOMPLETE (1<<2) +#define OMAP_HDQ_INT_STATUS_RXCOMPLETE (1<<1) +#define OMAP_HDQ_INT_STATUS_TIMEOUT (1<<0) +#define OMAP_HDQ_SYSCONFIG 0x14 +#define OMAP_HDQ_SYSCONFIG_SOFTRESET (1<<1) +#define OMAP_HDQ_SYSCONFIG_AUTOIDLE (1<<0) +#define OMAP_HDQ_SYSSTATUS 0x18 +#define OMAP_HDQ_SYSSTATUS_RESETDONE (1<<0) + +#define OMAP_HDQ_FLAG_CLEAR 0 +#define OMAP_HDQ_FLAG_SET 1 +#define OMAP_HDQ_TIMEOUT (HZ/5) + +#define OMAP_HDQ_MAX_USER 4 + +DECLARE_WAIT_QUEUE_HEAD (hdq_wait_queue); +int W1_ID ; + +struct hdq_data { +resource_size_t hdq_base; +struct semaphore hdq_semlock; +int hdq_usecount; +struct clk *hdq_ick; +struct clk *hdq_fck; +u8 hdq_irqstatus; +spinlock_t hdq_spinlock; +}; + +static struct hdq_data *hdq_data; + +static int omap_hdq_get (void ); +static int omap_hdq_put (void ); +static int omap_hdq_break (void ); + +static int __init omap_hdq_probe (struct platform_device *pdev); +static int omap_hdq_remove (struct platform_device *pdev); + +static struct platform_driver omap_hdq_driver = { + .probe = omap_hdq_probe, + .remove = omap_hdq_remove, + .suspend =NULL , + .resume =NULL , + .driver = { + .name ="omap_hdq" , + }, +}; + +static u8 omap_w1_read_byte (void *data); +static void omap_w1_write_byte (void *data,u8 byte); +static u8 omap_w1_reset_bus (void *data); +static void omap_w1_search_bus (void *data,u8 search_type, +w1_slave_found_callback slave_found); + +static struct w1_bus_master omap_w1_master = { + .read_byte = omap_w1_read_byte, + .write_byte = omap_w1_write_byte, + .reset_bus = omap_w1_reset_bus, + .search = omap_w1_search_bus, +}; + +/* +* HDQ register I/O routines +*/ +static inline u8 +hdq_reg_in (u32 offset) +{ +return omap_readb (hdq_data->hdq_base + offset); +} + +static inline u8 +hdq_reg_out (u32 offset,u8 val) +{ +omap_writeb (val, hdq_data->hdq_base + offset); +return val; +} + +static inline u8 +hdq_reg_merge (u32 offset,u8 val,u8 mask) +{ +u8 new_val = (omap_readb (hdq_data->hdq_base + offset) & ~mask) + | (val & mask); +omap_writeb (new_val, hdq_data->hdq_base + offset); +return new_val; +} + +/* +* Wait for one or more bits in flag change. +* HDQ_FLAG_SET: wait until any bit in the flag is set. +* HDQ_FLAG_CLEAR: wait until all bits in the flag are cleared. +* return 0 on success and -ETIMEDOUT in the case of timeout. +*/ +static int +hdq_wait_for_flag (u32 offset,u8 flag,u8 flag_set,u8 *status) +{ +int ret =0 ; +unsigned long timeout = jiffies +OMAP_HDQ_TIMEOUT ; + +if (flag_set ==OMAP_HDQ_FLAG_CLEAR ) { +/* wait for the flag clear */ +while (((*status =hdq_reg_in (offset)) & flag) + &&time_before (jiffies, timeout)) { +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (1 ); + } +if (unlikely (*status & flag)) + ret = -ETIMEDOUT ; + }else if (flag_set ==OMAP_HDQ_FLAG_SET ) { +/* wait for the flag set */ +while (!((*status =hdq_reg_in (offset)) & flag) + &&time_before (jiffies, timeout)) { +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (1 ); + } +if (unlikely (!(*status & flag))) + ret = -ETIMEDOUT ; + }else +return -EINVAL ; + +return ret; +} + +/* +* write out a byte and fill *status with HDQ_INT_STATUS +*/ +static int +hdq_write_byte (u8 val,u8 *status) +{ +int ret; +u8 tmp_status; +unsigned long irqflags; + + *status =0 ; + +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); +/* clear interrupt flags via a dummy read */ +hdq_reg_in (OMAP_HDQ_INT_STATUS ); +/* ISR loads it with new INT_STATUS */ + hdq_data->hdq_irqstatus =0 ; +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); + +hdq_reg_out (OMAP_HDQ_TX_DATA , val); + +/* set the GO bit */ +hdq_reg_merge (OMAP_HDQ_CTRL_STATUS ,OMAP_HDQ_CTRL_STATUS_GO , +OMAP_HDQ_CTRL_STATUS_DIR |OMAP_HDQ_CTRL_STATUS_GO ); +/* wait for the TXCOMPLETE bit */ + ret =wait_event_interruptible_timeout (hdq_wait_queue, + hdq_data->hdq_irqstatus,OMAP_HDQ_TIMEOUT ); +if (unlikely (ret <0 )) { +pr_debug ("wait interrupted" ); +return -EINTR ; + } + +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); + *status = hdq_data->hdq_irqstatus; +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); +/* check irqstatus */ +if (!(*status &OMAP_HDQ_INT_STATUS_TXCOMPLETE )) { +pr_debug ("timeout waiting for TXCOMPLETE/RXCOMPLETE, %x" , + *status); +return -ETIMEDOUT ; + } + +/* wait for the GO bit return to zero */ + ret =hdq_wait_for_flag (OMAP_HDQ_CTRL_STATUS ,OMAP_HDQ_CTRL_STATUS_GO , +OMAP_HDQ_FLAG_CLEAR , &tmp_status); +if (ret) { +pr_debug ("timeout waiting GO bit return to zero, %x" , + tmp_status); +return ret; + } + +return ret; +} + +/* +* HDQ Interrupt service routine. +*/ +static irqreturn_t +hdq_isr (int irq,void *arg) +{ +unsigned long irqflags; + +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); + hdq_data->hdq_irqstatus =hdq_reg_in (OMAP_HDQ_INT_STATUS ); +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); +pr_debug ("hdq_isr: %x" , hdq_data->hdq_irqstatus); + +if (hdq_data->hdq_irqstatus & + (OMAP_HDQ_INT_STATUS_TXCOMPLETE |OMAP_HDQ_INT_STATUS_RXCOMPLETE + |OMAP_HDQ_INT_STATUS_TIMEOUT )) { +/* wake up sleeping process */ +wake_up_interruptible (&hdq_wait_queue); + } + +return IRQ_HANDLED ; +} + +/* +* HDQ Mode: always return success. +*/ +static u8 omap_w1_reset_bus (void *data) +{ +return 0 ; +} + +/* +* W1 search callback function. +*/ +static void omap_w1_search_bus (void *data,u8 search_type, +w1_slave_found_callback slave_found) +{ +u64 module_id, rn_le, cs, id; + +if (W1_ID ) + module_id =W1_ID ; +else + module_id =0x1 ; + + rn_le =cpu_to_le64 (module_id); +/* +* HDQ might not obey truly the 1-wire spec. +* So calculate CRC based on module parameter. +*/ + cs =w1_calc_crc8 ((u8 *)&rn_le,7 ); + id = (cs <<56 ) | module_id; + +slave_found (data, id); +} + +static int +_omap_hdq_reset (void ) +{ +int ret; +u8 tmp_status; + +hdq_reg_out (OMAP_HDQ_SYSCONFIG ,OMAP_HDQ_SYSCONFIG_SOFTRESET ); +/* +* Select HDQ mode & enable clocks. +* It is observed that INT flags can't be cleared via a read and GO/INIT +* won't return to zero if interrupt is disabled. So we always enable +* interrupt. +*/ +hdq_reg_out (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_CLOCKENABLE | +OMAP_HDQ_CTRL_STATUS_INTERRUPTMASK ); + +/* wait for reset to complete */ + ret =hdq_wait_for_flag (OMAP_HDQ_SYSSTATUS , +OMAP_HDQ_SYSSTATUS_RESETDONE ,OMAP_HDQ_FLAG_SET , &tmp_status); +if (ret) +pr_debug ("timeout waiting HDQ reset, %x" , tmp_status); +else { +hdq_reg_out (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_CLOCKENABLE | +OMAP_HDQ_CTRL_STATUS_INTERRUPTMASK ); +hdq_reg_out (OMAP_HDQ_SYSCONFIG ,OMAP_HDQ_SYSCONFIG_AUTOIDLE ); + } + +return ret; +} + +/* +* Issue break pulse to the device. +*/ +static int +omap_hdq_break () +{ +int ret; +u8 tmp_status; +unsigned long irqflags; + + ret =down_interruptible (&hdq_data->hdq_semlock); +if (ret <0 ) +return -EINTR ; + +if (!hdq_data->hdq_usecount) { +up (&hdq_data->hdq_semlock); +return -EINVAL ; + } + +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); +/* clear interrupt flags via a dummy read */ +hdq_reg_in (OMAP_HDQ_INT_STATUS ); +/* ISR loads it with new INT_STATUS */ + hdq_data->hdq_irqstatus =0 ; +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); + +/* set the INIT and GO bit */ +hdq_reg_merge (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_INITIALIZATION |OMAP_HDQ_CTRL_STATUS_GO , +OMAP_HDQ_CTRL_STATUS_DIR |OMAP_HDQ_CTRL_STATUS_INITIALIZATION | +OMAP_HDQ_CTRL_STATUS_GO ); + +/* wait for the TIMEOUT bit */ + ret =wait_event_interruptible_timeout (hdq_wait_queue, + hdq_data->hdq_irqstatus,OMAP_HDQ_TIMEOUT ); +if (unlikely (ret <0 )) { +pr_debug ("wait interrupted" ); +up (&hdq_data->hdq_semlock); +return -EINTR ; + } + +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); + tmp_status = hdq_data->hdq_irqstatus; +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); +/* check irqstatus */ +if (!(tmp_status &OMAP_HDQ_INT_STATUS_TIMEOUT )) { +pr_debug ("timeout waiting for TIMEOUT, %x" , tmp_status); +up (&hdq_data->hdq_semlock); +return -ETIMEDOUT ; + } +/* +* wait for both INIT and GO bits rerurn to zero. +* zero wait time expected for interrupt mode. +*/ + ret =hdq_wait_for_flag (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_INITIALIZATION | +OMAP_HDQ_CTRL_STATUS_GO ,OMAP_HDQ_FLAG_CLEAR , + &tmp_status); +if (ret) +pr_debug ("timeout waiting INIT&GO bits return to zero, %x" , + tmp_status); + +up (&hdq_data->hdq_semlock); +return ret; +} + +static int hdq_read_byte (u8 *val) +{ +int ret; +u8 status; +unsigned long irqflags; + + ret =down_interruptible (&hdq_data->hdq_semlock); +if (ret <0 ) +return -EINTR ; + +if (!hdq_data->hdq_usecount) { +up (&hdq_data->hdq_semlock); +return -EINVAL ; + } + +if (!(hdq_data->hdq_irqstatus &OMAP_HDQ_INT_STATUS_RXCOMPLETE )) { +hdq_reg_merge (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_DIR |OMAP_HDQ_CTRL_STATUS_GO , +OMAP_HDQ_CTRL_STATUS_DIR |OMAP_HDQ_CTRL_STATUS_GO ); +/* +* The RX comes immediately after TX. It +* triggers another interrupt before we +* sleep. So we have to wait for RXCOMPLETE bit. +*/ + { +unsigned long timeout = jiffies +OMAP_HDQ_TIMEOUT ; +while (!(hdq_data->hdq_irqstatus + &OMAP_HDQ_INT_STATUS_RXCOMPLETE ) + &&time_before (jiffies, timeout)) { +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (1 ); + } + } +hdq_reg_merge (OMAP_HDQ_CTRL_STATUS ,0 , +OMAP_HDQ_CTRL_STATUS_DIR ); +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); + status = hdq_data->hdq_irqstatus; +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); +/* check irqstatus */ +if (!(status &OMAP_HDQ_INT_STATUS_RXCOMPLETE )) { +pr_debug ("timeout waiting for RXCOMPLETE, %x" , status); +up (&hdq_data->hdq_semlock); +return -ETIMEDOUT ; + } + } +/* the data is ready. Read it in! */ + *val =hdq_reg_in (OMAP_HDQ_RX_DATA ); +up (&hdq_data->hdq_semlock); + +return 0 ; + +} + +/* +* Enable clocks and set the controller to HDQ mode. +*/ +static int +omap_hdq_get () +{ +int ret =0 ; + + ret =down_interruptible (&hdq_data->hdq_semlock); +if (ret <0 ) +return -EINTR ; + +if (OMAP_HDQ_MAX_USER == hdq_data->hdq_usecount) { +pr_debug ("attempt to exceed the max use count" ); +up (&hdq_data->hdq_semlock); + ret = -EINVAL ; + }else { + hdq_data->hdq_usecount++; +try_module_get (THIS_MODULE ); +if (1 == hdq_data->hdq_usecount) { +if (clk_enable (hdq_data->hdq_ick)) { +pr_debug ("Can not enable ick\n" ); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +up (&hdq_data->hdq_semlock); +return -ENODEV ; + } +if (clk_enable (hdq_data->hdq_fck)) { +pr_debug ("Can not enable fck\n" ); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +up (&hdq_data->hdq_semlock); +return -ENODEV ; + } + +/* make sure HDQ is out of reset */ +if (!(hdq_reg_in (OMAP_HDQ_SYSSTATUS ) & +OMAP_HDQ_SYSSTATUS_RESETDONE )) { + ret =_omap_hdq_reset (); +if (ret) +/* back up the count */ + hdq_data->hdq_usecount--; + }else { +/* select HDQ mode & enable clocks */ +hdq_reg_out (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_CLOCKENABLE | +OMAP_HDQ_CTRL_STATUS_INTERRUPTMASK ); +hdq_reg_out (OMAP_HDQ_SYSCONFIG , +OMAP_HDQ_SYSCONFIG_AUTOIDLE ); +hdq_reg_in (OMAP_HDQ_INT_STATUS ); + } + } + } +up (&hdq_data->hdq_semlock); +return ret; +} + +/* +* Disable clocks to the module. +*/ +static int +omap_hdq_put () +{ +int ret =0 ; + + ret =down_interruptible (&hdq_data->hdq_semlock); +if (ret <0 ) +return -EINTR ; + +if (0 == hdq_data->hdq_usecount) { +pr_debug ("attempt to decrement use count when it is zero" ); + ret = -EINVAL ; + }else { + hdq_data->hdq_usecount--; +module_put (THIS_MODULE ); +if (0 == hdq_data->hdq_usecount) { +clk_disable (hdq_data->hdq_ick); +clk_disable (hdq_data->hdq_fck); + } + } +up (&hdq_data->hdq_semlock); +return ret; +} + +/* +* Used to control the call to omap_hdq_get and omap_hdq_put. +* HDQ Protocol: Write the CMD|REG_address first, followed by +* the data wrire or read. +*/ +static int init_trans; + +/* +* Read a byte of data from the device. +*/ +static u8 omap_w1_read_byte (void *data) +{ +u8 val; +int ret; + + ret =hdq_read_byte (&val); +if (ret) { + init_trans =0 ; +omap_hdq_put (); +return -1 ; + } + +/* Write followed by a read, release the module */ +if (init_trans) { + init_trans =0 ; +omap_hdq_put (); + } + +return val; +} + +/* +* Write a byte of data to the device. +*/ +static void omap_w1_write_byte (void *data,u8 byte) +{ +u8 status; + +/* First write to initialize the transfer */ +if (init_trans ==0 ) +omap_hdq_get (); + + init_trans++; + +hdq_write_byte (byte, &status); +pr_debug ("Ctrl status %x\n" , status); + +/* Second write, data transfered. Release the module */ +if (init_trans >1 ) { +omap_hdq_put (); + init_trans =0 ; + } + +return ; +} + +static int __init omap_hdq_probe (struct platform_device *pdev) +{ +struct resource *res; +int ret, irq; +u8 rev; + +if (!pdev) +return -ENODEV ; + + hdq_data =kmalloc (sizeof (*hdq_data),GFP_KERNEL ); +if (!hdq_data) +return -ENODEV ; + +platform_set_drvdata (pdev, hdq_data); + + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (res ==NULL ) { +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return -ENXIO ; + } + + hdq_data->hdq_base = res->start; + +/* get interface & functional clock objects */ + hdq_data->hdq_ick =clk_get (&pdev->dev,"hdq_ick" ); + hdq_data->hdq_fck =clk_get (&pdev->dev,"hdq_fck" ); + +if (IS_ERR (hdq_data->hdq_ick) ||IS_ERR (hdq_data->hdq_fck)) { +pr_debug ("Can't get HDQ clock objects\n" ); +if (IS_ERR (hdq_data->hdq_ick)) { + ret =PTR_ERR (hdq_data->hdq_ick); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return ret; + } +if (IS_ERR (hdq_data->hdq_fck)) { + ret =PTR_ERR (hdq_data->hdq_fck); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return ret; + } + } + + hdq_data->hdq_usecount =0 ; +sema_init (&hdq_data->hdq_semlock,1 ); + +if (clk_enable (hdq_data->hdq_ick)) { +pr_debug ("Can not enable ick\n" ); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return -ENODEV ; + } + +if (clk_enable (hdq_data->hdq_fck)) { +pr_debug ("Can not enable fck\n" ); +clk_disable (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return -ENODEV ; + } + + rev =hdq_reg_in (OMAP_HDQ_REVISION ); +pr_info ("OMAP HDQ Hardware Revision %c.%c. Driver in %s mode.\n" , + (rev >>4 ) +'0' , (rev &0x0f ) +'0' ,"Interrupt" ); + +spin_lock_init (&hdq_data->hdq_spinlock); +omap_hdq_break (); + + irq =platform_get_irq (pdev,0 ); +if (irq <0 ) { +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return -ENXIO ; + } + +if (request_irq (irq, hdq_isr,IRQF_DISABLED ,"OMAP HDQ" , + &hdq_data->hdq_semlock)) { +pr_debug ("request_irq failed\n" ); +clk_disable (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return -ENODEV ; + } + +/* don't clock the HDQ until it is needed */ +clk_disable (hdq_data->hdq_ick); +clk_disable (hdq_data->hdq_fck); + + ret =w1_add_master_device (&omap_w1_master); +if (ret) { +pr_debug ("Failure in registering w1 master\n" ); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return ret; + } + +return 0 ; +} + +static int omap_hdq_remove (struct platform_device *pdev) +{ +down_interruptible (&hdq_data->hdq_semlock); +if (0 != hdq_data->hdq_usecount) { +pr_debug ("removed when use count is not zero\n" ); +return -EBUSY ; + } +up (&hdq_data->hdq_semlock); + +/* remove module dependency */ +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +free_irq (INT_24XX_HDQ_IRQ , &hdq_data->hdq_semlock); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); + +return 0 ; +} + +static int __init +omap_hdq_init (void ) +{ +return platform_driver_register (&omap_hdq_driver); +} + +static void __exit +omap_hdq_exit (void ) +{ +platform_driver_unregister (&omap_hdq_driver); +} + +module_init (omap_hdq_init); +module_exit (omap_hdq_exit); + +module_param (W1_ID , int,S_IRUSR ); + +MODULE_AUTHOR ("Texas Instruments" ); +MODULE_DESCRIPTION ("HDQ driver Library" ); +MODULE_LICENSE ("GPL" );Signature · 6 lines
1.6.0.1.141.g445ca -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Tony Lindgren
maintainerRe: [PATCH 32/33] add omap 1-wire interface driver
Quoted 9 lines · Madhusudhan Chikkature
----- Original Message -----
From: "Tony Lindgren" <[email protected]>
To: "Madhusudhan Chikkature" <[email protected]>
Cc: "Felipe Balbi" <[email protected]>; <[email protected]>; "Felipe Balbi" <[email protected]>
Sent: Friday, September 05, 2008 11:29 PM
Subject: Re: [PATCH 32/33] add omap 1-wire interface driver
Quoted 8 lines
Quoted 7 lines · Madhusudhan Chikkature
Quoted 3 lines
Hi,
The HDQ patchset that I posted to Tony were given ACK by Evgeniy Polyakov on the omap list. I hope that helps.
Madhu, can you post your 1-wire driver to LKML and Cc Evgeniy Polyakov so we can get that integrated? Also Cc l-o list.
I have a question regarding this. In fact it can be a generic question which might apply for other drivers as well. How do we post the OMAP3 related driver patches to LKML or any other driver specific lists if OMAP3 base support is not already present there?
Well the drivers should not have dependencies to omap3 headers. And hopefully we'll have the minimal omap3 support integrated when 2.6.28 opens.
Also, you're already getting IORESOURCE_MEM as rerource. And isn't this driver also on 24XX chips too?
BTW, how about change it to use __raw_read/write instead of omap_read/write? Just ioremap the IORESOURCE_MEM, see the recent ioremap changes.
Regards,
Tony
Quoted 797 lines
Regards,
MadhuQuoted 794 lines
Thanks,
Tony
Quoted 787 lines
Regards,
Madhu----- Original Message -----
From: "Felipe Balbi" <[email protected]>
To: <[email protected]>
Cc: "Felipe Balbi" <[email protected]>
Sent: Saturday, August 30, 2008 10:46 PM
Subject: [PATCH 32/33] add omap 1-wire interface driverQuoted 771 lines
From: Felipe Balbi <[email protected]>
Signed-off-by Felipe Balbi <[email protected]>---
arch/arm/plat-omap/include/mach/irqs.h | 2 + drivers/w1/masters/Kconfig | 7 + drivers/w1/masters/Makefile | 1 + drivers/w1/masters/omap_hdq.c | 704 ++++++++++++++++++++++++++++++++ 4 files changed, 714 insertions(+), 0 deletions(-)create mode 100644
drivers/w1/masters/omap_hdq.carch/arm/plat-omap/include/mach/irqs.h +2
-0@@ -54,6 +54,8 @@#define INT_TIMER2 30#define INT_LCD_CTRL 31 +#define INT_24XX_HDQ_IRQ 58/* Temporarily here for driver to build */ +/* * OMAP-1510 specific IRQ numbers for interrupt handler 1 */ drivers/w1/masters/Kconfig +7
-0@@ -42,6 +42,13 @@ config W1_MASTER_DS1WM in HP iPAQ devices like h5xxx, h2200, and ASIC3-based like hx4700. +config HDQ_MASTER_OMAP + tristate "OMAP HDQ driver" + depends on ARCH_OMAP2430 || ARCH_OMAP34XX + help + Say Y here if you want support for the 1-wire or HDQ Interface + on an OMAP processor. +config
W1_MASTER_GPIO
tristate "GPIO 1-wire busmaster"
depends onGENERIC_GPIOdrivers/w1/masters/Makefile +0
-0@@ -6,4 +6,5 @@ obj-$(CONFIG_W1_MASTER_MATROX) += matrox_w1.oobj-$(CONFIG_W1_MASTER_DS2490) += ds2490.o
obj-$(CONFIG_W1_MASTER_DS2482) += ds2482.o
obj-$(CONFIG_W1_MASTER_DS1WM) += ds1wm.o
+obj-$(CONFIG_HDQ_MASTER_OMAP) += omap_hdq.o
obj-$(CONFIG_W1_MASTER_GPIO) += w1-gpio.odrivers/w1/masters/omap_hdq.c new file +704
-0@@ -0,0 +1,704 @@ +/* +* drivers/w1/masters/omap_hdq.c +* +* Copyright (C) 2007 Texas Instruments, Inc. +* +* This file is licensed under the terms of the GNU General Public License +* version 2. This program is licensed "as is" without any warranty of any +* kind, whether express or implied. +* +*/ +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/interrupt.h> +#include <linux/err.h> +#include <linux/clk.h> +#include <linux/io.h> +#include <asm/irq.h> +#include <mach/hardware.h> + +#include "../w1.h" +#include "../w1_int.h" + +#define MOD_NAME "OMAP_HDQ:" + +#define OMAP_HDQ_REVISION 0x00 +#define OMAP_HDQ_TX_DATA 0x04 +#define OMAP_HDQ_RX_DATA 0x08 +#define OMAP_HDQ_CTRL_STATUS 0x0c +#define OMAP_HDQ_CTRL_STATUS_INTERRUPTMASK (1<<6) +#define OMAP_HDQ_CTRL_STATUS_CLOCKENABLE (1<<5) +#define OMAP_HDQ_CTRL_STATUS_GO (1<<4) +#define OMAP_HDQ_CTRL_STATUS_INITIALIZATION (1<<2) +#define OMAP_HDQ_CTRL_STATUS_DIR (1<<1) +#define OMAP_HDQ_CTRL_STATUS_MODE (1<<0) +#define OMAP_HDQ_INT_STATUS 0x10 +#define OMAP_HDQ_INT_STATUS_TXCOMPLETE (1<<2) +#define OMAP_HDQ_INT_STATUS_RXCOMPLETE (1<<1) +#define OMAP_HDQ_INT_STATUS_TIMEOUT (1<<0) +#define OMAP_HDQ_SYSCONFIG 0x14 +#define OMAP_HDQ_SYSCONFIG_SOFTRESET (1<<1) +#define OMAP_HDQ_SYSCONFIG_AUTOIDLE (1<<0) +#define OMAP_HDQ_SYSSTATUS 0x18 +#define OMAP_HDQ_SYSSTATUS_RESETDONE (1<<0) + +#define OMAP_HDQ_FLAG_CLEAR 0 +#define OMAP_HDQ_FLAG_SET 1 +#define OMAP_HDQ_TIMEOUT (HZ/5) + +#define OMAP_HDQ_MAX_USER 4 + +DECLARE_WAIT_QUEUE_HEAD (hdq_wait_queue); +int W1_ID ; + +struct hdq_data { +resource_size_t hdq_base; +struct semaphore hdq_semlock; +int hdq_usecount; +struct clk *hdq_ick; +struct clk *hdq_fck; +u8 hdq_irqstatus; +spinlock_t hdq_spinlock; +}; + +static struct hdq_data *hdq_data; + +static int omap_hdq_get (void ); +static int omap_hdq_put (void ); +static int omap_hdq_break (void ); + +static int __init omap_hdq_probe (struct platform_device *pdev); +static int omap_hdq_remove (struct platform_device *pdev); + +static struct platform_driver omap_hdq_driver = { + .probe = omap_hdq_probe, + .remove = omap_hdq_remove, + .suspend =NULL , + .resume =NULL , + .driver = { + .name ="omap_hdq" , + }, +}; + +static u8 omap_w1_read_byte (void *data); +static void omap_w1_write_byte (void *data,u8 byte); +static u8 omap_w1_reset_bus (void *data); +static void omap_w1_search_bus (void *data,u8 search_type, +w1_slave_found_callback slave_found); + +static struct w1_bus_master omap_w1_master = { + .read_byte = omap_w1_read_byte, + .write_byte = omap_w1_write_byte, + .reset_bus = omap_w1_reset_bus, + .search = omap_w1_search_bus, +}; + +/* +* HDQ register I/O routines +*/ +static inline u8 +hdq_reg_in (u32 offset) +{ +return omap_readb (hdq_data->hdq_base + offset); +} + +static inline u8 +hdq_reg_out (u32 offset,u8 val) +{ +omap_writeb (val, hdq_data->hdq_base + offset); +return val; +} + +static inline u8 +hdq_reg_merge (u32 offset,u8 val,u8 mask) +{ +u8 new_val = (omap_readb (hdq_data->hdq_base + offset) & ~mask) + | (val & mask); +omap_writeb (new_val, hdq_data->hdq_base + offset); +return new_val; +} + +/* +* Wait for one or more bits in flag change. +* HDQ_FLAG_SET: wait until any bit in the flag is set. +* HDQ_FLAG_CLEAR: wait until all bits in the flag are cleared. +* return 0 on success and -ETIMEDOUT in the case of timeout. +*/ +static int +hdq_wait_for_flag (u32 offset,u8 flag,u8 flag_set,u8 *status) +{ +int ret =0 ; +unsigned long timeout = jiffies +OMAP_HDQ_TIMEOUT ; + +if (flag_set ==OMAP_HDQ_FLAG_CLEAR ) { +/* wait for the flag clear */ +while (((*status =hdq_reg_in (offset)) & flag) + &&time_before (jiffies, timeout)) { +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (1 ); + } +if (unlikely (*status & flag)) + ret = -ETIMEDOUT ; + }else if (flag_set ==OMAP_HDQ_FLAG_SET ) { +/* wait for the flag set */ +while (!((*status =hdq_reg_in (offset)) & flag) + &&time_before (jiffies, timeout)) { +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (1 ); + } +if (unlikely (!(*status & flag))) + ret = -ETIMEDOUT ; + }else +return -EINVAL ; + +return ret; +} + +/* +* write out a byte and fill *status with HDQ_INT_STATUS +*/ +static int +hdq_write_byte (u8 val,u8 *status) +{ +int ret; +u8 tmp_status; +unsigned long irqflags; + + *status =0 ; + +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); +/* clear interrupt flags via a dummy read */ +hdq_reg_in (OMAP_HDQ_INT_STATUS ); +/* ISR loads it with new INT_STATUS */ + hdq_data->hdq_irqstatus =0 ; +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); + +hdq_reg_out (OMAP_HDQ_TX_DATA , val); + +/* set the GO bit */ +hdq_reg_merge (OMAP_HDQ_CTRL_STATUS ,OMAP_HDQ_CTRL_STATUS_GO , +OMAP_HDQ_CTRL_STATUS_DIR |OMAP_HDQ_CTRL_STATUS_GO ); +/* wait for the TXCOMPLETE bit */ + ret =wait_event_interruptible_timeout (hdq_wait_queue, + hdq_data->hdq_irqstatus,OMAP_HDQ_TIMEOUT ); +if (unlikely (ret <0 )) { +pr_debug ("wait interrupted" ); +return -EINTR ; + } + +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); + *status = hdq_data->hdq_irqstatus; +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); +/* check irqstatus */ +if (!(*status &OMAP_HDQ_INT_STATUS_TXCOMPLETE )) { +pr_debug ("timeout waiting for TXCOMPLETE/RXCOMPLETE, %x" , + *status); +return -ETIMEDOUT ; + } + +/* wait for the GO bit return to zero */ + ret =hdq_wait_for_flag (OMAP_HDQ_CTRL_STATUS ,OMAP_HDQ_CTRL_STATUS_GO , +OMAP_HDQ_FLAG_CLEAR , &tmp_status); +if (ret) { +pr_debug ("timeout waiting GO bit return to zero, %x" , + tmp_status); +return ret; + } + +return ret; +} + +/* +* HDQ Interrupt service routine. +*/ +static irqreturn_t +hdq_isr (int irq,void *arg) +{ +unsigned long irqflags; + +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); + hdq_data->hdq_irqstatus =hdq_reg_in (OMAP_HDQ_INT_STATUS ); +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); +pr_debug ("hdq_isr: %x" , hdq_data->hdq_irqstatus); + +if (hdq_data->hdq_irqstatus & + (OMAP_HDQ_INT_STATUS_TXCOMPLETE |OMAP_HDQ_INT_STATUS_RXCOMPLETE + |OMAP_HDQ_INT_STATUS_TIMEOUT )) { +/* wake up sleeping process */ +wake_up_interruptible (&hdq_wait_queue); + } + +return IRQ_HANDLED ; +} + +/* +* HDQ Mode: always return success. +*/ +static u8 omap_w1_reset_bus (void *data) +{ +return 0 ; +} + +/* +* W1 search callback function. +*/ +static void omap_w1_search_bus (void *data,u8 search_type, +w1_slave_found_callback slave_found) +{ +u64 module_id, rn_le, cs, id; + +if (W1_ID ) + module_id =W1_ID ; +else + module_id =0x1 ; + + rn_le =cpu_to_le64 (module_id); +/* +* HDQ might not obey truly the 1-wire spec. +* So calculate CRC based on module parameter. +*/ + cs =w1_calc_crc8 ((u8 *)&rn_le,7 ); + id = (cs <<56 ) | module_id; + +slave_found (data, id); +} + +static int +_omap_hdq_reset (void ) +{ +int ret; +u8 tmp_status; + +hdq_reg_out (OMAP_HDQ_SYSCONFIG ,OMAP_HDQ_SYSCONFIG_SOFTRESET ); +/* +* Select HDQ mode & enable clocks. +* It is observed that INT flags can't be cleared via a read and GO/INIT +* won't return to zero if interrupt is disabled. So we always enable +* interrupt. +*/ +hdq_reg_out (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_CLOCKENABLE | +OMAP_HDQ_CTRL_STATUS_INTERRUPTMASK ); + +/* wait for reset to complete */ + ret =hdq_wait_for_flag (OMAP_HDQ_SYSSTATUS , +OMAP_HDQ_SYSSTATUS_RESETDONE ,OMAP_HDQ_FLAG_SET , &tmp_status); +if (ret) +pr_debug ("timeout waiting HDQ reset, %x" , tmp_status); +else { +hdq_reg_out (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_CLOCKENABLE | +OMAP_HDQ_CTRL_STATUS_INTERRUPTMASK ); +hdq_reg_out (OMAP_HDQ_SYSCONFIG ,OMAP_HDQ_SYSCONFIG_AUTOIDLE ); + } + +return ret; +} + +/* +* Issue break pulse to the device. +*/ +static int +omap_hdq_break () +{ +int ret; +u8 tmp_status; +unsigned long irqflags; + + ret =down_interruptible (&hdq_data->hdq_semlock); +if (ret <0 ) +return -EINTR ; + +if (!hdq_data->hdq_usecount) { +up (&hdq_data->hdq_semlock); +return -EINVAL ; + } + +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); +/* clear interrupt flags via a dummy read */ +hdq_reg_in (OMAP_HDQ_INT_STATUS ); +/* ISR loads it with new INT_STATUS */ + hdq_data->hdq_irqstatus =0 ; +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); + +/* set the INIT and GO bit */ +hdq_reg_merge (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_INITIALIZATION |OMAP_HDQ_CTRL_STATUS_GO , +OMAP_HDQ_CTRL_STATUS_DIR |OMAP_HDQ_CTRL_STATUS_INITIALIZATION | +OMAP_HDQ_CTRL_STATUS_GO ); + +/* wait for the TIMEOUT bit */ + ret =wait_event_interruptible_timeout (hdq_wait_queue, + hdq_data->hdq_irqstatus,OMAP_HDQ_TIMEOUT ); +if (unlikely (ret <0 )) { +pr_debug ("wait interrupted" ); +up (&hdq_data->hdq_semlock); +return -EINTR ; + } + +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); + tmp_status = hdq_data->hdq_irqstatus; +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); +/* check irqstatus */ +if (!(tmp_status &OMAP_HDQ_INT_STATUS_TIMEOUT )) { +pr_debug ("timeout waiting for TIMEOUT, %x" , tmp_status); +up (&hdq_data->hdq_semlock); +return -ETIMEDOUT ; + } +/* +* wait for both INIT and GO bits rerurn to zero. +* zero wait time expected for interrupt mode. +*/ + ret =hdq_wait_for_flag (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_INITIALIZATION | +OMAP_HDQ_CTRL_STATUS_GO ,OMAP_HDQ_FLAG_CLEAR , + &tmp_status); +if (ret) +pr_debug ("timeout waiting INIT&GO bits return to zero, %x" , + tmp_status); + +up (&hdq_data->hdq_semlock); +return ret; +} + +static int hdq_read_byte (u8 *val) +{ +int ret; +u8 status; +unsigned long irqflags; + + ret =down_interruptible (&hdq_data->hdq_semlock); +if (ret <0 ) +return -EINTR ; + +if (!hdq_data->hdq_usecount) { +up (&hdq_data->hdq_semlock); +return -EINVAL ; + } + +if (!(hdq_data->hdq_irqstatus &OMAP_HDQ_INT_STATUS_RXCOMPLETE )) { +hdq_reg_merge (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_DIR |OMAP_HDQ_CTRL_STATUS_GO , +OMAP_HDQ_CTRL_STATUS_DIR |OMAP_HDQ_CTRL_STATUS_GO ); +/* +* The RX comes immediately after TX. It +* triggers another interrupt before we +* sleep. So we have to wait for RXCOMPLETE bit. +*/ + { +unsigned long timeout = jiffies +OMAP_HDQ_TIMEOUT ; +while (!(hdq_data->hdq_irqstatus + &OMAP_HDQ_INT_STATUS_RXCOMPLETE ) + &&time_before (jiffies, timeout)) { +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (1 ); + } + } +hdq_reg_merge (OMAP_HDQ_CTRL_STATUS ,0 , +OMAP_HDQ_CTRL_STATUS_DIR ); +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); + status = hdq_data->hdq_irqstatus; +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); +/* check irqstatus */ +if (!(status &OMAP_HDQ_INT_STATUS_RXCOMPLETE )) { +pr_debug ("timeout waiting for RXCOMPLETE, %x" , status); +up (&hdq_data->hdq_semlock); +return -ETIMEDOUT ; + } + } +/* the data is ready. Read it in! */ + *val =hdq_reg_in (OMAP_HDQ_RX_DATA ); +up (&hdq_data->hdq_semlock); + +return 0 ; + +} + +/* +* Enable clocks and set the controller to HDQ mode. +*/ +static int +omap_hdq_get () +{ +int ret =0 ; + + ret =down_interruptible (&hdq_data->hdq_semlock); +if (ret <0 ) +return -EINTR ; + +if (OMAP_HDQ_MAX_USER == hdq_data->hdq_usecount) { +pr_debug ("attempt to exceed the max use count" ); +up (&hdq_data->hdq_semlock); + ret = -EINVAL ; + }else { + hdq_data->hdq_usecount++; +try_module_get (THIS_MODULE ); +if (1 == hdq_data->hdq_usecount) { +if (clk_enable (hdq_data->hdq_ick)) { +pr_debug ("Can not enable ick\n" ); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +up (&hdq_data->hdq_semlock); +return -ENODEV ; + } +if (clk_enable (hdq_data->hdq_fck)) { +pr_debug ("Can not enable fck\n" ); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +up (&hdq_data->hdq_semlock); +return -ENODEV ; + } + +/* make sure HDQ is out of reset */ +if (!(hdq_reg_in (OMAP_HDQ_SYSSTATUS ) & +OMAP_HDQ_SYSSTATUS_RESETDONE )) { + ret =_omap_hdq_reset (); +if (ret) +/* back up the count */ + hdq_data->hdq_usecount--; + }else { +/* select HDQ mode & enable clocks */ +hdq_reg_out (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_CLOCKENABLE | +OMAP_HDQ_CTRL_STATUS_INTERRUPTMASK ); +hdq_reg_out (OMAP_HDQ_SYSCONFIG , +OMAP_HDQ_SYSCONFIG_AUTOIDLE ); +hdq_reg_in (OMAP_HDQ_INT_STATUS ); + } + } + } +up (&hdq_data->hdq_semlock); +return ret; +} + +/* +* Disable clocks to the module. +*/ +static int +omap_hdq_put () +{ +int ret =0 ; + + ret =down_interruptible (&hdq_data->hdq_semlock); +if (ret <0 ) +return -EINTR ; + +if (0 == hdq_data->hdq_usecount) { +pr_debug ("attempt to decrement use count when it is zero" ); + ret = -EINVAL ; + }else { + hdq_data->hdq_usecount--; +module_put (THIS_MODULE ); +if (0 == hdq_data->hdq_usecount) { +clk_disable (hdq_data->hdq_ick); +clk_disable (hdq_data->hdq_fck); + } + } +up (&hdq_data->hdq_semlock); +return ret; +} + +/* +* Used to control the call to omap_hdq_get and omap_hdq_put. +* HDQ Protocol: Write the CMD|REG_address first, followed by +* the data wrire or read. +*/ +static int init_trans; + +/* +* Read a byte of data from the device. +*/ +static u8 omap_w1_read_byte (void *data) +{ +u8 val; +int ret; + + ret =hdq_read_byte (&val); +if (ret) { + init_trans =0 ; +omap_hdq_put (); +return -1 ; + } + +/* Write followed by a read, release the module */ +if (init_trans) { + init_trans =0 ; +omap_hdq_put (); + } + +return val; +} + +/* +* Write a byte of data to the device. +*/ +static void omap_w1_write_byte (void *data,u8 byte) +{ +u8 status; + +/* First write to initialize the transfer */ +if (init_trans ==0 ) +omap_hdq_get (); + + init_trans++; + +hdq_write_byte (byte, &status); +pr_debug ("Ctrl status %x\n" , status); + +/* Second write, data transfered. Release the module */ +if (init_trans >1 ) { +omap_hdq_put (); + init_trans =0 ; + } + +return ; +} + +static int __init omap_hdq_probe (struct platform_device *pdev) +{ +struct resource *res; +int ret, irq; +u8 rev; + +if (!pdev) +return -ENODEV ; + + hdq_data =kmalloc (sizeof (*hdq_data),GFP_KERNEL ); +if (!hdq_data) +return -ENODEV ; + +platform_set_drvdata (pdev, hdq_data); + + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (res ==NULL ) { +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return -ENXIO ; + } + + hdq_data->hdq_base = res->start; + +/* get interface & functional clock objects */ + hdq_data->hdq_ick =clk_get (&pdev->dev,"hdq_ick" ); + hdq_data->hdq_fck =clk_get (&pdev->dev,"hdq_fck" ); + +if (IS_ERR (hdq_data->hdq_ick) ||IS_ERR (hdq_data->hdq_fck)) { +pr_debug ("Can't get HDQ clock objects\n" ); +if (IS_ERR (hdq_data->hdq_ick)) { + ret =PTR_ERR (hdq_data->hdq_ick); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return ret; + } +if (IS_ERR (hdq_data->hdq_fck)) { + ret =PTR_ERR (hdq_data->hdq_fck); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return ret; + } + } + + hdq_data->hdq_usecount =0 ; +sema_init (&hdq_data->hdq_semlock,1 ); + +if (clk_enable (hdq_data->hdq_ick)) { +pr_debug ("Can not enable ick\n" ); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return -ENODEV ; + } + +if (clk_enable (hdq_data->hdq_fck)) { +pr_debug ("Can not enable fck\n" ); +clk_disable (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return -ENODEV ; + } + + rev =hdq_reg_in (OMAP_HDQ_REVISION ); +pr_info ("OMAP HDQ Hardware Revision %c.%c. Driver in %s mode.\n" , + (rev >>4 ) +'0' , (rev &0x0f ) +'0' ,"Interrupt" ); + +spin_lock_init (&hdq_data->hdq_spinlock); +omap_hdq_break (); + + irq =platform_get_irq (pdev,0 ); +if (irq <0 ) { +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return -ENXIO ; + } + +if (request_irq (irq, hdq_isr,IRQF_DISABLED ,"OMAP HDQ" , + &hdq_data->hdq_semlock)) { +pr_debug ("request_irq failed\n" ); +clk_disable (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return -ENODEV ; + } + +/* don't clock the HDQ until it is needed */ +clk_disable (hdq_data->hdq_ick); +clk_disable (hdq_data->hdq_fck); + + ret =w1_add_master_device (&omap_w1_master); +if (ret) { +pr_debug ("Failure in registering w1 master\n" ); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return ret; + } + +return 0 ; +} + +static int omap_hdq_remove (struct platform_device *pdev) +{ +down_interruptible (&hdq_data->hdq_semlock); +if (0 != hdq_data->hdq_usecount) { +pr_debug ("removed when use count is not zero\n" ); +return -EBUSY ; + } +up (&hdq_data->hdq_semlock); + +/* remove module dependency */ +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +free_irq (INT_24XX_HDQ_IRQ , &hdq_data->hdq_semlock); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); + +return 0 ; +} + +static int __init +omap_hdq_init (void ) +{ +return platform_driver_register (&omap_hdq_driver); +} + +static void __exit +omap_hdq_exit (void ) +{ +platform_driver_unregister (&omap_hdq_driver); +} + +module_init (omap_hdq_init); +module_exit (omap_hdq_exit); + +module_param (W1_ID , int,S_IRUSR ); + +MODULE_AUTHOR ("Texas Instruments" ); +MODULE_DESCRIPTION ("HDQ driver Library" ); +MODULE_LICENSE ("GPL" );Signature · 6 lines
1.6.0.1.141.g445ca -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 32/33] add omap 1-wire interface driver
Quoted 23 lines · Tony Lindgren
Quoted 9 lines · Madhusudhan Chikkature
----- Original Message -----
From: "Tony Lindgren" <[email protected]>
To: "Madhusudhan Chikkature" <[email protected]>
Cc: "Felipe Balbi" <[email protected]>; <[email protected]>; "Felipe Balbi" <[email protected]>
Sent: Friday, September 05, 2008 11:29 PM
Subject: Re: [PATCH 32/33] add omap 1-wire interface driverQuoted 8 lines
Quoted 7 lines · Madhusudhan Chikkature
Quoted 3 lines
Hi,
The HDQ patchset that I posted to Tony were given ACK by Evgeniy Polyakov on the omap list. I hope that helps.
Madhu, can you post your 1-wire driver to LKML and Cc Evgeniy Polyakov so we can get that integrated? Also Cc l-o list.
I have a question regarding this. In fact it can be a generic question which might apply for other drivers as well. How do we post the OMAP3 related driver patches to LKML or any other driver specific lists if OMAP3 base support is not already present there?
Well the drivers should not have dependencies to omap3 headers. And hopefully we'll have the minimal omap3 support integrated when 2.6.28 opens.
Quoted 6 lines
Also, you're already getting
IORESOURCE_MEMas rerource. And isn't this driver also on 24XX chips too?BTW, how about change it to use __raw_read/write instead of omap_read/write? Just ioremap the
IORESOURCE_MEM, see the recent ioremap changes.
Last point - shouldn't it be converted to using mutexes instead of semaphores?
Re: [PATCH 32/33] add omap 1-wire interface driver
In reply to Tony Lindgren----- Original Message -----
From: "Tony Lindgren" <[email protected]>
To: "Madhusudhan Chikkature" <[email protected]>
Cc: "Felipe Balbi" <[email protected]>; <[email protected]>; "Felipe Balbi" <[email protected]>
Sent: Monday, September 08, 2008 11:35 PM
Subject: Re: [PATCH 32/33] add omap 1-wire interface driver
Quoted 17 lines · Madhusudhan Chikkature
Quoted 16 lines
----- Original Message -----
From: "Tony Lindgren" <[email protected]>
To: "Madhusudhan Chikkature" <[email protected]>
Cc: "Felipe Balbi" <[email protected]>; <[email protected]>; "Felipe Balbi" <[email protected]>
Sent: Friday, September 05, 2008 11:29 PM
Subject: Re: [PATCH 32/33] add omap 1-wire interface driverQuoted 7 lines · Madhusudhan Chikkature
Quoted 3 lines
Hi,
The HDQ patchset that I posted to Tony were given ACK by Evgeniy Polyakov on the omap list. I hope that helps.
Madhu, can you post your 1-wire driver to LKML and Cc Evgeniy Polyakov so we can get that integrated? Also Cc l-o list.
Quoted 8 lines
Quoted 1 line
I have a question regarding this. In fact it can be a generic question which might apply for other drivers as well. How do we post the OMAP3 related driver patches to LKML or any other driver specific lists if OMAP3 base support is not already present there?
Well the drivers should not have dependencies to omap3 headers. And hopefully we'll have the minimal omap3 support integrated when 2.6.28 opens.
Also, you're already getting
IORESOURCE_MEMas rerource. And isn't this driver also on 24XX chips too?
Yes. This driver should work on 2430 as well.
Quoted 4 lines
BTW, how about change it to use __raw_read/write instead of omap_read/write? Just ioremap the
IORESOURCE_MEM, see the recent ioremap changes.
Okay. I will look at those changes.
Regards,
Madhu
Quoted 804 lines
Regards,
Tony
Quoted 797 lines
Regards,
MadhuQuoted 794 lines
Thanks,
Tony
Quoted 787 lines
Regards,
Madhu----- Original Message -----
From: "Felipe Balbi" <[email protected]>
To: <[email protected]>
Cc: "Felipe Balbi" <[email protected]>
Sent: Saturday, August 30, 2008 10:46 PM
Subject: [PATCH 32/33] add omap 1-wire interface driverQuoted 771 lines
From: Felipe Balbi <[email protected]>
Signed-off-by Felipe Balbi <[email protected]>---
arch/arm/plat-omap/include/mach/irqs.h | 2 + drivers/w1/masters/Kconfig | 7 + drivers/w1/masters/Makefile | 1 + drivers/w1/masters/omap_hdq.c | 704 ++++++++++++++++++++++++++++++++ 4 files changed, 714 insertions(+), 0 deletions(-)create mode 100644
drivers/w1/masters/omap_hdq.carch/arm/plat-omap/include/mach/irqs.h +2
-0@@ -54,6 +54,8 @@#define INT_TIMER2 30#define INT_LCD_CTRL 31 +#define INT_24XX_HDQ_IRQ 58/* Temporarily here for driver to build */ +/* * OMAP-1510 specific IRQ numbers for interrupt handler 1 */ drivers/w1/masters/Kconfig +7
-0@@ -42,6 +42,13 @@ config W1_MASTER_DS1WM in HP iPAQ devices like h5xxx, h2200, and ASIC3-based like hx4700. +config HDQ_MASTER_OMAP + tristate "OMAP HDQ driver" + depends on ARCH_OMAP2430 || ARCH_OMAP34XX + help + Say Y here if you want support for the 1-wire or HDQ Interface + on an OMAP processor. +config
W1_MASTER_GPIO
tristate "GPIO 1-wire busmaster"
depends onGENERIC_GPIOdrivers/w1/masters/Makefile +0
-0@@ -6,4 +6,5 @@ obj-$(CONFIG_W1_MASTER_MATROX) += matrox_w1.oobj-$(CONFIG_W1_MASTER_DS2490) += ds2490.o
obj-$(CONFIG_W1_MASTER_DS2482) += ds2482.o
obj-$(CONFIG_W1_MASTER_DS1WM) += ds1wm.o
+obj-$(CONFIG_HDQ_MASTER_OMAP) += omap_hdq.o
obj-$(CONFIG_W1_MASTER_GPIO) += w1-gpio.odrivers/w1/masters/omap_hdq.c new file +704
-0@@ -0,0 +1,704 @@ +/* +* drivers/w1/masters/omap_hdq.c +* +* Copyright (C) 2007 Texas Instruments, Inc. +* +* This file is licensed under the terms of the GNU General Public License +* version 2. This program is licensed "as is" without any warranty of any +* kind, whether express or implied. +* +*/ +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/interrupt.h> +#include <linux/err.h> +#include <linux/clk.h> +#include <linux/io.h> +#include <asm/irq.h> +#include <mach/hardware.h> + +#include "../w1.h" +#include "../w1_int.h" + +#define MOD_NAME "OMAP_HDQ:" + +#define OMAP_HDQ_REVISION 0x00 +#define OMAP_HDQ_TX_DATA 0x04 +#define OMAP_HDQ_RX_DATA 0x08 +#define OMAP_HDQ_CTRL_STATUS 0x0c +#define OMAP_HDQ_CTRL_STATUS_INTERRUPTMASK (1<<6) +#define OMAP_HDQ_CTRL_STATUS_CLOCKENABLE (1<<5) +#define OMAP_HDQ_CTRL_STATUS_GO (1<<4) +#define OMAP_HDQ_CTRL_STATUS_INITIALIZATION (1<<2) +#define OMAP_HDQ_CTRL_STATUS_DIR (1<<1) +#define OMAP_HDQ_CTRL_STATUS_MODE (1<<0) +#define OMAP_HDQ_INT_STATUS 0x10 +#define OMAP_HDQ_INT_STATUS_TXCOMPLETE (1<<2) +#define OMAP_HDQ_INT_STATUS_RXCOMPLETE (1<<1) +#define OMAP_HDQ_INT_STATUS_TIMEOUT (1<<0) +#define OMAP_HDQ_SYSCONFIG 0x14 +#define OMAP_HDQ_SYSCONFIG_SOFTRESET (1<<1) +#define OMAP_HDQ_SYSCONFIG_AUTOIDLE (1<<0) +#define OMAP_HDQ_SYSSTATUS 0x18 +#define OMAP_HDQ_SYSSTATUS_RESETDONE (1<<0) + +#define OMAP_HDQ_FLAG_CLEAR 0 +#define OMAP_HDQ_FLAG_SET 1 +#define OMAP_HDQ_TIMEOUT (HZ/5) + +#define OMAP_HDQ_MAX_USER 4 + +DECLARE_WAIT_QUEUE_HEAD (hdq_wait_queue); +int W1_ID ; + +struct hdq_data { +resource_size_t hdq_base; +struct semaphore hdq_semlock; +int hdq_usecount; +struct clk *hdq_ick; +struct clk *hdq_fck; +u8 hdq_irqstatus; +spinlock_t hdq_spinlock; +}; + +static struct hdq_data *hdq_data; + +static int omap_hdq_get (void ); +static int omap_hdq_put (void ); +static int omap_hdq_break (void ); + +static int __init omap_hdq_probe (struct platform_device *pdev); +static int omap_hdq_remove (struct platform_device *pdev); + +static struct platform_driver omap_hdq_driver = { + .probe = omap_hdq_probe, + .remove = omap_hdq_remove, + .suspend =NULL , + .resume =NULL , + .driver = { + .name ="omap_hdq" , + }, +}; + +static u8 omap_w1_read_byte (void *data); +static void omap_w1_write_byte (void *data,u8 byte); +static u8 omap_w1_reset_bus (void *data); +static void omap_w1_search_bus (void *data,u8 search_type, +w1_slave_found_callback slave_found); + +static struct w1_bus_master omap_w1_master = { + .read_byte = omap_w1_read_byte, + .write_byte = omap_w1_write_byte, + .reset_bus = omap_w1_reset_bus, + .search = omap_w1_search_bus, +}; + +/* +* HDQ register I/O routines +*/ +static inline u8 +hdq_reg_in (u32 offset) +{ +return omap_readb (hdq_data->hdq_base + offset); +} + +static inline u8 +hdq_reg_out (u32 offset,u8 val) +{ +omap_writeb (val, hdq_data->hdq_base + offset); +return val; +} + +static inline u8 +hdq_reg_merge (u32 offset,u8 val,u8 mask) +{ +u8 new_val = (omap_readb (hdq_data->hdq_base + offset) & ~mask) + | (val & mask); +omap_writeb (new_val, hdq_data->hdq_base + offset); +return new_val; +} + +/* +* Wait for one or more bits in flag change. +* HDQ_FLAG_SET: wait until any bit in the flag is set. +* HDQ_FLAG_CLEAR: wait until all bits in the flag are cleared. +* return 0 on success and -ETIMEDOUT in the case of timeout. +*/ +static int +hdq_wait_for_flag (u32 offset,u8 flag,u8 flag_set,u8 *status) +{ +int ret =0 ; +unsigned long timeout = jiffies +OMAP_HDQ_TIMEOUT ; + +if (flag_set ==OMAP_HDQ_FLAG_CLEAR ) { +/* wait for the flag clear */ +while (((*status =hdq_reg_in (offset)) & flag) + &&time_before (jiffies, timeout)) { +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (1 ); + } +if (unlikely (*status & flag)) + ret = -ETIMEDOUT ; + }else if (flag_set ==OMAP_HDQ_FLAG_SET ) { +/* wait for the flag set */ +while (!((*status =hdq_reg_in (offset)) & flag) + &&time_before (jiffies, timeout)) { +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (1 ); + } +if (unlikely (!(*status & flag))) + ret = -ETIMEDOUT ; + }else +return -EINVAL ; + +return ret; +} + +/* +* write out a byte and fill *status with HDQ_INT_STATUS +*/ +static int +hdq_write_byte (u8 val,u8 *status) +{ +int ret; +u8 tmp_status; +unsigned long irqflags; + + *status =0 ; + +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); +/* clear interrupt flags via a dummy read */ +hdq_reg_in (OMAP_HDQ_INT_STATUS ); +/* ISR loads it with new INT_STATUS */ + hdq_data->hdq_irqstatus =0 ; +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); + +hdq_reg_out (OMAP_HDQ_TX_DATA , val); + +/* set the GO bit */ +hdq_reg_merge (OMAP_HDQ_CTRL_STATUS ,OMAP_HDQ_CTRL_STATUS_GO , +OMAP_HDQ_CTRL_STATUS_DIR |OMAP_HDQ_CTRL_STATUS_GO ); +/* wait for the TXCOMPLETE bit */ + ret =wait_event_interruptible_timeout (hdq_wait_queue, + hdq_data->hdq_irqstatus,OMAP_HDQ_TIMEOUT ); +if (unlikely (ret <0 )) { +pr_debug ("wait interrupted" ); +return -EINTR ; + } + +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); + *status = hdq_data->hdq_irqstatus; +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); +/* check irqstatus */ +if (!(*status &OMAP_HDQ_INT_STATUS_TXCOMPLETE )) { +pr_debug ("timeout waiting for TXCOMPLETE/RXCOMPLETE, %x" , + *status); +return -ETIMEDOUT ; + } + +/* wait for the GO bit return to zero */ + ret =hdq_wait_for_flag (OMAP_HDQ_CTRL_STATUS ,OMAP_HDQ_CTRL_STATUS_GO , +OMAP_HDQ_FLAG_CLEAR , &tmp_status); +if (ret) { +pr_debug ("timeout waiting GO bit return to zero, %x" , + tmp_status); +return ret; + } + +return ret; +} + +/* +* HDQ Interrupt service routine. +*/ +static irqreturn_t +hdq_isr (int irq,void *arg) +{ +unsigned long irqflags; + +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); + hdq_data->hdq_irqstatus =hdq_reg_in (OMAP_HDQ_INT_STATUS ); +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); +pr_debug ("hdq_isr: %x" , hdq_data->hdq_irqstatus); + +if (hdq_data->hdq_irqstatus & + (OMAP_HDQ_INT_STATUS_TXCOMPLETE |OMAP_HDQ_INT_STATUS_RXCOMPLETE + |OMAP_HDQ_INT_STATUS_TIMEOUT )) { +/* wake up sleeping process */ +wake_up_interruptible (&hdq_wait_queue); + } + +return IRQ_HANDLED ; +} + +/* +* HDQ Mode: always return success. +*/ +static u8 omap_w1_reset_bus (void *data) +{ +return 0 ; +} + +/* +* W1 search callback function. +*/ +static void omap_w1_search_bus (void *data,u8 search_type, +w1_slave_found_callback slave_found) +{ +u64 module_id, rn_le, cs, id; + +if (W1_ID ) + module_id =W1_ID ; +else + module_id =0x1 ; + + rn_le =cpu_to_le64 (module_id); +/* +* HDQ might not obey truly the 1-wire spec. +* So calculate CRC based on module parameter. +*/ + cs =w1_calc_crc8 ((u8 *)&rn_le,7 ); + id = (cs <<56 ) | module_id; + +slave_found (data, id); +} + +static int +_omap_hdq_reset (void ) +{ +int ret; +u8 tmp_status; + +hdq_reg_out (OMAP_HDQ_SYSCONFIG ,OMAP_HDQ_SYSCONFIG_SOFTRESET ); +/* +* Select HDQ mode & enable clocks. +* It is observed that INT flags can't be cleared via a read and GO/INIT +* won't return to zero if interrupt is disabled. So we always enable +* interrupt. +*/ +hdq_reg_out (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_CLOCKENABLE | +OMAP_HDQ_CTRL_STATUS_INTERRUPTMASK ); + +/* wait for reset to complete */ + ret =hdq_wait_for_flag (OMAP_HDQ_SYSSTATUS , +OMAP_HDQ_SYSSTATUS_RESETDONE ,OMAP_HDQ_FLAG_SET , &tmp_status); +if (ret) +pr_debug ("timeout waiting HDQ reset, %x" , tmp_status); +else { +hdq_reg_out (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_CLOCKENABLE | +OMAP_HDQ_CTRL_STATUS_INTERRUPTMASK ); +hdq_reg_out (OMAP_HDQ_SYSCONFIG ,OMAP_HDQ_SYSCONFIG_AUTOIDLE ); + } + +return ret; +} + +/* +* Issue break pulse to the device. +*/ +static int +omap_hdq_break () +{ +int ret; +u8 tmp_status; +unsigned long irqflags; + + ret =down_interruptible (&hdq_data->hdq_semlock); +if (ret <0 ) +return -EINTR ; + +if (!hdq_data->hdq_usecount) { +up (&hdq_data->hdq_semlock); +return -EINVAL ; + } + +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); +/* clear interrupt flags via a dummy read */ +hdq_reg_in (OMAP_HDQ_INT_STATUS ); +/* ISR loads it with new INT_STATUS */ + hdq_data->hdq_irqstatus =0 ; +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); + +/* set the INIT and GO bit */ +hdq_reg_merge (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_INITIALIZATION |OMAP_HDQ_CTRL_STATUS_GO , +OMAP_HDQ_CTRL_STATUS_DIR |OMAP_HDQ_CTRL_STATUS_INITIALIZATION | +OMAP_HDQ_CTRL_STATUS_GO ); + +/* wait for the TIMEOUT bit */ + ret =wait_event_interruptible_timeout (hdq_wait_queue, + hdq_data->hdq_irqstatus,OMAP_HDQ_TIMEOUT ); +if (unlikely (ret <0 )) { +pr_debug ("wait interrupted" ); +up (&hdq_data->hdq_semlock); +return -EINTR ; + } + +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); + tmp_status = hdq_data->hdq_irqstatus; +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); +/* check irqstatus */ +if (!(tmp_status &OMAP_HDQ_INT_STATUS_TIMEOUT )) { +pr_debug ("timeout waiting for TIMEOUT, %x" , tmp_status); +up (&hdq_data->hdq_semlock); +return -ETIMEDOUT ; + } +/* +* wait for both INIT and GO bits rerurn to zero. +* zero wait time expected for interrupt mode. +*/ + ret =hdq_wait_for_flag (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_INITIALIZATION | +OMAP_HDQ_CTRL_STATUS_GO ,OMAP_HDQ_FLAG_CLEAR , + &tmp_status); +if (ret) +pr_debug ("timeout waiting INIT&GO bits return to zero, %x" , + tmp_status); + +up (&hdq_data->hdq_semlock); +return ret; +} + +static int hdq_read_byte (u8 *val) +{ +int ret; +u8 status; +unsigned long irqflags; + + ret =down_interruptible (&hdq_data->hdq_semlock); +if (ret <0 ) +return -EINTR ; + +if (!hdq_data->hdq_usecount) { +up (&hdq_data->hdq_semlock); +return -EINVAL ; + } + +if (!(hdq_data->hdq_irqstatus &OMAP_HDQ_INT_STATUS_RXCOMPLETE )) { +hdq_reg_merge (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_DIR |OMAP_HDQ_CTRL_STATUS_GO , +OMAP_HDQ_CTRL_STATUS_DIR |OMAP_HDQ_CTRL_STATUS_GO ); +/* +* The RX comes immediately after TX. It +* triggers another interrupt before we +* sleep. So we have to wait for RXCOMPLETE bit. +*/ + { +unsigned long timeout = jiffies +OMAP_HDQ_TIMEOUT ; +while (!(hdq_data->hdq_irqstatus + &OMAP_HDQ_INT_STATUS_RXCOMPLETE ) + &&time_before (jiffies, timeout)) { +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (1 ); + } + } +hdq_reg_merge (OMAP_HDQ_CTRL_STATUS ,0 , +OMAP_HDQ_CTRL_STATUS_DIR ); +spin_lock_irqsave (&hdq_data->hdq_spinlock, irqflags); + status = hdq_data->hdq_irqstatus; +spin_unlock_irqrestore (&hdq_data->hdq_spinlock, irqflags); +/* check irqstatus */ +if (!(status &OMAP_HDQ_INT_STATUS_RXCOMPLETE )) { +pr_debug ("timeout waiting for RXCOMPLETE, %x" , status); +up (&hdq_data->hdq_semlock); +return -ETIMEDOUT ; + } + } +/* the data is ready. Read it in! */ + *val =hdq_reg_in (OMAP_HDQ_RX_DATA ); +up (&hdq_data->hdq_semlock); + +return 0 ; + +} + +/* +* Enable clocks and set the controller to HDQ mode. +*/ +static int +omap_hdq_get () +{ +int ret =0 ; + + ret =down_interruptible (&hdq_data->hdq_semlock); +if (ret <0 ) +return -EINTR ; + +if (OMAP_HDQ_MAX_USER == hdq_data->hdq_usecount) { +pr_debug ("attempt to exceed the max use count" ); +up (&hdq_data->hdq_semlock); + ret = -EINVAL ; + }else { + hdq_data->hdq_usecount++; +try_module_get (THIS_MODULE ); +if (1 == hdq_data->hdq_usecount) { +if (clk_enable (hdq_data->hdq_ick)) { +pr_debug ("Can not enable ick\n" ); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +up (&hdq_data->hdq_semlock); +return -ENODEV ; + } +if (clk_enable (hdq_data->hdq_fck)) { +pr_debug ("Can not enable fck\n" ); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +up (&hdq_data->hdq_semlock); +return -ENODEV ; + } + +/* make sure HDQ is out of reset */ +if (!(hdq_reg_in (OMAP_HDQ_SYSSTATUS ) & +OMAP_HDQ_SYSSTATUS_RESETDONE )) { + ret =_omap_hdq_reset (); +if (ret) +/* back up the count */ + hdq_data->hdq_usecount--; + }else { +/* select HDQ mode & enable clocks */ +hdq_reg_out (OMAP_HDQ_CTRL_STATUS , +OMAP_HDQ_CTRL_STATUS_CLOCKENABLE | +OMAP_HDQ_CTRL_STATUS_INTERRUPTMASK ); +hdq_reg_out (OMAP_HDQ_SYSCONFIG , +OMAP_HDQ_SYSCONFIG_AUTOIDLE ); +hdq_reg_in (OMAP_HDQ_INT_STATUS ); + } + } + } +up (&hdq_data->hdq_semlock); +return ret; +} + +/* +* Disable clocks to the module. +*/ +static int +omap_hdq_put () +{ +int ret =0 ; + + ret =down_interruptible (&hdq_data->hdq_semlock); +if (ret <0 ) +return -EINTR ; + +if (0 == hdq_data->hdq_usecount) { +pr_debug ("attempt to decrement use count when it is zero" ); + ret = -EINVAL ; + }else { + hdq_data->hdq_usecount--; +module_put (THIS_MODULE ); +if (0 == hdq_data->hdq_usecount) { +clk_disable (hdq_data->hdq_ick); +clk_disable (hdq_data->hdq_fck); + } + } +up (&hdq_data->hdq_semlock); +return ret; +} + +/* +* Used to control the call to omap_hdq_get and omap_hdq_put. +* HDQ Protocol: Write the CMD|REG_address first, followed by +* the data wrire or read. +*/ +static int init_trans; + +/* +* Read a byte of data from the device. +*/ +static u8 omap_w1_read_byte (void *data) +{ +u8 val; +int ret; + + ret =hdq_read_byte (&val); +if (ret) { + init_trans =0 ; +omap_hdq_put (); +return -1 ; + } + +/* Write followed by a read, release the module */ +if (init_trans) { + init_trans =0 ; +omap_hdq_put (); + } + +return val; +} + +/* +* Write a byte of data to the device. +*/ +static void omap_w1_write_byte (void *data,u8 byte) +{ +u8 status; + +/* First write to initialize the transfer */ +if (init_trans ==0 ) +omap_hdq_get (); + + init_trans++; + +hdq_write_byte (byte, &status); +pr_debug ("Ctrl status %x\n" , status); + +/* Second write, data transfered. Release the module */ +if (init_trans >1 ) { +omap_hdq_put (); + init_trans =0 ; + } + +return ; +} + +static int __init omap_hdq_probe (struct platform_device *pdev) +{ +struct resource *res; +int ret, irq; +u8 rev; + +if (!pdev) +return -ENODEV ; + + hdq_data =kmalloc (sizeof (*hdq_data),GFP_KERNEL ); +if (!hdq_data) +return -ENODEV ; + +platform_set_drvdata (pdev, hdq_data); + + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (res ==NULL ) { +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return -ENXIO ; + } + + hdq_data->hdq_base = res->start; + +/* get interface & functional clock objects */ + hdq_data->hdq_ick =clk_get (&pdev->dev,"hdq_ick" ); + hdq_data->hdq_fck =clk_get (&pdev->dev,"hdq_fck" ); + +if (IS_ERR (hdq_data->hdq_ick) ||IS_ERR (hdq_data->hdq_fck)) { +pr_debug ("Can't get HDQ clock objects\n" ); +if (IS_ERR (hdq_data->hdq_ick)) { + ret =PTR_ERR (hdq_data->hdq_ick); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return ret; + } +if (IS_ERR (hdq_data->hdq_fck)) { + ret =PTR_ERR (hdq_data->hdq_fck); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return ret; + } + } + + hdq_data->hdq_usecount =0 ; +sema_init (&hdq_data->hdq_semlock,1 ); + +if (clk_enable (hdq_data->hdq_ick)) { +pr_debug ("Can not enable ick\n" ); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return -ENODEV ; + } + +if (clk_enable (hdq_data->hdq_fck)) { +pr_debug ("Can not enable fck\n" ); +clk_disable (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return -ENODEV ; + } + + rev =hdq_reg_in (OMAP_HDQ_REVISION ); +pr_info ("OMAP HDQ Hardware Revision %c.%c. Driver in %s mode.\n" , + (rev >>4 ) +'0' , (rev &0x0f ) +'0' ,"Interrupt" ); + +spin_lock_init (&hdq_data->hdq_spinlock); +omap_hdq_break (); + + irq =platform_get_irq (pdev,0 ); +if (irq <0 ) { +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return -ENXIO ; + } + +if (request_irq (irq, hdq_isr,IRQF_DISABLED ,"OMAP HDQ" , + &hdq_data->hdq_semlock)) { +pr_debug ("request_irq failed\n" ); +clk_disable (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return -ENODEV ; + } + +/* don't clock the HDQ until it is needed */ +clk_disable (hdq_data->hdq_ick); +clk_disable (hdq_data->hdq_fck); + + ret =w1_add_master_device (&omap_w1_master); +if (ret) { +pr_debug ("Failure in registering w1 master\n" ); +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); +return ret; + } + +return 0 ; +} + +static int omap_hdq_remove (struct platform_device *pdev) +{ +down_interruptible (&hdq_data->hdq_semlock); +if (0 != hdq_data->hdq_usecount) { +pr_debug ("removed when use count is not zero\n" ); +return -EBUSY ; + } +up (&hdq_data->hdq_semlock); + +/* remove module dependency */ +clk_put (hdq_data->hdq_ick); +clk_put (hdq_data->hdq_fck); +free_irq (INT_24XX_HDQ_IRQ , &hdq_data->hdq_semlock); +platform_set_drvdata (pdev,NULL ); +kfree (hdq_data); + +return 0 ; +} + +static int __init +omap_hdq_init (void ) +{ +return platform_driver_register (&omap_hdq_driver); +} + +static void __exit +omap_hdq_exit (void ) +{ +platform_driver_unregister (&omap_hdq_driver); +} + +module_init (omap_hdq_init); +module_exit (omap_hdq_exit); + +module_param (W1_ID , int,S_IRUSR ); + +MODULE_AUTHOR ("Texas Instruments" ); +MODULE_DESCRIPTION ("HDQ driver Library" ); +MODULE_LICENSE ("GPL" );Signature · 6 lines
1.6.0.1.141.g445ca -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 30/33] add omap backlight support
In reply to Felipe BalbiQuoted 6 lines · Felipe Balbi
---
drivers/video/backlight/Kconfig | 9 ++drivers/video/backlight/Makefile| 1 +drivers/video/backlight/omap_bl.c| 218 +++++++++++++++++++++++++++++++++++++3 files changed, 228 insertions(+), 0 deletions(-)create mode 100644
drivers/video/backlight/omap_bl.c
How is this different from drivers/video/backlight/omap1_bl.c which is already upstream?
Looks to me like this is an old version of the same code, and this driver should have been removed ... double check to make sure no bugfixes are missing upstream.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 30/33] add omap backlight support
Quoted 8 lines · David Brownell
Quoted 6 lines · Felipe Balbi
---
drivers/video/backlight/Kconfig | 9 ++drivers/video/backlight/Makefile| 1 +drivers/video/backlight/omap_bl.c| 218 +++++++++++++++++++++++++++++++++++++3 files changed, 228 insertions(+), 0 deletions(-)create mode 100644
drivers/video/backlight/omap_bl.c
Quoted 6 lines
How is this different from
drivers/video/backlight/omap1_bl.cwhich is already upstream?Looks to me like this is an old version of the same code, and this driver should have been removed ... double check to make sure no bugfixes are missing upstream.
Weird that git marked this one as new file :-s
I'm dropping from the series.
Signature · 5 lines
balbi -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 30/33] add omap backlight support
Quoted 12 lines · Felipe Balbi
Quoted 11 lines · David Brownell
Quoted 6 lines · Felipe Balbi
---
drivers/video/backlight/Kconfig | 9 ++drivers/video/backlight/Makefile| 1 +drivers/video/backlight/omap_bl.c| 218 +++++++++++++++++++++++++++++++++++++3 files changed, 228 insertions(+), 0 deletions(-)create mode 100644
drivers/video/backlight/omap_bl.cHow is this different from
drivers/video/backlight/omap1_bl.cwhich is already upstream?
Quoted 7 lines
Quoted 3 lines
Looks to me like this is an old version of the same code, and this driver should have been removed ... double check to make sure no bugfixes are missing upstream.
Weird that git marked this one as new file :-s
I'm dropping from the series.
The problem is on linux-omap. It has a file without Makefile and Kconfig entries. I'm sending a patch soonish.
Signature · 5 lines
balbi -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 29/33] add omap ehci bus glue
In reply to Felipe BalbiQuoted 8 lines · Felipe Balbi
drivers/usb/host/Kconfig +8
-0+choice + prompt "PHY/TLL mode" + depends on USB_EHCI_HCD && EXPERIMENTAL && ARCH_OMAP34XX + ---help--- + Choose PHY or TLL mode of operation + +config OMAP_EHCI_PHY_MODE + bool "PHY mode: ISP1504 on Port1/2 (NEW 3430ES2.0)"
drivers/usb/host/Kconfig config USB_EHCI_HCD · line 61
Quoted 10 lines
drivers/usb/host/Kconfig +10
-0+ depends on USB_EHCI_HCD && EXPERIMENTAL && ARCH_OMAP34XX + ---help--- + EHCI PHY mode. Port1 and Port2 are connected to ISP1504 transcievers + +config OMAP_EHCI_TLL_MODE + bool "TLL mode: (EXPERIMENTAL)" + depends on USB_EHCI_HCD && EXPERIMENTAL && ARCH_OMAP34XX + ---help--- + OMAP EHCI controller has TLL mode of operation for all 3 ports. + Use this mode when no transciever is present
All that stuff should be platform data, not Kconfig options.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 29/33] add omap ehci bus glue
Quoted 13 lines · David Brownell
Quoted 12 lines · Felipe Balbi
drivers/usb/host/Kconfig +12
-0+choice + prompt "PHY/TLL mode" + depends on USB_EHCI_HCD && EXPERIMENTAL && ARCH_OMAP34XX + ---help--- + Choose PHY or TLL mode of operation + +config OMAP_EHCI_PHY_MODE + bool "PHY mode: ISP1504 on Port1/2 (NEW 3430ES2.0)" + depends on USB_EHCI_HCD && EXPERIMENTAL && ARCH_OMAP34XX + ---help--- + EHCI PHY mode. Port1 and Port2 are connected to ISP1504 transcievers +
Quoted 8 lines
Quoted 6 lines
+config
OMAP_EHCI_TLL_MODE
+ bool "TLL mode: (EXPERIMENTAL)"
+ depends onUSB_EHCI_HCD&& EXPERIMENTAL &&ARCH_OMAP34XX+ ---help---
+ OMAP EHCI controller has TLL mode of operation for all 3 ports. + Use this mode when no transciever is presentAll that stuff should be platform data, not
Kconfigoptions.
Hmm... someone else will have to fix that. Will drop from the series from now as well.
Signature · 5 lines
balbi -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 29/33] add omap ehci bus glue
In reply to Felipe BalbiQuoted 11 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Felipe Balbi
Sent: Saturday, August 30, 2008 10:46 PM
To: [email protected]
Cc: Felipe Balbi
Subject: [PATCH 29/33] add omap ehci bus glueFrom: Felipe Balbi <[email protected]>
Signed-off-by Felipe Balbi <[email protected]>
Hold off on this one. I'll send a better version to linux-usb with a CC to linux-omap.
Regards,
Anand
Quoted 772 lines
--- drivers/usb/host/Kconfig | 19 ++ drivers/usb/host/ehci-hcd.c | 5 + drivers/usb/host/ehci-omap.c | 562 ++++++++++++++++++++++++++++++++++++++++++ drivers/usb/host/ehci-omap.h | 125 ++++++++++ 4 files changed, 711 insertions(+), 0 deletions(-) create mode 100644 drivers/usb/host/ehci-omap.c create mode 100644 drivers/usb/host/ehci-omap.hdrivers/usb/host/Kconfig +11
-0@@ -41,6 +41,25 @@ config USB_EHCI_HCD To compile this driver as a module, choose M here: the module will be called ehci-hcd. +choice + prompt "PHY/TLL mode" + depends on USB_EHCI_HCD && EXPERIMENTAL && ARCH_OMAP34XX + ---help--- + Choose PHY or TLL mode of operation + +config OMAP_EHCI_PHY_MODE + bool "PHY mode: ISP1504 on Port1/2 (NEW 3430ES2.0)" + depends on USB_EHCI_HCD && EXPERIMENTAL && ARCH_OMAP34XX + ---help--- + EHCI PHY mode. Port1 and Port2 are connected toISP1504 transcievers
drivers/usb/host/Kconfig +8
-0+ +config OMAP_EHCI_TLL_MODE + bool "TLL mode: (EXPERIMENTAL)" + depends on USB_EHCI_HCD && EXPERIMENTAL && ARCH_OMAP34XX + ---help--- + OMAP EHCI controller has TLL mode of operation for all 3 ports. + Use this mode when no transciever is present +endchoice config USB_EHCI_ROOT_HUB_TT bool "Root Hub Transaction Translators"drivers/usb/host/ehci-hcd.c +5
-0@@ -1009,6 +1009,11 @@ MODULE_LICENSE ("GPL");#define PLATFORM_DRIVER ehci_hcd_au1xxx_driver#endif +#ifdef CONFIG_ARCH_OMAP34XX +#include "ehci-omap.c" +#define PLATFORM_DRIVER ehci_hcd_omap_driver +#endif +#ifdef CONFIG_PPC_PS3 #include "ehci-ps3.c" #define PS3_SYSTEM_BUS_DRIVER ps3_ehci_driverdrivers/usb/host/ehci-omap.c new file +12
-0@@ -0,0 +1,562 @@ +/* +* ehci-omap.c - driver for USBHOST on OMAP 34xx processor +* +* Bus Glue for OMAP34xx USBHOST 3 port EHCI controller +* Tested on OMAP3430 ES2.0 SDP +* +* Copyright (C) 2007-2008 Texas Instruments, Inc. +* Author: Vikram Pandita <[email protected]> +* +* Based on "ehci-fsl.c" and "ehci-au1xxx.c" ehci glue layers +* +* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */drivers/usb/host/ehci-omap.c new file +279
-0+ +#include <linux/platform_device.h> +#include <linux/clk.h> +#include <mach/gpio.h> + +#include "ehci-omap.h" + + +#ifdef CONFIG_OMAP_EHCI_PHY_MODE +/* EHCI connected to External PHY */ + +/* External USB connectivity board: 750-2083-001 +* Connected to OMAP3430 SDP +* The board has Port1 and Port2 connected to ISP1504 in 12-pin ULPI mode +*/ + +/* ISSUE1: +* ISP1504 for input clocking mode needs special reset handling +* Hold the PHY in reset by asserting RESET_N signal +* Then start the 60Mhz clock input to PHY +* Release the reset after a delay - +* to get the PHY state machine in working state +*/ +#define EXTERNAL_PHY_RESET +#define EXT_PHY_RESET_GPIO_PORT1 (57) +#define EXT_PHY_RESET_GPIO_PORT2 (61) +#define EXT_PHY_RESET_DELAY (10) + +/* ISSUE2: +* USBHOST supports External charge pump PHYs only +* Use the VBUS from Port1 to power VBUS of Port2 externally +* So use Port2 as the working ULPI port +*/ +#define VBUS_INTERNAL_CHARGEPUMP_HACK + +#endif /* CONFIG_OMAP_EHCI_PHY_MODE */ + +/*-------------------------------------------------------------------------*/ + +/* Define USBHOST clocks for clock management */ +struct ehci_omap_clock_defs { +struct clk *usbhost_ick_clk; +struct clk *usbhost2_120m_fck_clk; +struct clk *usbhost1_48m_fck_clk; +struct clk *usbtll_fck_clk; +struct clk *usbtll_ick_clk; +}; + +/* Clock names as per clock framework: May change so keep as #defs */ +#define USBHOST_ICKL "usbhost_ick" +#define USBHOST_120M_FCLK "usbhost_120m_fck" +#define USBHOST_48M_FCLK "usbhost_48m_fck" +#define USBHOST_TLL_ICKL "usbtll_ick" +#define USBHOST_TLL_FCLK "usbtll_fck" +/*-------------------------------------------------------------------------*/ + + +#ifndef CONFIG_OMAP_EHCI_PHY_MODE + +static void omap_usb_utmi_init (struct usb_hcd *hcd,u8 tll_channel_mask) +{ +int i; + +/* Use UTMI Ports of TLL */ +omap_writel ((1 <<OMAP_UHH_HOSTCONFIG_ULPI_BYPASS_SHIFT )| + (1 <<OMAP_UHH_HOSTCONFIG_INCR4_BURST_EN_SHIFT )| + (1 <<OMAP_UHH_HOSTCONFIG_INCR8_BURST_EN_SHIFT )| + (1 <<OMAP_UHH_HOSTCONFIG_INCR16_BURST_EN_SHIFT )| + (0 <<OMAP_UHH_HOSTCONFIG_INCRX_ALIGN_EN_SHIFT ), +OMAP_UHH_HOSTCONFIG ); +/* Enusre bit is set */ +while (!(omap_readl (OMAP_UHH_HOSTCONFIG ) & + (1 <<OMAP_UHH_HOSTCONFIG_ULPI_BYPASS_SHIFT ))); + +dev_dbg (hcd->self.controller,"\nEntered UTMI MODE: success\n" ); + +/* Program the 3 TLL channels upfront */ + +for (i =0 ; i <OMAP_TLL_CHANNEL_COUNT ; i++) { + +/* Disable AutoIdle */ +omap_writel (omap_readl (OMAP_TLL_CHANNEL_CONF (i)) & + ~(1 <<OMAP_TLL_CHANNEL_CONF_UTMIAUTOIDLE_SHIFT ), +OMAP_TLL_CHANNEL_CONF (i)); +/* Disable BitStuffing */ +omap_writel (omap_readl (OMAP_TLL_CHANNEL_CONF (i)) & + ~(1 <<OMAP_TLL_CHANNEL_CONF_ULPINOBITSTUFF_SHIFT ), +OMAP_TLL_CHANNEL_CONF (i)); +/* SDR Mode */ +omap_writel (omap_readl (OMAP_TLL_CHANNEL_CONF (i)) & + ~(1 <<OMAP_TLL_CHANNEL_CONF_ULPIDDRMODE_SHIFT ), +OMAP_TLL_CHANNEL_CONF (i)); + + } + +/* Program Common TLL register */ +omap_writel ((1 <<OMAP_TLL_SHARED_CONF_FCLK_IS_ON_SHIFT ) | + (1 <<OMAP_TLL_SHARED_CONF_USB_DIVRATION_SHIFT ) | + (0 <<OMAP_TLL_SHARED_CONF_USB_180D_SDR_EN_SHIFT ) | + (0 <<OMAP_TLL_SHARED_CONF_USB_90D_DDR_EN_SHFT ), +OMAP_TLL_SHARED_CONF ); + +/* Enable channels now */ +for (i =0 ; i <OMAP_TLL_CHANNEL_COUNT ; i++) { + +/* Enable only the channel that is needed */ +if (!(tll_channel_mask &1 <<i)) +continue ; + +omap_writel (omap_readl (OMAP_TLL_CHANNEL_CONF (i)) | + (1 <<OMAP_TLL_CHANNEL_CONF_CHANEN_SHIFT ), +OMAP_TLL_CHANNEL_CONF (i)); + +omap_writeb (0xBE ,OMAP_TLL_ULPI_SCRATCH_REGISTER (i)); +dev_dbg (hcd->self.controller,"\nULPI_SCRATCH_REG[ch=%d]" +"= 0x%02x\n" , + i+1 ,omap_readb (OMAP_TLL_ULPI_SCRATCH_REGISTER (i))); + } +} + +#else +# define omap_usb_utmi_init (x, y) 0 +#endif + + +/* omap_start_ehc +* - Start the TI USBHOST controller +*/ +static int omap_start_ehc (struct platform_device *dev,struct usb_hcd *hcd) +{ +struct ehci_omap_clock_defs *ehci_clocks; + +dev_dbg (hcd->self.controller,": starting TI EHCI USB Controller\n" ); + + ehci_clocks = (struct ehci_omap_clock_defs *)( + ((char *)hcd_to_ehci (hcd)) + +sizeof (struct ehci_hcd )); + +/* Start DPLL5 Programming: +* Clock Framework is not doing this now: +* This will be done in clock framework later +*/ +/* Enable DPLL 5 : Based on Input of 13Mhz*/ +cm_write_mod_reg ((12 <<OMAP3430ES2_PERIPH2_DPLL_DIV_SHIFT )| + (120 <<OMAP3430ES2_PERIPH2_DPLL_MULT_SHIFT ), +PLL_MOD ,OMAP3430ES2_CM_CLKSEL4 ); + +cm_write_mod_reg (1 <<OMAP3430ES2_DIV_120M_SHIFT , +PLL_MOD ,OMAP3430ES2_CM_CLKSEL5 ); + +cm_write_mod_reg ((7 <<OMAP3430ES2_PERIPH2_DPLL_FREQSEL_SHIFT ) | + (7 <<OMAP3430ES2_EN_PERIPH2_DPLL_SHIFT ), +PLL_MOD ,OMAP3430ES2_CM_CLKEN2 ); + +while (!(cm_read_mod_reg (PLL_MOD ,CM_IDLEST2 ) & +OMAP3430ES2_ST_PERIPH2_CLK_MASK )) +dev_dbg (hcd->self.controller, +"idlest2 = 0x%x\n" , +cm_read_mod_reg (PLL_MOD ,CM_IDLEST2 )); +/* End DPLL5 programming */ + + +/* PRCM settings for USBHOST: +* Interface clk un-related to domain transition +*/ +cm_write_mod_reg (0 <<OMAP3430ES2_AUTO_USBHOST_SHIFT , +OMAP3430ES2_USBHOST_MOD ,CM_AUTOIDLE ); + +/* Disable sleep dependency with MPU and IVA */ +cm_write_mod_reg ((0 <<OMAP3430ES2_EN_MPU_SHIFT ) | + (0 <<OMAP3430ES2_EN_IVA2_SHIFT ), +OMAP3430ES2_USBHOST_MOD ,OMAP3430_CM_SLEEPDEP ); + +/* Disable Automatic transition of clock */ +cm_write_mod_reg (0 <<OMAP3430ES2_CLKTRCTRL_USBHOST_SHIFT , +OMAP3430ES2_USBHOST_MOD ,CM_CLKSTCTRL ); + +/* Enable Clocks for USBHOST */ + ehci_clocks->usbhost_ick_clk =clk_get (&dev->dev, +USBHOST_ICKL ); +if (IS_ERR (ehci_clocks->usbhost_ick_clk)) +return PTR_ERR (ehci_clocks->usbhost_ick_clk); +clk_enable (ehci_clocks->usbhost_ick_clk); + + + ehci_clocks->usbhost2_120m_fck_clk =clk_get (&dev->dev, +USBHOST_120M_FCLK ); +if (IS_ERR (ehci_clocks->usbhost2_120m_fck_clk)) +return PTR_ERR (ehci_clocks->usbhost2_120m_fck_clk); +clk_enable (ehci_clocks->usbhost2_120m_fck_clk); + + ehci_clocks->usbhost1_48m_fck_clk =clk_get (&dev->dev, +USBHOST_48M_FCLK ); +if (IS_ERR (ehci_clocks->usbhost1_48m_fck_clk)) +return PTR_ERR (ehci_clocks->usbhost1_48m_fck_clk); +clk_enable (ehci_clocks->usbhost1_48m_fck_clk); + + +#ifdef EXTERNAL_PHY_RESET +/* Refer: ISSUE1 */ +omap_request_gpio (EXT_PHY_RESET_GPIO_PORT1 ); +omap_set_gpio_direction (EXT_PHY_RESET_GPIO_PORT1 ,0 ); +omap_request_gpio (EXT_PHY_RESET_GPIO_PORT2 ); +omap_set_gpio_direction (EXT_PHY_RESET_GPIO_PORT2 ,0 ); +omap_set_gpio_dataout (EXT_PHY_RESET_GPIO_PORT1 ,0 ); +omap_set_gpio_dataout (EXT_PHY_RESET_GPIO_PORT2 ,0 ); +/* Hold the PHY in RESET for enough time till DIR is high */ +udelay (EXT_PHY_RESET_DELAY ); +#endif + +/* Configure TLL for 60Mhz clk for ULPI */ + ehci_clocks->usbtll_fck_clk =clk_get (&dev->dev,USBHOST_TLL_FCLK ); +if (IS_ERR (ehci_clocks->usbtll_fck_clk)) +return PTR_ERR (ehci_clocks->usbtll_fck_clk); +clk_enable (ehci_clocks->usbtll_fck_clk); + + ehci_clocks->usbtll_ick_clk =clk_get (&dev->dev,USBHOST_TLL_ICKL ); +if (IS_ERR (ehci_clocks->usbtll_ick_clk)) +return PTR_ERR (ehci_clocks->usbtll_ick_clk); +clk_enable (ehci_clocks->usbtll_ick_clk); + +/* Disable Auto Idle of USBTLL */ +cm_write_mod_reg ((0 <<OMAP3430ES2_AUTO_USBTLL_SHIFT ), +CORE_MOD ,CM_AUTOIDLE3 ); + +/* Wait for TLL to be Active */ +while ((cm_read_mod_reg (CORE_MOD ,OMAP2430_CM_IDLEST3 ) & + (1 <<OMAP3430ES2_ST_USBTLL_SHIFT ))); + +/* perform TLL soft reset, and wait until reset is complete */ +omap_writel (1 <<OMAP_USBTLL_SYSCONFIG_SOFTRESET_SHIFT , +OMAP_USBTLL_SYSCONFIG ); +/* Wait for TLL reset to complete */ +while (!(omap_readl (OMAP_USBTLL_SYSSTATUS ) & + (1 <<OMAP_USBTLL_SYSSTATUS_RESETDONE_SHIFT ))); + +dev_dbg (hcd->self.controller,"\n TLL RESET DONE\n" ); + +/* (1<<3) = no idle mode only for initial debugging */ +omap_writel ((1 <<OMAP_USBTLL_SYSCONFIG_ENAWAKEUP_SHIFT ) | + (1 <<OMAP_USBTLL_SYSCONFIG_SIDLEMODE_SHIFT ) | + (1 <<OMAP_USBTLL_SYSCONFIG_CACTIVITY_SHIFT ), +OMAP_USBTLL_SYSCONFIG ); + + +/* Put UHH in NoIdle/NoStandby mode */ +omap_writel ((0 <<OMAP_UHH_SYSCONFIG_AUTOIDLE_SHIFT ) | + (1 <<OMAP_UHH_SYSCONFIG_ENAWAKEUP_SHIFT ) | + (1 <<OMAP_UHH_SYSCONFIG_SIDLEMODE_SHIFT ) | + (1 <<OMAP_UHH_SYSCONFIG_CACTIVITY_SHIFT ) | + (1 <<OMAP_UHH_SYSCONFIG_MIDLEMODE_SHIFT ), +OMAP_UHH_SYSCONFIG ); + +#ifdef CONFIG_OMAP_EHCI_PHY_MODE +/* Bypass the TLL module for PHY mode operation */ +omap_writel ((0 <<OMAP_UHH_HOSTCONFIG_ULPI_BYPASS_SHIFT )| + (1 <<OMAP_UHH_HOSTCONFIG_INCR4_BURST_EN_SHIFT )| + (1 <<OMAP_UHH_HOSTCONFIG_INCR8_BURST_EN_SHIFT )| + (1 <<OMAP_UHH_HOSTCONFIG_INCR16_BURST_EN_SHIFT )| + (0 <<OMAP_UHH_HOSTCONFIG_INCRX_ALIGN_EN_SHIFT ), +OMAP_UHH_HOSTCONFIG ); +/* Ensure that BYPASS is set */ +while (omap_readl (OMAP_UHH_HOSTCONFIG ) & + (1 <<OMAP_UHH_HOSTCONFIG_ULPI_BYPASS_SHIFT )); + +dev_dbg (hcd->self.controller,"Entered ULPI PHY MODE: success" ); + +#else +/* Enable UTMI mode for all 3 TLL channels */ +omap_usb_utmi_init (hcd, +OMAP_TLL_CHANNEL_1_EN_MASK | +OMAP_TLL_CHANNEL_2_EN_MASK | +OMAP_TLL_CHANNEL_3_EN_MASK + ); +#endif + +#ifdef EXTERNAL_PHY_RESET +/* Refer ISSUE1: +* Hold the PHY in RESET for enough time till PHY is settled and ready
drivers/usb/host/ehci-omap.c new file +35
-0+*/ +udelay (EXT_PHY_RESET_DELAY ); +omap_set_gpio_dataout (EXT_PHY_RESET_GPIO_PORT1 ,1 ); +omap_set_gpio_dataout (EXT_PHY_RESET_GPIO_PORT2 ,1 ); +#endif + +#ifdef VBUS_INTERNAL_CHARGEPUMP_HACK +/* Refer ISSUE2: LINK assumes external charge pump */ + +/* use Port1 VBUS to charge externally Port2: +* So for PHY mode operation use Port2 only +*/ +omap_writel ((0xA <<EHCI_INSNREG05_ULPI_REGADD_SHIFT ) |/* OTG ctrl reg*/ + (2 <<EHCI_INSNREG05_ULPI_OPSEL_SHIFT ) |/* Write */ + (1 <<EHCI_INSNREG05_ULPI_PORTSEL_SHIFT ) |/* Port1 */ + (1 <<EHCI_INSNREG05_ULPI_CONTROL_SHIFT ) |/* Start */ + (0x26 ), +EHCI_INSNREG05_ULPI ); + +while (!(omap_readl (EHCI_INSNREG05_ULPI ) & + (1 <<EHCI_INSNREG05_ULPI_CONTROL_SHIFT ))); + +#endif + +return 0 ; +} + +/*-------------------------------------------------------------------------*/ + +static void omap_stop_ehc (struct platform_device *dev,struct usb_hcd *hcd) +{ +struct ehci_omap_clock_defs *ehci_clocks; + + ehci_clocks = (struct ehci_omap_clock_defs *) + (((char *)hcd_to_ehci(hcd)) +
sizeof(struct ehci_hcd));drivers/usb/host/ehci-omap.c new file +222
-0+ +dev_dbg (hcd->self.controller,": stopping TI EHCI USB Controller\n" ); + +/* Reset OMAP modules for insmod/rmmod to work */ +omap_writel ((1 <<1 ),OMAP_UHH_SYSCONFIG ); +while (!(omap_readl (OMAP_UHH_SYSSTATUS ) & (1 <<0 ))); +while (!(omap_readl (OMAP_UHH_SYSSTATUS ) & (1 <<1 ))); +while (!(omap_readl (OMAP_UHH_SYSSTATUS ) & (1 <<2 ))); +dev_dbg (hcd->self.controller, +"UHH RESET DONE OMAP_UHH_SYSSTATUS %x !!\n" , +omap_readl (OMAP_UHH_SYSSTATUS )); + +omap_writel ((1 <<1 ),OMAP_USBTLL_SYSCONFIG ); +while (!(omap_readl (OMAP_USBTLL_SYSSTATUS ) & (1 <<0 ))); +dev_dbg (hcd->self.controller,":TLL RESEET DONE" ); + +if (ehci_clocks->usbtll_fck_clk !=NULL ) { +clk_disable (ehci_clocks->usbtll_fck_clk); +clk_put (ehci_clocks->usbtll_fck_clk); + ehci_clocks->usbtll_fck_clk =NULL ; + } + +if (ehci_clocks->usbhost_ick_clk !=NULL ) { +clk_disable (ehci_clocks->usbhost_ick_clk); +clk_put (ehci_clocks->usbhost_ick_clk); + ehci_clocks->usbhost_ick_clk =NULL ; + } + +if (ehci_clocks->usbhost1_48m_fck_clk !=NULL ) { +clk_disable (ehci_clocks->usbhost1_48m_fck_clk); +clk_put (ehci_clocks->usbhost1_48m_fck_clk); + ehci_clocks->usbhost1_48m_fck_clk =NULL ; + } + +if (ehci_clocks->usbhost2_120m_fck_clk !=NULL ) { +clk_disable (ehci_clocks->usbhost2_120m_fck_clk); +clk_put (ehci_clocks->usbhost2_120m_fck_clk); + ehci_clocks->usbhost2_120m_fck_clk =NULL ; + } + +if (ehci_clocks->usbtll_ick_clk !=NULL ) { +clk_disable (ehci_clocks->usbtll_ick_clk); +clk_put (ehci_clocks->usbtll_ick_clk); + ehci_clocks->usbtll_ick_clk =NULL ; + } + + +#ifdef EXTERNAL_PHY_RESET +omap_free_gpio (EXT_PHY_RESET_GPIO_PORT1 ); +omap_free_gpio (EXT_PHY_RESET_GPIO_PORT2 ); +#endif + +dev_dbg (hcd->self.controller, +": Clock to USB host has been disabled\n" ); +} + +static const struct hc_driver ehci_omap_hc_driver; + +/*-------------------------------------------------------------------------*/ +/* configure so an HC device and id are always provided */ +/* always called with process context; sleeping is OK */ + +/** +* ehci_hcd_omap_drv_probe - initialize TI-based HCDs +* Context: !in_interrupt() +* +* Allocates basic resources for this USB host controller, and +* then invokes the start() method for the HCD associated with it +* through the hotplug entry's driver_data. +* +*/ +static int ehci_hcd_omap_drv_probe (struct platform_device *dev) +{ +int retval =0 ; +struct usb_hcd *hcd; +struct ehci_hcd *ehci; + +dev_dbg (&dev->dev,"ehci_hcd_omap_drv_probe()" ); + +if (usb_disabled ()) +return -ENODEV ; + +if (dev->resource[1 ].flags !=IORESOURCE_IRQ ) { +dev_dbg (&dev->dev,"resource[1] is not IORESOURCE_IRQ" ); + retval = -ENOMEM ; + } + + hcd =usb_create_hcd (&ehci_omap_hc_driver, &dev->dev, dev->dev.bus_id); +if (!hcd) +return -ENOMEM ; + + retval =omap_start_ehc (dev, hcd); +if (retval) +return retval; + + hcd->rsrc_start =0 ; + hcd->rsrc_len =0 ; + hcd->rsrc_start = dev->resource[0 ].start; + hcd->rsrc_len = dev->resource[0 ].end - dev->resource[0 ].start +1 ; + + hcd->regs = (void __iomem *) (int )IO_ADDRESS (hcd->rsrc_start); + + ehci =hcd_to_ehci (hcd); + ehci->caps = hcd->regs; + + ehci->regs = hcd->regs +HC_LENGTH (readl (&ehci->caps->hc_capbase)); +/* cache this readonly data; minimize chip reads */ + ehci->hcs_params =readl (&ehci->caps->hcs_params); + +/* SET 1 micro-frame Interrupt interval */ +writel (readl (&ehci->regs->command) | (1 <<16 ), &ehci->regs->command); + + retval =usb_add_hcd (hcd, dev->resource[1 ].start, +IRQF_DISABLED |IRQF_SHARED ); +if (retval ==0 ) +return retval; + +dev_dbg (hcd->self.controller,"ERR: add_hcd" ); +omap_stop_ehc (dev, hcd); + +usb_put_hcd (hcd); +return retval; +} + +/*-------------------------------------------------------------------------*/ + +/* may be called without controller electrically present */ +/* may be called with controller, bus, and devices active */ + +/** +* ehci_hcd_omap_drv_remove - shutdown processing for EHCI HCDs +* @dev: USB Host Controller being removed +* Context: !in_interrupt() +* +* Reverses the effect of usb_ehci_hcd_omap_probe(), first invoking +* the HCD's stop() method. It is always called from a thread +* context, normally "rmmod", "apmd", or something similar. +* +*/ +static int ehci_hcd_omap_drv_remove (struct platform_device *dev) +{ +struct usb_hcd *hcd =platform_get_drvdata (dev); + +dev_dbg (&dev->dev,"ehci_hcd_omap_drv_remove()" ); + +usb_remove_hcd (hcd); +usb_put_hcd (hcd); +omap_stop_ehc (dev, hcd); + +return 0 ; +} + +/*-------------------------------------------------------------------------*/ +#ifdef CONFIG_PM +static int omap_ehci_bus_suspend (struct usb_hcd *hcd) +{ +return ehci_bus_suspend (hcd); +} + +static int omap_ehci_bus_resume (struct usb_hcd *hcd) +{ +return ehci_bus_resume (hcd); +} +#endif +/*-------------------------------------------------------------------------*/ + +static const struct hc_driver ehci_omap_hc_driver = { + .description = hcd_name, + .product_desc ="OMAP-EHCI Host Controller" , + .hcd_priv_size =sizeof (struct ehci_hcd ) + +sizeof (struct ehci_omap_clock_defs ), + +/* +* generic hardware linkage +*/ + .irq = ehci_irq, + .flags =HCD_MEMORY |HCD_USB2 , + +/* +* basic lifecycle operations +*/ + .reset = ehci_init, + .start = ehci_run, + .stop = ehci_stop, + .shutdown = ehci_shutdown, + +/* +* managing i/o requests and associated device resources +*/ + .urb_enqueue = ehci_urb_enqueue, + .urb_dequeue = ehci_urb_dequeue, + .endpoint_disable = ehci_endpoint_disable, + +/* +* scheduling support +*/ + .get_frame_number = ehci_get_frame, + +/* +* root hub support +*/ + .hub_status_data = ehci_hub_status_data, + .hub_control = ehci_hub_control, +#ifdef CONFIG_PM + .bus_suspend = omap_ehci_bus_suspend, + .bus_resume = omap_ehci_bus_resume, +#endif +}; + +/*-------------------------------------------------------------------------*/ +MODULE_ALIAS ("omap-ehci" ); +static struct platform_driver ehci_hcd_omap_driver = { + .probe = ehci_hcd_omap_drv_probe, + .remove = ehci_hcd_omap_drv_remove, + .shutdown = usb_hcd_platform_shutdown, +/*.suspend = ehci_hcd_omap_drv_suspend, */ +/*.resume = ehci_hcd_omap_drv_resume, */ + .driver = { + .name ="ehci-omap" , + .bus = &platform_bus_type + } +};drivers/usb/host/ehci-omap.h new file +114
-0@@ -0,0 +1,125 @@ +/* +* ehci-omap.h - register definitions for USBHOST in OMAP 34xx +* +* Copyright (C) 2007-2008 Texas Instruments, Inc. +* Author: Vikram Pandita <[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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +* +*/ + +#ifndef __EHCI_OMAP_H +#define __EHCI_OMAP_H + +#include <mach/hardware.h> +#include "../../../arch/arm/mach-omap2/cm.h" +#include "../../../arch/arm/mach-omap2/cm-regbits-34xx.h" + +/* +* OMAP USBHOST Register addresses: PHYSICAL ADDRESSES +* Use omap_readl()/omap_writel() functions +*/ + +/* USBHOST: TLL, UUH, OHCI, EHCI */ +#define OMAP_USBHOST_BASE (L4_34XX_BASE + 0x60000) + +/* TLL Register Set */ +#define OMAP_USBHOST_TLL_BASE (OMAP_USBHOST_BASE + 0x2000) +#define OMAP_USBTLL_REVISION (OMAP_USBHOST_TLL_BASE + 0x00) +#define OMAP_USBTLL_SYSCONFIG (OMAP_USBHOST_TLL_BASE + 0x10) +#define OMAP_USBTLL_SYSCONFIG_CACTIVITY_SHIFT 8 +#define OMAP_USBTLL_SYSCONFIG_SIDLEMODE_SHIFT 3 +#define OMAP_USBTLL_SYSCONFIG_ENAWAKEUP_SHIFT 2 +#define OMAP_USBTLL_SYSCONFIG_SOFTRESET_SHIFT 1 +#define OMAP_USBTLL_SYSCONFIG_AUTOIDLE_SHIFT 0 +#define OMAP_USBTLL_SYSSTATUS (OMAP_USBHOST_TLL_BASE + 0x14) +#define OMAP_USBTLL_SYSSTATUS_RESETDONE_SHIFT 0 +#define OMAP_USBTLL_IRQSTATUS (OMAP_USBHOST_TLL_BASE + 0x18) +#define OMAP_USBTLL_IRQENABLE (OMAP_USBHOST_TLL_BASE + 0x1C) + +#define OMAP_TLL_SHARED_CONF (OMAP_USBHOST_TLL_BASE + 0x30) +#define OMAP_TLL_SHARED_CONF_USB_90D_DDR_EN_SHFT 6 +#define OMAP_TLL_SHARED_CONF_USB_180D_SDR_EN_SHIFT 5 +#define OMAP_TLL_SHARED_CONF_USB_DIVRATION_SHIFT 2 +#define OMAP_TLL_SHARED_CONF_FCLK_REQ_SHIFT 1 +#define OMAP_TLL_SHARED_CONF_FCLK_IS_ON_SHIFT 0 + +#define OMAP_TLL_CHANNEL_CONF (num)\ + (OMAP_USBHOST_TLL_BASE + (0x040 + 0x004 * num)) +#define OMAP_TLL_CHANNEL_CONF_ULPINOBITSTUFF_SHIFT 11 +#define OMAP_TLL_CHANNEL_CONF_ULPI_ULPIAUTOIDLE_SHIFT 10 +#define OMAP_TLL_CHANNEL_CONF_UTMIAUTOIDLE_SHIFT 9 +#define OMAP_TLL_CHANNEL_CONF_ULPIDDRMODE_SHIFT 8 +#define OMAP_TLL_CHANNEL_CONF_CHANEN_SHIFT 0 + +#define OMAP_TLL_ULPI_FUNCTION_CTRL (num)\ + (OMAP_USBHOST_TLL_BASE + (0x804 + 0x100 * num)) +#define OMAP_TLL_ULPI_INTERFACE_CTRL (num)\ + (OMAP_USBHOST_TLL_BASE + (0x807 + 0x100 * num)) +#define OMAP_TLL_ULPI_OTG_CTRL (num)\ + (OMAP_USBHOST_TLL_BASE + (0x80A + 0x100 * num)) +#define OMAP_TLL_ULPI_INT_EN_RISE (num)\ + (OMAP_USBHOST_TLL_BASE + (0x80D + 0x100 * num)) +#define OMAP_TLL_ULPI_INT_EN_FALL (num)\ + (OMAP_USBHOST_TLL_BASE + (0x810 + 0x100 * num)) +#define OMAP_TLL_ULPI_INT_STATUS (num)\ + (OMAP_USBHOST_TLL_BASE + (0x813 + 0x100 * num)) +#define OMAP_TLL_ULPI_INT_LATCH (num)\ + (OMAP_USBHOST_TLL_BASE + (0x814 + 0x100 * num)) +#define OMAP_TLL_ULPI_DEBUG (num)\ + (OMAP_USBHOST_TLL_BASE + (0x815 + 0x100 * num)) +#define OMAP_TLL_ULPI_SCRATCH_REGISTER (num)\ + (OMAP_USBHOST_TLL_BASE + (0x816 + 0x100 * num)) + +#define OMAP_TLL_CHANNEL_COUNT 3 +#define OMAP_TLL_CHANNEL_1_EN_MASK 1 +#define OMAP_TLL_CHANNEL_2_EN_MASK 2 +#define OMAP_TLL_CHANNEL_3_EN_MASK 4 + +/* UHH Register Set */ +#define OMAP_USBHOST_UHH_BASE (OMAP_USBHOST_BASE + 0x4000) +#define OMAP_UHH_REVISION (OMAP_USBHOST_UHH_BASE + 0x00) +#define OMAP_UHH_SYSCONFIG (OMAP_USBHOST_UHH_BASE + 0x10) +#define OMAP_UHH_SYSCONFIG_MIDLEMODE_SHIFT 12 +#define OMAP_UHH_SYSCONFIG_CACTIVITY_SHIFT 8 +#define OMAP_UHH_SYSCONFIG_SIDLEMODE_SHIFT 3 +#define OMAP_UHH_SYSCONFIG_ENAWAKEUP_SHIFT 2 +#define OMAP_UHH_SYSCONFIG_SOFTRESET_SHIFT 1 +#define OMAP_UHH_SYSCONFIG_AUTOIDLE_SHIFT 0 + +#define OMAP_UHH_SYSSTATUS (OMAP_USBHOST_UHH_BASE + 0x14) +#define OMAP_UHH_HOSTCONFIG (OMAP_USBHOST_UHH_BASE + 0x40) +#define OMAP_UHH_HOSTCONFIG_ULPI_BYPASS_SHIFT 0 +#define OMAP_UHH_HOSTCONFIG_INCR4_BURST_EN_SHIFT 2 +#define OMAP_UHH_HOSTCONFIG_INCR8_BURST_EN_SHIFT 3 +#define OMAP_UHH_HOSTCONFIG_INCR16_BURST_EN_SHIFT 4 +#define OMAP_UHH_HOSTCONFIG_INCRX_ALIGN_EN_SHIFT 5 + +#define OMAP_UHH_DEBUG_CSR (OMAP_USBHOST_UHH_BASE + 0x44) + +/* EHCI Register Set */ +#define OMAP_USBHOST_EHCI_BASE (OMAP_USBHOST_BASE + 0x4800) +#define EHCI_INSNREG05_ULPI (
OMAP_USBHOST_EHCI_BASE+0xA4)drivers/usb/host/ehci-omap.h new file +11
-1+#define EHCI_INSNREG05_ULPI_CONTROL_SHIFT 31 +#define EHCI_INSNREG05_ULPI_PORTSEL_SHIFT 24 +#define EHCI_INSNREG05_ULPI_OPSEL_SHIFT 22 +#define EHCI_INSNREG05_ULPI_REGADD_SHIFT 16 +#define EHCI_INSNREG05_ULPI_EXTREGADD_SHIFT 8 +#define EHCI_INSNREG05_ULPI_WRDATA_SHIFT 0 + +/* OHCI Register Set */ +#define OMAP_USBHOST_OHCI_BASE (OMAP_USBHOST_BASE + 0x4400) + +#endif /* __EHCI_OMAP_H*/ --1.6.0.1.141.g445ca
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 29/33] add omap ehci bus glue
Quoted 8 lines · Anand
Quoted 8 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Felipe Balbi
Sent: Saturday, August 30, 2008 10:46 PM
To: [email protected]
Cc: Felipe Balbi
Subject: [PATCH 29/33] add omap ehci bus glue
Quoted 7 lines
Quoted 3 lines
From: Felipe Balbi <[email protected]>
Signed-off-by Felipe Balbi <[email protected]>Hold off on this one. I'll send a better version to linux-usb with a CC to linux-omap.
Great. It's dropped. Care to update the MAINTAINERS file as well :-)
Signature · 1 line
balbi
RE: [PATCH 29/33] add omap ehci bus glue
Quoted 5 lines
Quoted 2 lines
Hold off on this one. I'll send a better version to linux-usb with a CC to linux-omap.
Great. It's dropped. Care to update the
MAINTAINERSfile as well :-)
Will do. I need to fold in one more patch sent by Vikram and clean up stuff a little. Then I'll send it across.
- Anand
Re: [PATCH 28/33] add tsc2301 driver
In reply to Felipe BalbiQuoted 12 lines · On Sat, 30 Aug 2008 20:16:28 +0300 "ext Felipe Balbi" <[email protected]>…
From: Felipe Balbi <[email protected]>
Signed-off-by Felipe Balbi <[email protected]>--- drivers/spi/Kconfig | 22 + drivers/spi/Makefile | 3 + drivers/spi/tsc2301-core.c | 301 +++++++++++++ drivers/spi/tsc2301-mixer.c | 1004 ++++++++++++++++++++++++++++++++++ +++++++++ 4 files changed, 1330 insertions(+), 0 deletions(-) create mode 100644 drivers/spi/tsc2301-core.c create mode 100644 drivers/spi/tsc2301-mixer.c
Mixer driver here is also obsolete and used by N800 only. I think TSC2003 driver is easier to handle by trying to push only core, keyboard and ts part first. There is no place for mixer driver until it's ported to ASoC codec driver.
Jarkko
Re: [PATCH 28/33] add tsc2301 driver
Quoted 15 lines · Jarkko Nikula
Quoted 12 lines · On Sat, 30 Aug 2008 20:16:28 +0300 "ext Felipe Balbi" <[email protected]>…
From: Felipe Balbi <[email protected]>
Signed-off-by Felipe Balbi <[email protected]>--- drivers/spi/Kconfig | 22 + drivers/spi/Makefile | 3 + drivers/spi/tsc2301-core.c | 301 +++++++++++++ drivers/spi/tsc2301-mixer.c | 1004 ++++++++++++++++++++++++++++++++++ +++++++++ 4 files changed, 1330 insertions(+), 0 deletions(-) create mode 100644 drivers/spi/tsc2301-core.c create mode 100644 drivers/spi/tsc2301-mixer.c
Quoted 4 lines
Mixer driver here is also obsolete and used by N800 only. I think TSC2003 driver is easier to handle by trying to push only core, keyboard and ts part first. There is no place for mixer driver until it's ported to ASoC codec driver.
Cool, I'll drop this one as well. Will you take care of moving it to ASoC ?
Signature · 1 line
balbi
Re: [PATCH 28/33] add tsc2301 driver
Quoted 8 lines · On Mon, 1 Sep 2008 10:58:08 +0300 "ext Felipe Balbi" <[email protected]> wrote:
Quoted 4 lines
Mixer driver here is also obsolete and used by N800 only. I think TSC2003 driver is easier to handle by trying to push only core, keyboard and ts part first. There is no place for mixer driver until it's ported to ASoC codec driver.
Cool, I'll drop this one as well. Will you take care of moving it to ASoC ?
Unfortunately I have very low priority for it :-(
Jarkko
Re: [PATCH 28/33] add tsc2301 driver
Quoted 8 lines · Jarkko Nikula
Quoted 5 lines · On Mon, 1 Sep 2008 10:58:08 +0300 "ext Felipe Balbi" <[email protected]> wrote:
Quoted 4 lines
Mixer driver here is also obsolete and used by N800 only. I think TSC2003 driver is easier to handle by trying to push only core, keyboard and ts part first. There is no place for mixer driver until it's ported to ASoC codec driver.
Quoted 4 lines
Quoted 3 lines
Cool, I'll drop this one as well. Will you take care of moving it to ASoC ?
Unfortunately I have very low priority for it :-(
damn it... someone else interested could take a look at it. Let's hope someone really does ;-)
It'd be great to get rid of all these drivers from linux-omap and get in sync with mainline, then upcoming drivers could be discussed on proper mailing lists :-)
Signature · 1 line
balbi
Re: [PATCH 22/33] add omap nand drivers
In reply to Felipe BalbiHmm, this seems like three distinct drivers to me. Which should mean three separate patches ... going go the MTD list!
Quoted 6 lines · Felipe Balbi
+config
MTD_NAND_OMAP2
+ tristate "NAND Flash device on OMAP2 and OMAP3"
+ depends on ARM &&MTD_NAND&& (ARCH_OMAP2||ARCH_OMAP3)
+ help
+ Support for NAND flash on Texas Instruments OMAP2 and OMAP3 platforms.
I've got a small patch for this one which I'll post.
drivers/mtd/nand/Kconfig config MTD_NAND_AMS_DELTA · line 88
Quoted 12 lines
drivers/mtd/nand/Kconfig +12
-0+config MTD_NAND_OMAP + tristate "NAND Flash device on OMAP H3/H2/P2 boards" + depends on ARM && ARCH_OMAP1 && MTD_NAND && (MACH_OMAP_H2 || MACH_OMAP_H3 || MACH_OMAP_PERSEUS2) + help + Support for NAND flash on Texas Instruments H3/H2/P2 platforms. + +config MTD_NAND_OMAP_HW + bool "OMAP HW NAND Flash controller support" + depends on ARM && ARCH_OMAP16XX && MTD_NAND + + help + Driver for TI OMAP16xx hardware NAND flash controller.
This one raises the question: why are there *TWO* drivers for the same hardware? Which one is the failed experiment?
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 22/33] add omap nand drivers
Quoted 7 lines · David Brownell
Hmm, this seems like three distinct drivers to me. Which should mean three separate patches ... going go the MTD list!
Quoted 1 line · Felipe Balbi
Quoted 7 lines
Quoted 5 lines
+config
MTD_NAND_OMAP2
+ tristate "NAND Flash device on OMAP2 and OMAP3"
+ depends on ARM &&MTD_NAND&& (ARCH_OMAP2||ARCH_OMAP3)
+ help
+ Support for NAND flash on Texas Instruments OMAP2 and OMAP3 platforms.I've got a small patch for this one which I'll post.
Great, I can meld it on the final version of the driver. Thanks
Quoted 7 lines
Quoted 7 lines
drivers/mtd/nand/Kconfig +7
-0+config MTD_NAND_OMAP + tristate "NAND Flash device on OMAP H3/H2/P2 boards" + depends on ARM && ARCH_OMAP1 && MTD_NAND && (MACH_OMAP_H2 || MACH_OMAP_H3 || MACH_OMAP_PERSEUS2) + help + Support for NAND flash on Texas Instruments H3/H2/P2 platforms. + +config MTD_NAND_OMAP_HW
Quoted 8 lines
Quoted 5 lines
+ bool "OMAP HW NAND Flash controller support"
+ depends on ARM &&ARCH_OMAP16XX&&MTD_NAND
+
+ help
+ Driver for TI OMAP16xx hardware NAND flash controller.This one raises the question: why are there *TWO* drivers for the same hardware? Which one is the failed experiment?
It's even worse. If you look at the Makefile itself, there are three:
obj-$(CONFIG_MTD_NAND_OMAP) += omap-nand-flash.o
obj-$(CONFIG_MTD_NAND_OMAP2) += omap2.o
obj-$(CONFIG_MTD_NAND_OMAP_HW) += omap-hw.o
Looks like this series was good for finding some weird stuff on linux-omap ;-)
Signature · 5 lines
balbi -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Tony Lindgren
maintainerRe: [PATCH 22/33] add omap nand drivers
Quoted 34 lines · Felipe Balbi
Quoted 7 lines · David Brownell
Hmm, this seems like three distinct drivers to me. Which should mean three separate patches ... going go the MTD list!
Quoted 1 line · Felipe Balbi
Quoted 7 lines
Quoted 5 lines
+config
MTD_NAND_OMAP2
+ tristate "NAND Flash device on OMAP2 and OMAP3"
+ depends on ARM &&MTD_NAND&& (ARCH_OMAP2||ARCH_OMAP3)
+ help
+ Support for NAND flash on Texas Instruments OMAP2 and OMAP3 platforms.I've got a small patch for this one which I'll post.
Great, I can meld it on the final version of the driver. Thanks
Quoted 7 lines
Quoted 7 lines
drivers/mtd/nand/Kconfig +7
-0+config MTD_NAND_OMAP + tristate "NAND Flash device on OMAP H3/H2/P2 boards" + depends on ARM && ARCH_OMAP1 && MTD_NAND && (MACH_OMAP_H2 || MACH_OMAP_H3 || MACH_OMAP_PERSEUS2) + help + Support for NAND flash on Texas Instruments H3/H2/P2 platforms. + +config MTD_NAND_OMAP_HWQuoted 8 lines
Quoted 5 lines
+ bool "OMAP HW NAND Flash controller support"
+ depends on ARM &&ARCH_OMAP16XX&&MTD_NAND
+
+ help
+ Driver for TI OMAP16xx hardware NAND flash controller.This one raises the question: why are there *TWO* drivers for the same hardware? Which one is the failed experiment?
Quoted 8 lines
It's even worse. If you look at the
Makefileitself, there are three:obj-$(CONFIG_MTD_NAND_OMAP) += omap-nand-flash.o
obj-$(CONFIG_MTD_NAND_OMAP2) += omap2.o
obj-$(CONFIG_MTD_NAND_OMAP_HW) += omap-hw.oLooks like this series was good for finding some weird stuff on linux-omap ;-)
Then there's also the MTD_NAND_TOTO.. Sure there were various NAND controllers, but if some of them are no longer maintained, we should just export them into patches and remove from kernel.
Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 21/33] add OMAP HighSpeed mmc controller driver
In reply to Felipe BalbiQuoted 9 lines · Felipe Balbi
From: Felipe Balbi <[email protected]>
Signed-off-by Felipe Balbi <[email protected]>---
drivers/mmc/host/Kconfig | 13 +-
drivers/mmc/host/Makefile | 1 +drivers/mmc/host/omap_hsmmc.c| 1069 +++++++++++++++++++++++++++++++++++++++++3 files changed, 1082 insertions(+), 1 deletions(-)create mode 100644
drivers/mmc/host/omap_hsmmc.c
OK, this one may need cleanup ... but I don't disagree that it should go upstream.
Now the process for getting it there involves posting to LKML and probably CCing the MMC maintainer...
One reason I'd like to see this particular driver upstream is so that folk using www.beagleboard.org hardware can stand a real chance of using mainline kernels for development. That's a small set of drivers, so that's a very achievable goal.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 21/33] add OMAP HighSpeed mmc controller driver
Quoted 14 lines · David Brownell
Quoted 9 lines · Felipe Balbi
From: Felipe Balbi <[email protected]>
Signed-off-by Felipe Balbi <[email protected]>---
drivers/mmc/host/Kconfig | 13 +-
drivers/mmc/host/Makefile | 1 +drivers/mmc/host/omap_hsmmc.c| 1069 +++++++++++++++++++++++++++++++++++++++++3 files changed, 1082 insertions(+), 1 deletions(-)create mode 100644
drivers/mmc/host/omap_hsmmc.cOK, this one may need cleanup ... but I don't disagree that it should go upstream.
Quoted 7 lines
Now the process for getting it there involves posting to LKML and probably CCing the MMC maintainer...
One reason I'd like to see this particular driver upstream is so that folk using www.beagleboard.org hardware can stand a real chance of using mainline kernels for development. That's a small set of drivers, so that's a very achievable goal.
Agreed. But we're missing omap3 stuff on mainline still, so even if we have all the drivers there. Mainline has support up to omap2430, if i'm not wrong. So looks like beagleboard users will have to wait a bit longer.
Signature · 5 lines
balbi -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 21/33] add OMAP HighSpeed mmc controller driver
Quoted 7 lines · Felipe Balbi
Quoted 5 lines
One reason I'd like to see this particular driver upstream is so that folk using www.beagleboard.org hardware can stand a real chance of using mainline kernels for development. That's a small set of drivers, so that's a very achievable goal.
Agreed. But we're missing omap3 stuff on mainline still,
Fixable, I'd expect. :)
Quoted 4 lines
so even if we
have all the drivers there. Mainline has support up to omap2430, if i'm not wrong. So looks like beagleboard users will have to wait a bit longer.
Well, it's not a 2.6.27 goal. But I'd think it should be very possible for 2.6.28 merging.
However, I'll re-emphasize that doing that means submitting the patches for real, not to the OMAP list. And since mainline is now at RC5, there's not a lot of time yet to get this new code reviewed and entered into the MMC queue...
- Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 21/33] add OMAP HighSpeed mmc controller driver
Quoted 1 line · David Brownell
Fixable, I'd expect. :)
I'm sure it is :-)
Quoted 7 lines
Quoted 4 lines
so even if we
have all the drivers there. Mainline has support up to omap2430, if i'm not wrong. So looks like beagleboard users will have to wait a bit longer.Well, it's not a 2.6.27 goal. But I'd think it should be very possible for 2.6.28 merging.
Should be possible, but Tony can say for sure.
Quoted 4 lines
However, I'll re-emphasize that doing that means submitting the patches for real, not to the OMAP list. And since mainline is now at RC5, there's not a lot of time yet to get this new code reviewed and entered into the MMC queue...
I think it's not a must to merge it for 2.6.27 time, but 2.6.28 would be good enough. As long as we merge them upstream and avoid merge conflicts on l-o, I'd be happy. Besides the fact that drivers should be discussed on the proper mainling list for facts that you already said in another comment, right ? :-)
Signature · 1 line
balbi
Tony Lindgren
maintainerRe: [PATCH 21/33] add OMAP HighSpeed mmc controller driver
Quoted 10 lines · Felipe Balbi
Quoted 1 line · David Brownell
Fixable, I'd expect. :)
I'm sure it is :-)
Quoted 5 lines
Quoted 4 lines
so even if we
have all the drivers there. Mainline has support up to omap2430, if i'm not wrong. So looks like beagleboard users will have to wait a bit longer.
Quoted 4 lines
Quoted 2 lines
Well, it's not a 2.6.27 goal. But I'd think it should be very possible for 2.6.28 merging.
Should be possible, but Tony can say for sure.
Sorry I'm still behind with my emails.. I think we have a fair chance of getting minimal omap3 board configurations booting with mainline kernel. Most core stuff is starting to be somewhat in sync for mach-omap2, and then we just need the board-*.c files. PM stuff is still under construction of course.
Quoted 10 lines
Quoted 4 lines
However, I'll re-emphasize that doing that means submitting the patches for real, not to the OMAP list. And since mainline is now at RC5, there's not a lot of time yet to get this new code reviewed and entered into the MMC queue...
I think it's not a must to merge it for 2.6.27 time, but 2.6.28 would be good enough. As long as we merge them upstream and avoid merge conflicts on l-o, I'd be happy. Besides the fact that drivers should be discussed on the proper mainling list for facts that you already said in another comment, right ? :-)
Yes, drivers should be discussed on the appropriate mailing lists.
Tony
Re: [PATCH 21/33] add OMAP HighSpeed mmc controller driver
In reply to David BrownellHi Dave,
Quoted 2 lines
OK, this one may need cleanup ... but I don't disagree that it should go upstream.
I had fixed several comments provided by Pierre and Russell before Tony merged this patch. But then we have further added several fixes on top of the driver. Do you have any specific comments when you mean cleanup?
Regards,
Madhu
----- Original Message -----
From: "David Brownell" <[email protected]>
To: "Felipe Balbi" <[email protected]>
Cc: <[email protected]>; "Felipe Balbi" <[email protected]>
Sent: Monday, September 01, 2008 2:36 AM
Subject: Re: [PATCH 21/33] add OMAP HighSpeed mmc controller driver
Quoted 9 lines · Felipe Balbi
From: Felipe Balbi <[email protected]>
Signed-off-by Felipe Balbi <[email protected]>---
drivers/mmc/host/Kconfig| 13 +-drivers/mmc/host/Makefile| 1 +drivers/mmc/host/omap_hsmmc.c| 1069 +++++++++++++++++++++++++++++++++++++++++3 files changed, 1082 insertions(+), 1 deletions(-)create mode 100644
drivers/mmc/host/omap_hsmmc.c
OK, this one may need cleanup ... but I don't disagree that it should go upstream.
Now the process for getting it there involves posting to LKML and probably CCing the MMC maintainer...
One reason I'd like to see this particular driver upstream is so that folk using www.beagleboard.org hardware can stand a real chance of using mainline kernels for development. That's a small set of drivers, so that's a very achievable goal.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 21/33] add OMAP HighSpeed mmc controller driver
Quoted 7 lines · Madhusudhan Chikkature
Quoted 2 lines
OK, this one may need cleanup ... but I don't disagree that it should go upstream.
I had fixed several comments provided by Pierre and Russell before Tony merged this patch. But then we have further added several fixes on top of the driver. Do you have any specific comments when you mean cleanup
My main concerns relate to board-specific setup, which might not end up impacting the driver code as much as the code in arch/arm/mach-omap2/hsmmc.c (and its callers).
Basically, if you look at the hsmmc.c file it's got a LOT of board-specific stuff hard-wired. The way it *should* work is the board-XYZ.c file passes that into setup code ... and that info can include things like "are all 8 data lines available?", as well as card detect triggering and writeprotect switch access.
There might be other issues ... but it was rather easy to notice those problems when for example the HSMMC on a Beagle comes up with truncated functionality.
- Dave
Re: [PATCH 21/33] add OMAP HighSpeed mmc controller driver
In reply to Felipe BalbiQuoted 5 lines · Felipe Balbi
drivers/mmc/host/omap_hsmmc.c new file +5
-0+#include <linux/module.h> +#include <linux/init.h> +#include <linux/interrupt.h> +#include <linux/delay.h> +#include <linux/dma-mapping.h>
drivers/mmc/host/omap_hsmmc.c line 32
Quoted 10 lines
drivers/mmc/host/omap_hsmmc.c new file +10
-0+#include <linux/platform_device.h> +#include <linux/workqueue.h> +#include <linux/timer.h> +#include <linux/clk.h> +#include <linux/mmc/host.h> +#include <linux/io.h> +#include <linux/semaphore.h> +#include <asm/dma.h> +#include <mach/hardware.h> +#include <mach/board.h>
Is there really anything in here which is board specific? If yes, shouldn't that be passed through platform data?
Re: [PATCH 17/33] add tea5761 radio driver
In reply to Felipe BalbiQuoted 10 lines · On Sat, 30 Aug 2008 20:16:17 +0300 "ext Felipe Balbi" <[email protected]>…
From: Felipe Balbi <[email protected]>
Signed-off-by Felipe Balbi <[email protected]>--- drivers/media/radio/Kconfig | 13 + drivers/media/radio/Makefile | 1 + drivers/media/radio/radio-tea5761.c | 517 ++++++++++++++++++++++++++ +++++++++ 3 files changed, 531 insertions(+), 0 deletions(-) create mode 100644 drivers/media/radio/radio-tea5761.c
I have the impression that Eduardo Valentin had work in progress to push this via v4l list. However, don't know the current status.
Jarkko
Re: [PATCH 17/33] add tea5761 radio driver
Quoted 13 lines · Jarkko Nikula
Quoted 10 lines · On Sat, 30 Aug 2008 20:16:17 +0300 "ext Felipe Balbi" <[email protected]>…
From: Felipe Balbi <[email protected]>
Signed-off-by Felipe Balbi <[email protected]>--- drivers/media/radio/Kconfig | 13 + drivers/media/radio/Makefile | 1 + drivers/media/radio/radio-tea5761.c | 517 ++++++++++++++++++++++++++ +++++++++ 3 files changed, 531 insertions(+), 0 deletions(-) create mode 100644 drivers/media/radio/radio-tea5761.c
Quoted 2 lines
I have the impression that Eduardo Valentin had work in progress to push this via v4l list. However, don't know the current status.
Better asking. Eduardo, were you planning to push this one upstream ?
Signature · 1 line
balbi
Re: [PATCH 17/33] add tea5761 radio driver
Hi guys,
Sorry for the late answer.
Quoted 14 lines · ext Felipe Balbi
Quoted 13 lines · Jarkko Nikula
Quoted 10 lines · On Sat, 30 Aug 2008 20:16:17 +0300 "ext Felipe Balbi" <[email protected]>…
From: Felipe Balbi <[email protected]>
Signed-off-by Felipe Balbi <[email protected]>--- drivers/media/radio/Kconfig | 13 + drivers/media/radio/Makefile | 1 + drivers/media/radio/radio-tea5761.c | 517 ++++++++++++++++++++++++++ +++++++++ 3 files changed, 531 insertions(+), 0 deletions(-) create mode 100644 drivers/media/radio/radio-tea5761.c
Quoted 2 lines
Quoted 2 lines
I have the impression that Eduardo Valentin had work in progress to push this via v4l list. However, don't know the current status.
Yes, that's true. I tried pushing this through v4l list. But it got blocked. It seams there is duplicated code here. v4l already has a radio interface for tea. However, it is based on radio tuner api.
The work here is to update our driver to use current code already in v4l2. Just a simple patch to remove duplicated code and adapt to use correct API.
Quoted 5 lines
Better asking. Eduardo, were you planning to push this one upstream ?
Signature · 1 line
balbi
Signature · 5 lines
BR, --- Eduardo Bezerra Valentin +55 92 21261118
Re: [PATCH 16/33] add omap led drivers
In reply to Felipe BalbiQuoted 7 lines · Felipe Balbi
+config
LEDS_OMAP_DEBUG
+ boolean "LED Support for OMAP debug board LEDs"
+ depends on LEDS_CLASS=y &&ARCH_OMAP
+ help
+ Enables support for the LEDs on the debug board used with OMAP + reference boards like H2/H3/H4 and Perseus2. Up to six of these + may be claimed by the original ARM debug LED API.
This stuff is ancient and should not be pushed upstream. Anything not using arch/arm/plat-omap/debug-leds.c should be converted immediately. Ditto anything using the legacy ARM led framework.
Quoted 5 lines
+config
LEDS_OMAP
+ tristate "LED Support for OMAP GPIO LEDs"
+ depends onLEDS_CLASS&&ARCH_OMAP
+ help
+ This option enables support for the LEDs on OMAP processors.
Similarly obsolete. Use drivers/leds/leds-gpio.c ... Best to just remove this driver and convert its clients.
Quoted 6 lines
+config
LEDS_OMAP_PWM
+ tristate "LED Support for OMAP PWM-controlled LEDs" + depends onLEDS_CLASS&&ARCH_OMAP&&OMAP_DM_TIMER+ help
+ This options enables support for LEDs connected to GPIO lines + controlled by a PWM timer on OMAP CPUs.
This is more plausible. But looking -- briefly! -- at the code, I don't see why it needs a work_struct at all, or why it's not using the blink_set() method to control the hardware blink rate.
- Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 16/33] add omap led drivers
Quoted 32 lines · David Brownell
Quoted 7 lines · Felipe Balbi
+config
LEDS_OMAP_DEBUG
+ boolean "LED Support for OMAP debug board LEDs"
+ depends on LEDS_CLASS=y &&ARCH_OMAP
+ help
+ Enables support for the LEDs on the debug board used with OMAP + reference boards like H2/H3/H4 and Perseus2. Up to six of these + may be claimed by the original ARM debug LED API.This stuff is ancient and should not be pushed upstream. Anything not using
arch/arm/plat-omap/debug-leds.cshould be converted immediately. Ditto anything using the legacy ARM led framework.Quoted 5 lines
+config
LEDS_OMAP
+ tristate "LED Support for OMAP GPIO LEDs"
+ depends onLEDS_CLASS&&ARCH_OMAP
+ help
+ This option enables support for the LEDs on OMAP processors.Similarly obsolete. Use
drivers/leds/leds-gpio.c... Best to just remove this driver and convert its clients.Quoted 6 lines
+config
LEDS_OMAP_PWM
+ tristate "LED Support for OMAP PWM-controlled LEDs" + depends onLEDS_CLASS&&ARCH_OMAP&&OMAP_DM_TIMER+ help
+ This options enables support for LEDs connected to GPIO lines + controlled by a PWM timer on OMAP CPUs.
Quoted 3 lines
This is more plausible. But looking -- briefly! -- at the code, I don't see why it needs a
work_structat all, or why it's not using theblink_set()method to control the hardware blink rate.
One more to drop from the series. Someone will have to take care of these drivers.
Signature · 5 lines
balbi -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 12/33] Add tsc2005 touchscreen driver
In reply to Felipe BalbiQuoted 10 lines · Felipe Balbi
drivers/input/touchscreen/Kconfig +0
-0@@ -217,6 +217,11 @@ config TOUCHSCREEN_ATMEL_TSADCCTo compile this driver as a module, choose M here: the module will be called
atmel_tsadcc.
+configTOUCHSCREEN_TSC2005
+ tristate "TSC2005 touchscreen support"
+ help
+ Say Y here for if you are using the touchscreen features of TSC2301
TSC 2301 or 2005?
And shouldn't there be a TSC 2301 or 2005 driver to depend on?
Quoted 4 lines
+
configTOUCHSCREEN_UCB1400
tristate "Philips UCB1400 touchscreen"
selectAC97_BUS
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 12/33] Add tsc2005 touchscreen driver
Quoted 14 lines · David Brownell
Quoted 10 lines · Felipe Balbi
drivers/input/touchscreen/Kconfig +0
-0@@ -217,6 +217,11 @@ config TOUCHSCREEN_ATMEL_TSADCCTo compile this driver as a module, choose M here: the module will be called
atmel_tsadcc.
+configTOUCHSCREEN_TSC2005
+ tristate "TSC2005 touchscreen support"
+ help
+ Say Y here for if you are using the touchscreen features of TSC2301TSC 2301 or 2005?
And shouldn't there be a TSC 2301 or 2005 driver to depend on?
My bad, didn't see the typo on linux-omap. I'll fix on both trees and send patch to l-o soonish.
Signature · 5 lines
balbi -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 12/33] Add tsc2005 touchscreen driver
In reply to Felipe Balbi2008/8/30 Felipe Balbi <[email protected]>:
Quoted 397 lines
From: Felipe Balbi <[email protected]>
Signed-off-by Felipe Balbi <[email protected]>--- drivers/input/touchscreen/Kconfig | 5 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/tsc2005.c | 736 +++++++++++++++++++++++++++++++++++ include/linux/spi/tsc2005.h | 29 ++ 4 files changed, 771 insertions(+), 0 deletions(-) create mode 100644 drivers/input/touchscreen/tsc2005.c create mode 100644 include/linux/spi/tsc2005.hdrivers/input/touchscreen/Kconfig +5
-0@@ -217,6 +217,11 @@ config TOUCHSCREEN_ATMEL_TSADCC To compile this driver as a module, choose M here: the module will be called atmel_tsadcc. +config TOUCHSCREEN_TSC2005 + tristate "TSC2005 touchscreen support" + help + Say Y here for if you are using the touchscreen features of TSC2301. + config TOUCHSCREEN_UCB1400 tristate "Philips UCB1400 touchscreen" select AC97_BUSdrivers/input/touchscreen/Makefile +1
-0@@ -26,6 +26,7 @@ obj-$(CONFIG_TOUCHSCREEN_TOUCHIT213) += touchit213.o obj-$(CONFIG_TOUCHSCREEN_TOUCHRIGHT) += touchright.o obj-$(CONFIG_TOUCHSCREEN_TOUCHWIN) += touchwin.o obj-$(CONFIG_TOUCHSCREEN_UCB1400) += ucb1400_ts.o +obj-$(CONFIG_TOUCHSCREEN_TSC2005) += tsc2005.o obj-$(CONFIG_TOUCHSCREEN_WM97XX) += wm97xx-ts.o wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9705) += wm9705.o wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9712) += wm9712.odrivers/input/touchscreen/tsc2005.c new file +351
-0@@ -0,0 +1,736 @@ +/* +* TSC2005 touchscreen driver +* +* Copyright (C) 2006-2008 Nokia Corporation +* +* Author: Lauri Leukkunen <[email protected]> +* based on TSC2301 driver by Klaus K. Pedersen <[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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +* +*/ + +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/input.h> +#include <linux/interrupt.h> +#include <linux/delay.h> +#include <linux/spi/spi.h> + +#ifdef CONFIG_ARCH_OMAP +#include <mach/gpio.h> +#endif + +#include <linux/spi/tsc2005.h> + +/** +* The touchscreen interface operates as follows: +* +* Initialize: +* Request access to GPIO103 (DAV) +* tsc2005_dav_irq_handler will trigger when DAV line goes down +* +* 1) Pen is pressed against touchscreeen +* 2) TSC2005 performs AD conversion +* 3) After the conversion is done TSC2005 drives DAV line down +* 4) GPIO IRQ is received and tsc2005_dav_irq_handler is called +* 5) tsc2005_ts_irq_handler queues up an spi transfer to fetch +* the x, y, z1, z2 values +* 6) tsc2005_ts_rx() reports coordinates to input layer and +* sets up tsc2005_ts_timer() to be called after TSC2005_TS_SCAN_TIME +* 7) When the penup_timer expires, there have not been DAV interrupts +* during the last 20ms which means the pen has been lifted. +*/ + +#define TSC2005_VDD_LOWER_27 + +#ifdef TSC2005_VDD_LOWER_27 +#define TSC2005_HZ (10000000) +#else +#define TSC2005_HZ (25000000) +#endif + +#define TSC2005_CMD (0x80) +#define TSC2005_REG (0x00) + +#define TSC2005_CMD_STOP (1) +#define TSC2005_CMD_10BIT (0 << 2) +#define TSC2005_CMD_12BIT (1 << 2) + +#define TSC2005_CMD_SCAN_XYZZ (0 << 3) +#define TSC2005_CMD_SCAN_XY (1 << 3) +#define TSC2005_CMD_SCAN_X (2 << 3) +#define TSC2005_CMD_SCAN_Y (3 << 3) +#define TSC2005_CMD_SCAN_ZZ (4 << 3) +#define TSC2005_CMD_AUX_SINGLE (5 << 3) +#define TSC2005_CMD_TEMP1 (6 << 3) +#define TSC2005_CMD_TEMP2 (7 << 3) +#define TSC2005_CMD_AUX_CONT (8 << 3) +#define TSC2005_CMD_TEST_X_CONN (9 << 3) +#define TSC2005_CMD_TEST_Y_CONN (10 << 3) +/* command 11 reserved */ +#define TSC2005_CMD_TEST_SHORT (12 << 3) +#define TSC2005_CMD_DRIVE_XX (13 << 3) +#define TSC2005_CMD_DRIVE_YY (14 << 3) +#define TSC2005_CMD_DRIVE_YX (15 << 3) + +#define TSC2005_REG_X (0 << 3) +#define TSC2005_REG_Y (1 << 3) +#define TSC2005_REG_Z1 (2 << 3) +#define TSC2005_REG_Z2 (3 << 3) +#define TSC2005_REG_AUX (4 << 3) +#define TSC2005_REG_TEMP1 (5 << 3) +#define TSC2005_REG_TEMP2 (6 << 3) +#define TSC2005_REG_STATUS (7 << 3) +#define TSC2005_REG_AUX_HIGH (8 << 3) +#define TSC2005_REG_AUX_LOW (9 << 3) +#define TSC2005_REG_TEMP_HIGH (10 << 3) +#define TSC2005_REG_TEMP_LOW (11 << 3) +#define TSC2005_REG_CFR0 (12 << 3) +#define TSC2005_REG_CFR1 (13 << 3) +#define TSC2005_REG_CFR2 (14 << 3) +#define TSC2005_REG_FUNCTION (15 << 3) + +#define TSC2005_REG_PND0 (1 << 1) +#define TSC2005_REG_READ (0x01) +#define TSC2005_REG_WRITE (0x00) + + +#define TSC2005_CFR0_LONGSAMPLING (1) +#define TSC2005_CFR0_DETECTINWAIT (1 << 1) +#define TSC2005_CFR0_SENSETIME_32US (0) +#define TSC2005_CFR0_SENSETIME_96US (1 << 2) +#define TSC2005_CFR0_SENSETIME_544US (1 << 3) +#define TSC2005_CFR0_SENSETIME_2080US (1 << 4) +#define TSC2005_CFR0_SENSETIME_2656US (0x001C) +#define TSC2005_CFR0_PRECHARGE_20US (0x0000) +#define TSC2005_CFR0_PRECHARGE_84US (0x0020) +#define TSC2005_CFR0_PRECHARGE_276US (0x0040) +#define TSC2005_CFR0_PRECHARGE_1044US (0x0080) +#define TSC2005_CFR0_PRECHARGE_1364US (0x00E0) +#define TSC2005_CFR0_STABTIME_0US (0x0000) +#define TSC2005_CFR0_STABTIME_100US (0x0100) +#define TSC2005_CFR0_STABTIME_500US (0x0200) +#define TSC2005_CFR0_STABTIME_1MS (0x0300) +#define TSC2005_CFR0_STABTIME_5MS (0x0400) +#define TSC2005_CFR0_STABTIME_100MS (0x0700) +#define TSC2005_CFR0_CLOCK_4MHZ (0x0000) +#define TSC2005_CFR0_CLOCK_2MHZ (0x0800) +#define TSC2005_CFR0_CLOCK_1MHZ (0x1000) +#define TSC2005_CFR0_RESOLUTION12 (0x2000) +#define TSC2005_CFR0_STATUS (0x4000) +#define TSC2005_CFR0_PENMODE (0x8000) + +#define TSC2005_CFR0_INITVALUE (TSC2005_CFR0_STABTIME_1MS | \ + TSC2005_CFR0_CLOCK_1MHZ | \ + TSC2005_CFR0_RESOLUTION12 | \ + TSC2005_CFR0_PRECHARGE_276US | \ + TSC2005_CFR0_PENMODE) + +#define TSC2005_CFR1_BATCHDELAY_0MS (0x0000) +#define TSC2005_CFR1_BATCHDELAY_1MS (0x0001) +#define TSC2005_CFR1_BATCHDELAY_2MS (0x0002) +#define TSC2005_CFR1_BATCHDELAY_4MS (0x0003) +#define TSC2005_CFR1_BATCHDELAY_10MS (0x0004) +#define TSC2005_CFR1_BATCHDELAY_20MS (0x0005) +#define TSC2005_CFR1_BATCHDELAY_40MS (0x0006) +#define TSC2005_CFR1_BATCHDELAY_100MS (0x0007) + +#define TSC2005_CFR1_INITVALUE (TSC2005_CFR1_BATCHDELAY_2MS) + +#define TSC2005_CFR2_MAVE_TEMP (0x0001) +#define TSC2005_CFR2_MAVE_AUX (0x0002) +#define TSC2005_CFR2_MAVE_Z (0x0004) +#define TSC2005_CFR2_MAVE_Y (0x0008) +#define TSC2005_CFR2_MAVE_X (0x0010) +#define TSC2005_CFR2_AVG_1 (0x0000) +#define TSC2005_CFR2_AVG_3 (0x0400) +#define TSC2005_CFR2_AVG_7 (0x0800) +#define TSC2005_CFR2_MEDIUM_1 (0x0000) +#define TSC2005_CFR2_MEDIUM_3 (0x1000) +#define TSC2005_CFR2_MEDIUM_7 (0x2000) +#define TSC2005_CFR2_MEDIUM_15 (0x3000) + +#define TSC2005_CFR2_IRQ_DAV (0x4000) +#define TSC2005_CFR2_IRQ_PEN (0x8000) +#define TSC2005_CFR2_IRQ_PENDAV (0x0000) + +#define TSC2005_CFR2_INITVALUE (TSC2005_CFR2_IRQ_DAV | \ + TSC2005_CFR2_MAVE_X | \ + TSC2005_CFR2_MAVE_Y | \ + TSC2005_CFR2_MAVE_Z | \ + TSC2005_CFR2_MEDIUM_15 | \ + TSC2005_CFR2_AVG_7) + +#define MAX_12BIT ((1 << 12) - 1) +#define TS_SAMPLES 4 +#define TS_RECT_SIZE 8 +#define TSC2005_TS_PENUP_TIME 20 + +static const u32 tsc2005_read_reg[] = { + (TSC2005_REG |TSC2005_REG_X |TSC2005_REG_READ ) <<16 , + (TSC2005_REG |TSC2005_REG_Y |TSC2005_REG_READ ) <<16 , + (TSC2005_REG |TSC2005_REG_Z1 |TSC2005_REG_READ ) <<16 , + (TSC2005_REG |TSC2005_REG_Z2 |TSC2005_REG_READ ) <<16 , +}; +#define NUM_READ_REGS (sizeof(tsc2005_read_reg)/sizeof(tsc2005_read_reg[0])) + +struct tsc2005 { +struct spi_device *spi; + +struct input_dev *idev; +char phys[32 ]; +struct timer_list penup_timer; +spinlock_t lock; +struct mutex mutex; + +struct spi_message read_msg; +struct spi_transfer read_xfer[NUM_READ_REGS ]; +u32 data[NUM_READ_REGS ]; + +/* previous x,y,z */ +int x; +int y; +int p; +/* average accumulators for each component */ +int sample_cnt; +int avg_x; +int avg_y; +int avg_z1; +int avg_z2; +/* configuration */ +int x_plate_ohm; +int hw_avg_max; +int stab_time; +int p_max; +int touch_pressure; +int irq; +s16 dav_gpio; +/* status */ +u8 sample_sent; +u8 pen_down; +u8 disabled; +u8 disable_depth; +u8 spi_active; +}; + +static void tsc2005_cmd (struct tsc2005 *ts,u8 cmd) +{ +u16 data =TSC2005_CMD |TSC2005_CMD_12BIT | cmd; +struct spi_message msg; +struct spi_transfer xfer = {0 }; + + xfer.tx_buf = &data; + xfer.rx_buf =NULL ; + xfer.len =1 ; + xfer.bits_per_word =8 ; + +spi_message_init (&msg); +spi_message_add_tail (&xfer, &msg); +spi_sync (ts->spi, &msg); +} + +static void tsc2005_write (struct tsc2005 *ts,u8 reg,u16 value) +{ +u32 tx; +struct spi_message msg; +struct spi_transfer xfer = {0 }; + + tx = (TSC2005_REG | reg |TSC2005_REG_PND0 | +TSC2005_REG_WRITE ) <<16 ; + tx |= value; + + xfer.tx_buf = &tx; + xfer.rx_buf =NULL ; + xfer.len =4 ; + xfer.bits_per_word =24 ; + +spi_message_init (&msg); +spi_message_add_tail (&xfer, &msg); +spi_sync (ts->spi, &msg); +} + +static void tsc2005_ts_update_pen_state (struct tsc2005 *ts, +int x,int y,int pressure) +{ +if (pressure) { +input_report_abs (ts->idev,ABS_X , x); +input_report_abs (ts->idev,ABS_Y , y); +input_report_abs (ts->idev,ABS_PRESSURE , pressure); +if (!ts->pen_down) { +input_report_key (ts->idev,BTN_TOUCH ,1 ); + ts->pen_down =1 ; + } + }else { +input_report_abs (ts->idev,ABS_PRESSURE ,0 ); +if (ts->pen_down) { +input_report_key (ts->idev,BTN_TOUCH ,0 ); + ts->pen_down =0 ; + } + } + +input_sync (ts->idev); +} + +/* +* This function is called by the SPI framework after the coordinates +* have been read from TSC2005 +*/ +static void tsc2005_ts_rx (void *arg) +{ +struct tsc2005 *ts = arg; +unsigned long flags; +int inside_rect, pressure_limit; +int x, y, z1, z2, pressure; + +spin_lock_irqsave (&ts->lock, flags); + + x = ts->data[0 ]; + y = ts->data[1 ]; + z1 = ts->data[2 ]; + z2 = ts->data[3 ]; + +/* validate pressure and position */ +if (x >MAX_12BIT || y >MAX_12BIT ) + goto out; + +/* skip coords if the pressure-components are out of range */ +if (z1 <100 || z2 >4000 ) + goto out; + +/* don't run average on the "pen down" event */ +if (ts->sample_sent) { + ts->avg_x += x; + ts->avg_y += y; + ts->avg_z1 += z1; + ts->avg_z2 += z2; + +if (++ts->sample_cnt <TS_SAMPLES ) + goto out; + + x = ts->avg_x /TS_SAMPLES ; + y = ts->avg_y /TS_SAMPLES ; + z1 = ts->avg_z1 /TS_SAMPLES ; + z2 = ts->avg_z2 /TS_SAMPLES ; + } + + ts->sample_cnt =0 ; + ts->avg_x =0 ; + ts->avg_y =0 ; + ts->avg_z1 =0 ; + ts->avg_z2 =0 ; + +if (z1) { + pressure = x * (z2 - z1) / z1; + pressure = pressure * ts->x_plate_ohm /4096 ; + }else + goto out; + + pressure_limit = ts->sample_sent? ts->p_max: ts->touch_pressure; +if (pressure > pressure_limit) + goto out; + +/* discard the event if it still is within the previous rect - unless +* if the pressure is harder, but then use previous x,y position */ + inside_rect = (ts->sample_sent && + x > (int )ts->x -TS_RECT_SIZE && + x < (int )ts->x +TS_RECT_SIZE && + y > (int )ts->y -TS_RECT_SIZE && + y < (int )ts->y +TS_RECT_SIZE );
drivers/input/touchscreen/tsc2005.c line 361
Quoted 10 lines
drivers/input/touchscreen/tsc2005.c new file +10
-0+if (inside_rect) + x = ts->x, y = ts->y; + +if (!inside_rect || pressure < ts->p) { +tsc2005_ts_update_pen_state (ts, x, y, pressure); + ts->sample_sent =1 ; + ts->x = x; + ts->y = y; + ts->p = pressure; + }
Minor nit: will this not break ts_calibrate from tslib? ts_calibrate tries to read 5 samples for every touch, so the user will need to be moving the pen. I hit this in emulators where noise needs to be added artifically because userspace (tslib) relies on it.
Also curious why report if pressure becomes harder but not when softer.
Regards
Re: [PATCH 12/33] Add tsc2005 touchscreen driver
Quoted 20 lines · ext andrzej zaborowski
2008/8/30 Felipe Balbi <[email protected]>:
Quoted 8 lines
[roughly 470 irrelevant lines discarded]
drivers/input/touchscreen/tsc2005.c new file +7
-0+/* discard the event if it still is within the previous rect - unless +* if the pressure is harder, but then use previous x,y position */ + inside_rect = (ts->sample_sent && + x > (int )ts->x -TS_RECT_SIZE && + x < (int )ts->x +TS_RECT_SIZE && + y > (int )ts->y -TS_RECT_SIZE && + y < (int )ts->y +TS_RECT_SIZE );drivers/input/touchscreen/tsc2005.c line 361
Quoted 10 lines
drivers/input/touchscreen/tsc2005.c new file +10
-0+if (inside_rect) + x = ts->x, y = ts->y; + +if (!inside_rect || pressure < ts->p) { +tsc2005_ts_update_pen_state (ts, x, y, pressure); + ts->sample_sent =1 ; + ts->x = x; + ts->y = y; + ts->p = pressure; + }
Quoted 5 lines
Minor nit: will this not break
ts_calibratefrom tslib?ts_calibratetries to read 5 samples for every touch, so the user will need to be moving the pen. I hit this in emulators where noise needs to be added artifically because userspace (tslib) relies on it.
Also curious why report if pressure becomes harder but not when softer.
Works fine for us, but of course that depends on your tslib configuration. We decided to remove the filtering and whathaveyou from tslib and in a novel move, actually receive useful and correct events from evdev, instead of something that needs to be subjected to further arbitrary filtering to be usable.
Cheers,
Daniel
Re: [PATCH 12/33] Add tsc2005 touchscreen driver
In reply to Felipe Balbidrivers/input/touchscreen/tsc2005.c line 34
Quoted 10 lines · Felipe Balbi
drivers/input/touchscreen/tsc2005.c new file +10
-0+#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/input.h> +#include <linux/interrupt.h> +#include <linux/delay.h> +#include <linux/spi/spi.h> + +#ifdef CONFIG_ARCH_OMAP +#include <mach/gpio.h> +#endif
#include <linux/gpio.h> ?
If this driver depends on having gpio, shouldn't that be reflected in the Kconfig entry? ...
Quoted 14 lines
drivers/input/touchscreen/tsc2005.c new file +14
-0+static int __devinit tsc2005_ts_init (struct tsc2005 *ts, +struct tsc2005_platform_data *pdata) +{ +struct input_dev *idev; +int dav_gpio, r; +int x_max, y_max; +int x_fudge, y_fudge, p_fudge; + +if (pdata->dav_gpio <0 ) { +dev_err (&ts->spi->dev,"need DAV GPIO" ); +return -EINVAL ; + } + dav_gpio = pdata->dav_gpio; + ts->dav_gpio = dav_gpio;
drivers/input/touchscreen/tsc2005.c line 544
Quoted 10 lines
drivers/input/touchscreen/tsc2005.c new file +10
-0+dev_dbg (&ts->spi->dev,"TSC2005: DAV GPIO = %d\n" , dav_gpio); + +#ifdef CONFIG_ARCH_OMAP + r =omap_request_gpio (dav_gpio); +if (r <0 ) { +dev_err (&ts->spi->dev,"unable to get DAV GPIO" ); + goto err1; + } +omap_set_gpio_direction (dav_gpio,1 ); + ts->irq =OMAP_GPIO_IRQ (dav_gpio);
In fact, this driver requires ARCH_OMAP to set ts->irq, otherwise it's uninitialized.
drivers/input/touchscreen/tsc2005.c line 546
Quoted 2 lines
drivers/input/touchscreen/tsc2005.c new file +2
-0+dev_dbg (&ts->spi->dev,"TSC2005: DAV IRQ = %d\n" , ts->irq); +#endif
Can this be converted to the generic gpio stuff?
drivers/input/touchscreen/tsc2005.c line 549
Quoted 3 lines
drivers/input/touchscreen/tsc2005.c new file +3
-0+init_timer (&ts->penup_timer); +setup_timer (&ts->penup_timer, tsc2005_ts_penup_timer_handler, + (unsigned long )ts);
setup_timer() does init_timer() so the first line is redundant.
Re: [PATCH 12/33] Add tsc2005 touchscreen driver
Quoted 4 lines · Russell King - ARM Linux
Quoted 1 line
+ ts->irq =
OMAP_GPIO_IRQ(dav_gpio);In fact, this driver requires
ARCH_OMAPto setts->irq, otherwise it's uninitialized.
Or ts->irq = gpio_to_irq(dav_gpio) ...
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 05/33] add tlv320aic23 driver
In reply to Felipe BalbiQuoted 10 lines · On Sat, 30 Aug 2008 20:16:05 +0300 "ext Felipe Balbi" <[email protected]>…
From: Felipe Balbi <[email protected]>
Signed-off-by Felipe Balbi <[email protected]>--- drivers/i2c/chips/Kconfig | 7 + drivers/i2c/chips/Makefile | 1 + drivers/i2c/chips/tlv320aic23.c | 675 ++++++++++++++++++++++++++++++ +++++++++ 3 files changed, 683 insertions(+), 0 deletions(-) create mode 100644 drivers/i2c/chips/tlv320aic23.c
This driver is obsolete audio codec driver and should disappear eventually than going upstream. At least there is no place for it.
Right path is to have ASoC codec driver for aic23 and develope ASoC machine driver for affected boards like Nokia 770 and OSK.
Jarkko
Re: [PATCH 05/33] add tlv320aic23 driver
Quoted 13 lines · Jarkko Nikula
Quoted 10 lines · On Sat, 30 Aug 2008 20:16:05 +0300 "ext Felipe Balbi" <[email protected]>…
From: Felipe Balbi <[email protected]>
Signed-off-by Felipe Balbi <[email protected]>--- drivers/i2c/chips/Kconfig | 7 + drivers/i2c/chips/Makefile | 1 + drivers/i2c/chips/tlv320aic23.c | 675 ++++++++++++++++++++++++++++++ +++++++++ 3 files changed, 683 insertions(+), 0 deletions(-) create mode 100644 drivers/i2c/chips/tlv320aic23.c
Quoted 5 lines
This driver is obsolete audio codec driver and should disappear eventually than going upstream. At least there is no place for it.
Right path is to have ASoC codec driver for aic23 and develope ASoC machine driver for affected boards like Nokia 770 and OSK.
Do we still have anything using on l-o ? Could you send a patch getting rid of it ?
Signature · 1 line
balbi
Re: [PATCH 05/33] add tlv320aic23 driver
Quoted 6 lines · On Mon, 1 Sep 2008 11:01:58 +0300 "ext Felipe Balbi" <[email protected]> wrote:
Quoted 2 lines
Right path is to have ASoC codec driver for aic23 and develope ASoC machine driver for affected boards like Nokia 770 and OSK.
Do we still have anything using on l-o ? Could you send a patch getting rid of it ?
At least OSK is still using. I sent some time ago a patch removing 770 related hacks from the driver since they didn't compile anymore.
Jarkko
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 5/33 add tlv320aic23 driver
We're still using OSK here. The patch compiled fine, although I'm still having some troubles with the audio in the board. Unfortunately I still don't have the knowledge to develop the ASoC driver, but I would be glad to help.
Cheers
---
Yuri Jaeger Monti
Re: [PATCH 05/33] add tlv320aic23 driver
In reply to a message not in the archiveQuoted 4 lines · Yuri Jaeger Monti
We're still using OSK here. The patch compiled fine, although I'm still having some troubles with the audio in the board.
Unfortunately I still don't have the knowledge to develop the ASoC driver, but I would be glad to help.
Please do, take any of other ASoC driver as an example and try to make it work with tlv ;-)
Signature · 1 line
balbi
Tony Lindgren
maintainerRe: [PATCH 05/33] add tlv320aic23 driver
Quoted 8 lines · Felipe Balbi
Quoted 4 lines · Yuri Jaeger Monti
We're still using OSK here. The patch compiled fine, although I'm still having some troubles with the audio in the board.
Unfortunately I still don't have the knowledge to develop the ASoC driver, but I would be glad to help.Please do, take any of other ASoC driver as an example and try to make it work with tlv ;-)
Let's get rid of all the old audio drivers once osk5912 ASoC driver works. I'll export the old audio code into a patch on my website for references in case anybody needs it.
Tony
Re: [PATCH 04/33] add omap gpio expander driver
In reply to Felipe BalbiNAK on this one..
Quoted 13 lines · Felipe Balbi
drivers/i2c/chips/Kconfig +0
-0@@ -137,6 +137,13 @@ config TPS65010This driver can also be built as a module. If so, the module will be called tps65010.
drivers/i2c/chips/Kconfig +7
-0+config GPIOEXPANDER_OMAP + bool "GPIO Expander PCF8574PWR for OMAP" + depends on I2C && (ARCH_OMAP16XX || ARCH_OMAP24XX) + help + If you say yes here you get support for I/O expander calls + to configure IrDA, Camera and audio devices. +
Quoted 3 lines
config
SENSORS_MAX6875
tristate "Maxim MAX6875 Power supply supervisor" depends on EXPERIMENTAL
But drivers/gpio/pcf857x.c does just fine for this chip. Rather than push this upstream, switch over all users and delete this code.
ISTR having an example patch doing this for H4 boards. I'll dig that up and post it when I have time to refresh the code.
The only other user of this hack is the H3 board support.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 04/33] add omap gpio expander driver
Quoted 1 line · David Brownell
NAK on this one..
Cool, patch dropped.
Signature · 1 line
balbi
Re: [PATCH 01/33] add lp5521 driver
In reply to Felipe BalbiQuoted 8 lines · Felipe Balbi
drivers/i2c/chips/lp5521.c new file +8
-0+static int lp5521_configure (struct i2c_client *client) +{ + int ret = 0; + + /* Enable chip and set light to logarithmic mode*/ + ret |= lp5521_write(client, LP5521_REG_ENABLE, 0xc0); + + /* setting all color pwms to direct control mode */
drivers/i2c/chips/lp5521.c line 122
Quoted 10 lines
drivers/i2c/chips/lp5521.c new file +10
-0+ ret |= lp5521_write(client, LP5521_REG_OP_MODE, 0x3f); + + /* setting current to 4.7 mA for all channels */ + ret |= lp5521_write(client, LP5521_REG_R_CNTRL, LP5521_CURRENT_4m7); + ret |= lp5521_write(client, LP5521_REG_G_CNTRL, LP5521_CURRENT_4m7); + ret |= lp5521_write(client, LP5521_REG_B_CNTRL, LP5521_CURRENT_4m7); + + /* Enable auto-powersave, set charge pump to auto, red to battery */ + ret |= lp5521_write(client, LP5521_REG_MISC, 0x3c); +
This highlights one reason many of these drivers haven't gone
upstream: embedding non-general assumptions. In this case it should be simple enough to define platform data to represent various options like these ...
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/33] add lp5521 driver
Quoted 16 lines · David Brownell
Quoted 15 lines · Felipe Balbi
drivers/i2c/chips/lp5521.c new file +15
-0+static int lp5521_configure (struct i2c_client *client) +{ + int ret = 0; + + /* Enable chip and set light to logarithmic mode*/ + ret |= lp5521_write(client, LP5521_REG_ENABLE, 0xc0); + + /* setting all color pwms to direct control mode */ + ret |= lp5521_write(client, LP5521_REG_OP_MODE, 0x3f); + + /* setting current to 4.7 mA for all channels */ + ret |= lp5521_write(client, LP5521_REG_R_CNTRL, LP5521_CURRENT_4m7); + ret |= lp5521_write(client, LP5521_REG_G_CNTRL, LP5521_CURRENT_4m7); + ret |= lp5521_write(client, LP5521_REG_B_CNTRL, LP5521_CURRENT_4m7); +
Quoted 8 lines
Quoted 3 lines
+ /* Enable auto-powersave, set charge pump to auto, red to battery */ + ret |=
lp5521_write(client, LP5521_REG_MISC, 0x3c);
+This highlights one reason many of these drivers haven't gone
upstream: embedding non-general assumptions. In this case it should be simple enough to define platform data to represent various options like these ...
Also dropped. The author should take a look at this. I'm putting him in the loop.
Mathias, any comments on this ??
Signature · 5 lines
balbi -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 6 lines · Felipe Balbi
From: Felipe Balbi <[email protected]>
The following drivers are going upstream for integration. They have been sitting on linux-omap for quite a while just increasing the diff against mainline and probability of merge conflicts.
Just one comment to this. I had to left bluetooth driver out of the series because it's using omap2_block/allow_sleep in the driver code. That should be fixed and the set_clock function should come via platform_data to the driver.
53 static void hci_h4p_set_clk(struct hci_h4p_info *info, int *clock, int enable)
54 {
55 unsigned long flags;
56
57 spin_lock_irqsave(&info->clocks_lock, flags);
58 if (enable && !*clock) {
59 NBT_DBG_POWER("Enabling %p\n", clock);
60 clk_enable(info->uart_fclk);
61 #ifdef CONFIG_ARCH_OMAP2
62 if (cpu_is_omap24xx()) {
63 clk_enable(info->uart_iclk);
64 omap2_block_sleep();
65 }
66 #endif
67 }
68 if (!enable && *clock) {
69 NBT_DBG_POWER("Disabling %p\n", clock);
70 clk_disable(info->uart_fclk);
71 #ifdef CONFIG_ARCH_OMAP2
72 if (cpu_is_omap24xx()) {
73 clk_disable(info->uart_iclk);
74 omap2_allow_sleep();
75 }
76 #endif
77 }
78
79 *clock = enable;
80 spin_unlock_irqrestore(&info->clocks_lock, flags);
81 }That driver is full of arch specific code and should be cleaned up ASAP.
A few things I could get by briefly looking at the driver (actualy only drivers/bluetooth/hci_h4p/core.c):
* set_clock should come via platform_data
* gpio handling should use gpiolib instead of omap-specific ones
* irq should come via platform_data to avoid 'if (cpu_is_xxx())'
* unnecessary casts should be removed
* one line ifs do not need {}
* there's a memory leak on probe if no platform_data is found
* use of io_p2v() should be avoided on drivers, refer to Russel King's patch
* OMAP_GPIO_IRQ() should not be used on the driver.
Signature · 1 line
balbi
Quoted 9 lines · Felipe Balbi
Quoted 6 lines · Felipe Balbi
From: Felipe Balbi <[email protected]>
The following drivers are going upstream for integration. They have been sitting on linux-omap for quite a while just increasing the diff against mainline and probability of merge conflicts.
Just one comment to this. I had to left bluetooth driver out of the
typo, 'I had to leave'
Signature · 1 line
balbi
2008/9/1 Felipe Balbi <[email protected]>:
Quoted 43 lines · Felipe Balbi
Quoted 6 lines
From: Felipe Balbi <[email protected]>
The following drivers are going upstream for integration. They have been sitting on linux-omap for quite a while just increasing the diff against mainline and probability of merge conflicts.
Just one comment to this. I had to left bluetooth driver out of the series because it's using omap2_block/allow_sleep in the driver code. That should be fixed and the
set_clockfunction should come viaplatform_datato the driver.53 static void
hci_h4p_set_clk(struct hci_h4p_info *info, int *clock, int enable)54 {
55 unsigned long flags;
56
57spin_lock_irqsave(&info->clocks_lock, flags);
58 if (enable && !*clock) {
59NBT_DBG_POWER("Enabling %p\n", clock);
60clk_enable(info->uart_fclk);
61 #ifdefCONFIG_ARCH_OMAP2
62 if (cpu_is_omap24xx()) {
63clk_enable(info->uart_iclk);
64omap2_block_sleep();
65 }
66 #endif
67 }
68 if (!enable && *clock) {
69NBT_DBG_POWER("Disabling %p\n", clock);
70clk_disable(info->uart_fclk);
71 #ifdefCONFIG_ARCH_OMAP2
72 if (cpu_is_omap24xx()) {
73clk_disable(info->uart_iclk);
74omap2_allow_sleep();
75 }
76 #endif
77 }
78
79 *clock = enable;
80spin_unlock_irqrestore(&info->clocks_lock, flags);
81 }
Quoted 4 lines
That driver is full of arch specific code and should be cleaned up ASAP.
A few things I could get by briefly looking at the driver (actualy only
drivers/bluetooth/hci_h4p/core.c):
There's also a curious issue in hci_h4p_interrupt I hit recently but after looking at the rest of the driver thought it was beating a dead horse..., but just in case it isn't:
the driver assumes the OMAP UART, but then it uses UART_IIR_ID which is only valid for standard UARTs, causing OMAP-specific Rx errors to be ignored silently. Turns out that on my N810 there are actually Rx errors reported during firmware upload, but I didn't find a better way to handle them than to ignore them:
drivers/bluetooth/hci_h4p/core.c +8 -1
@@ -482,7 +491,14 @@ static irqreturn_t hci_h4p_interrupt(int irq, void *data)NBT_DBG ("In interrupt handler iir 0x%.2x\n" , iir); - iir &=UART_IIR_ID ; + iir &=0x1e ;/* OMAP UART has wider INT than UART_IIR_ID */ + +/* +* Often Rx errors are reported but reading the receive buffer +* gives the correct data, so treat it as an Rx interrupt. +*/ +if (iir ==0xc ) + iir =0x4 ;if (iir ==UART_IIR_MSI ) { msr =hci_h4p_inb (info,UART_MSR );
The tsc210x drivers should be upstreamable with the exception of ALSA code which needs to be converted to ASoC. Maruk Vasut found a leak in one error path, but I can't charge the device that has the tsc2102 that I used for testing.
I have some improvements to drivers/net/irda/omap-ir.c (clean-up and removing OMAP16xx specific bits to support OMAP1) but again, have no charger for the device.
Thanks
Quoted 77 lines · andrzej zaborowski
2008/9/1 Felipe Balbi <[email protected]>:
Quoted 43 lines · Felipe Balbi
Quoted 6 lines
From: Felipe Balbi <[email protected]>
The following drivers are going upstream for integration. They have been sitting on linux-omap for quite a while just increasing the diff against mainline and probability of merge conflicts.
Just one comment to this. I had to left bluetooth driver out of the series because it's using omap2_block/allow_sleep in the driver code. That should be fixed and the
set_clockfunction should come viaplatform_datato the driver.53 static void
hci_h4p_set_clk(struct hci_h4p_info *info, int *clock, int enable)54 {
55 unsigned long flags;
56
57spin_lock_irqsave(&info->clocks_lock, flags);
58 if (enable && !*clock) {
59NBT_DBG_POWER("Enabling %p\n", clock);
60clk_enable(info->uart_fclk);
61 #ifdefCONFIG_ARCH_OMAP2
62 if (cpu_is_omap24xx()) {
63clk_enable(info->uart_iclk);
64omap2_block_sleep();
65 }
66 #endif
67 }
68 if (!enable && *clock) {
69NBT_DBG_POWER("Disabling %p\n", clock);
70clk_disable(info->uart_fclk);
71 #ifdefCONFIG_ARCH_OMAP2
72 if (cpu_is_omap24xx()) {
73clk_disable(info->uart_iclk);
74omap2_allow_sleep();
75 }
76 #endif
77 }
78
79 *clock = enable;
80spin_unlock_irqrestore(&info->clocks_lock, flags);
81 }Quoted 4 lines
That driver is full of arch specific code and should be cleaned up ASAP.
A few things I could get by briefly looking at the driver (actualy only
drivers/bluetooth/hci_h4p/core.c):There's also a curious issue in
hci_h4p_interruptI hit recently but after looking at the rest of the driver thought it was beating a dead horse..., but just in case it isn't:
the driver assumes the OMAP UART, but then it usesUART_IIR_IDwhich is only valid for standard UARTs, causing OMAP-specific Rx errors to be ignored silently. Turns out that on my N810 there are actually Rx errors reported during firmware upload, but I didn't find a better way to handle them than to ignore them:drivers/bluetooth/hci_h4p/core.c +8
-1@@ -482,7 +491,14 @@ static irqreturn_t hci_h4p_interrupt(int irq, void *data)NBT_DBG ("In interrupt handler iir 0x%.2x\n" , iir); - iir &=UART_IIR_ID ; + iir &=0x1e ;/* OMAP UART has wider INT than UART_IIR_ID */ + +/* +* Often Rx errors are reported but reading the receive buffer +* gives the correct data, so treat it as an Rx interrupt. +*/ +if (iir ==0xc ) + iir =0x4 ;if (iir ==UART_IIR_MSI ) { msr =hci_h4p_inb (info,UART_MSR );
Quoted 8 lines
The tsc210x drivers should be upstreamable with the exception of ALSA code which needs to be converted to ASoC. Maruk Vasut found a leak in one error path, but I can't charge the device that has the tsc2102 that I used for testing.
I have some improvements to
drivers/net/irda/omap-ir.c(clean-up and removing OMAP16xx specific bits to support OMAP1) but again, have no charger for the device.
Let's put Ville on the loop as he might be interested in it. Ville, any comments ?
Signature · 1 line
balbi
2008/8/30 Felipe Balbi <[email protected]>:
<snim>
Quoted 1 line
Add omap touchscreen driver
This is just a tsc2101 touchscreen + pin multiplexing, I'm not really sure it should be upstream (but don't drop it without someone who knows commenting). I think someone even experimented with using a tsc2101 driver on the Hx board, but I may be wrong. Regards