summaryrefslogtreecommitdiff
path: root/io-module/mts_io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io-module/mts_io.c')
-rw-r--r--io-module/mts_io.c133
1 files changed, 4 insertions, 129 deletions
diff --git a/io-module/mts_io.c b/io-module/mts_io.c
index 38d1086..fa61e1f 100644
--- a/io-module/mts_io.c
+++ b/io-module/mts_io.c
@@ -54,8 +54,6 @@
#define LED_LS_CONTROLLABLE 0
-#define AT91SAM9X5_BASE_ADC 0xf804c000
-
/* on-board EEPROM */
extern uint8_t mts_id_eeprom[512];
static struct mts_id_eeprom_layout id_eeprom;
@@ -86,12 +84,6 @@ static struct attribute_group ap_attr_groups[NUM_AP];
static struct ap_info* port_info[NUM_AP];
-static uint8_t mts_product_id;
-static uint8_t has_spi_sout;
-static uint8_t has_spi_din;
-static uint8_t has_spi_dout;
-static uint8_t has_spi_temp;
-
static struct platform_device *mts_io_platform_device;
static struct attribute_group *attr_group;
static struct gpio_pin *gpio_pins;
@@ -101,12 +93,6 @@ static DEFINE_MUTEX(mts_io_mutex);
/* generic GPIO support */
#include "gpio.c"
-/* AT91 built-in ADC */
-#include "adc.c"
-
-/* SPI-based stuff */
-#include "spi.c"
-
/* accessory card support */
#include "mtac.c"
#include "mtac_gpiob.c"
@@ -479,23 +465,12 @@ static int mts_id_eeprom_load(void)
{
memcpy(&id_eeprom, mts_id_eeprom, sizeof(mts_id_eeprom));
- mts_product_id = MTCDP_E1_DK_1_0;
- has_spi_sout = 1;
- has_spi_din = 1;
- has_spi_dout = 1;
- has_spi_temp = 1;
-
if (mts_id_eeprom[0] == 0xFF) {
log_error("uninitialized eeprom");
return -EIO;
} else {
attr_group = &mtr2d2_platform_attribute_group;
gpio_pins = gpio_pins_mtr2d2_0_0;
- mts_product_id = MTR2D2_0_0;
- has_spi_sout = 0;
- has_spi_din = 0;
- has_spi_dout = 0;
- has_spi_temp = 0;
log_info("detected board %s", HW_VERSION_MTR2D2_0_0);
}
@@ -586,56 +561,6 @@ static int __init mts_io_init(void)
goto error4;
}
- if ( has_spi_sout ) {
- ret = spi_register_driver(&mts_spi_sout_driver);
- if (ret) {
- goto error5;
- }
- }
-
- if ( has_spi_dout ) {
- ret = spi_register_driver(&mts_spi_dout_driver);
- if (ret) {
- goto error6;
- }
- }
- if ( has_spi_din ) {
- ret = spi_register_driver(&mts_spi_din_driver);
- if (ret) {
- goto error7;
- }
- }
-
- if ( has_spi_temp ) {
- ret = spi_register_driver(&mts_spi_board_temp_driver);
- if (ret) {
- goto error8;
- }
- }
-
- /* ADC Setup */
-#ifdef CONFIG_SOC_AT91SAM9X5
- adc_base = ioremap(AT91SAM9X5_BASE_ADC, SZ_16K);
-#else
- adc_base = ioremap(AT91SAM9260_BASE_ADC, SZ_16K);
-#endif
- if (!adc_base) {
- goto error9;
- }
-
- adc_clk = clk_get(NULL, "adc_clk");
- if (!adc_clk) {
- goto error10;
- }
- clk_enable(adc_clk);
-
- ADC_CONVERT_RESET(adc_base);
- writel(ADC_MODE_DEFAULT, adc_base + ADC_MR_OFFSET);
- writel(0x000F0F0F, adc_base + ADC_IDR_OFFSET);
- if (!DEVICE_CAPA(id_eeprom.capa, CAPA_ADC)) {
- writel(0x0F, adc_base + ADC_CHDR_OFFSET);
- }
-
for (pin = gpio_pins; *pin->name; pin++) {
ret = gpio_request_one(pin->pin.gpio, pin->pin.flags, pin->pin.label);
if (ret) {
@@ -643,41 +568,13 @@ static int __init mts_io_init(void)
}
}
- if ( has_spi_sout || has_spi_dout || has_spi_din ) {
- pin = gpio_pin_by_name("ENIO");
- if (pin) {
- gpio_set_value(pin->pin.gpio, 0);
- }
- }
-
- // No reset_callback for MT100EOCG
- if ( mts_product_id != MT100EOCG_0_0 ) {
- reset_callback(NULL);
- }
+ // start the reset handler
+ reset_callback(NULL);
return 0;
-error10:
- iounmap(adc_base);
-error9:
- if ( has_spi_temp ) {
- spi_unregister_driver(&mts_spi_board_temp_driver);
- }
-error8:
- if ( has_spi_din ) {
- spi_unregister_driver(&mts_spi_din_driver);
- }
-error7:
- if ( has_spi_dout ) {
- spi_unregister_driver(&mts_spi_dout_driver);
- }
-error6:
- if ( has_spi_sout ) {
- spi_unregister_driver(&mts_spi_sout_driver);
- }
-error5:
- sysfs_remove_group(&mts_io_platform_device->dev.kobj, attr_group);
error4:
+ sysfs_remove_group(&mts_io_platform_device->dev.kobj, attr_group);
sysfs_remove_link(&mts_io_platform_device->dev.parent->kobj, "mtcdp");
error3:
platform_device_del(mts_io_platform_device);
@@ -700,25 +597,7 @@ static void __exit mts_io_exit(void)
int port;
int port_index;
- if ( mts_product_id != MT100EOCG_0_0 ) {
- cancel_delayed_work_sync(&reset_work);
- }
-
- iounmap(adc_base);
- clk_disable(adc_clk);
- clk_put(adc_clk);
-
- if (has_spi_temp)
- spi_unregister_driver(&mts_spi_board_temp_driver);
-
- if (has_spi_din)
- spi_unregister_driver(&mts_spi_din_driver);
-
- if (has_spi_dout)
- spi_unregister_driver(&mts_spi_dout_driver);
-
- if (has_spi_sout)
- spi_unregister_driver(&mts_spi_sout_driver);
+ cancel_delayed_work_sync(&reset_work);
sysfs_remove_group(&mts_io_platform_device->dev.kobj, attr_group);
@@ -744,10 +623,6 @@ MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_VERSION(DRIVER_VERSION);
MODULE_LICENSE("GPL");
-MODULE_ALIAS("mts-io-sout");
-MODULE_ALIAS("mts-io-board-temp");
-MODULE_ALIAS("mts-io-dout");
-MODULE_ALIAS("mts-io-din");
MODULE_ALIAS("mts-io-ap1-dout");
MODULE_ALIAS("mts-io-ap1-din");
MODULE_ALIAS("mts-io-ap1-adc");