static int __init bus_init(void) { struct bit_data *bit = &bit_data; unsigned long flags; int ret; if (machine_is_assabet() || machine_is_pangolin()) { bit->sda = GPIO_GPIO15; bit->scl = GPIO_GPIO18; bit->l3_mode = GPIO_GPIO17; } if (machine_is_h3600() || machine_is_h3100()) { bit->sda = GPIO_GPIO14; bit->scl = GPIO_GPIO16; bit->l3_mode = GPIO_GPIO15; } if (machine_is_stork()) { bit->sda = GPIO_GPIO15; bit->scl = GPIO_GPIO18; bit->l3_mode = GPIO_GPIO17; } if (!bit->sda) return -ENODEV; /* * Default level for L3 mode is low. * We set SCL and SDA high (i2c idle state). */ local_irq_save(flags); GPDR &= ~(bit->scl | bit->sda); GPCR = bit->l3_mode | bit->scl | bit->sda; GPDR |= bit->l3_mode; local_irq_restore(flags); if (machine_is_assabet()) { /* * Release reset on UCB1300, ADI7171 and UDA1341. We * need to do this here so that we can communicate on * the I2C/L3 buses. */ ASSABET_BCR_set(ASSABET_BCR_CODEC_RST); mdelay(1); ASSABET_BCR_clear(ASSABET_BCR_CODEC_RST); mdelay(1); ASSABET_BCR_set(ASSABET_BCR_CODEC_RST); } ret = i2c_init(bit); if (ret == 0 && bit->l3_mode) { ret = l3_init(bit); if (ret) i2c_exit(); } return ret; }
static struct sa1100fb_mach_info * __init sa1100fb_get_machine_info(struct sa1100fb_info *fbi) { struct sa1100fb_mach_info *inf = NULL; /* * R G B T * default {11,5}, { 5,6}, { 0,5}, { 0,0} * h3600 {12,4}, { 7,4}, { 1,4}, { 0,0} * freebird { 8,4}, { 4,4}, { 0,4}, {12,4} */ #ifdef CONFIG_SA1100_ASSABET if (machine_is_assabet()) { #ifndef ASSABET_PAL_VIDEO inf = &lq039q2ds54_info; #else inf = &pal_info; #endif } #endif #ifdef CONFIG_SA1100_H3100 if (machine_is_h3100()) { inf = &h3100_info; } #endif #ifdef CONFIG_SA1100_H3600 if (machine_is_h3600()) { inf = &h3600_info; fbi->rgb[RGB_16] = &h3600_rgb_16; } #endif #ifdef CONFIG_SA1100_COLLIE if (machine_is_collie()) { inf = &collie_info; } #endif #ifdef CONFIG_SA1100_LART if (machine_is_lart()) { #ifdef LART_GREY_LCD inf = &lart_grey_info; #endif #ifdef LART_COLOR_LCD inf = &lart_color_info; #endif #ifdef LART_VIDEO_OUT inf = &lart_video_info; #endif #ifdef LART_KIT01_LCD inf = &lart_kit01_info; #endif } #endif #ifdef CONFIG_SA1100_SHANNON if (machine_is_shannon()) { inf = &shannon_info; } #endif return inf; }
int __init pcmcia_h3600_init(struct device *dev) { int ret = -ENODEV; if (machine_is_h3600()) ret = sa11xx_drv_pcmcia_probe(dev, &h3600_pcmcia_ops, 0, 2); return ret; }
static int __init h3600_uda1341_init(void) { int ret = -ENODEV; if (!machine_is_h3600() || machine_is_h3100() || machine_is_h3800()) ret = driver_register(&h3x00_audio_driver); return ret; }
static int __init h3600_lcd_init(void) { int rc; if (!machine_is_h3600()) return -ENODEV; rc = platform_driver_register(&h3600_lcd_driver); return rc; }
int __init h3600_micro_init( void ) { int result = 0; if (machine_is_h3600() || machine_is_h3100()) { result = h3600_micro_setup(); if ( !result ) result = h3600_hal_register_interface( g_micro_ops ); return result; } else { return -ENODEV; } }
/* * Control the power state of the IrDA transmitter. * State: * 0 - off * 1 - short range, lowest power * 2 - medium range, medium power * 3 - maximum range, high power * * Currently, only assabet is known to support this. */ static int __sa1100_irda_set_power(struct sa1100_irda *si, unsigned int state) { int ret = 0; if (machine_is_assabet()) ret = sa1100_irda_set_power_assabet(si, state); if (machine_is_h3600()) ret = sa1100_irda_set_power_h3600(si, state); if (machine_is_yopy()) ret = sa1100_irda_set_power_yopy(si, state); return ret; }
static int __init h3600_init_model_ops(void) { if (machine_is_h3xxx()) { if (machine_is_h3100()) { ipaq_model_ops = h3100_model_ops; } else if (machine_is_h3600()) { ipaq_model_ops = h3600_model_ops; } else if (machine_is_h3800()) { ipaq_model_ops = h3800_model_ops; } init_h3600_egpio(); } return 0; }
static int h3600_lcd_probe (struct platform_device *pdev) { if (! machine_is_h3600 ()) return -ENODEV; h3600_lcd_device = lcd_device_register("sa1100fb", NULL, &h3600_lcd_ops); if (IS_ERR (h3600_lcd_device)) return PTR_ERR (h3600_lcd_device); h3600_lcd_set_power (h3600_lcd_device, 0); sa1100fb_lcd_power = __h3600_lcd_power; return 0; }
void __exit h3600_micro_cleanup( void ) { if (machine_is_h3600() || machine_is_h3100()) { h3600_hal_unregister_interface( g_micro_ops ); free_irq(IRQ_Ser1UART, h3600_micro_serial_isr); free_irq(IRQ_GPIO_H3600_ACTION_BUTTON, h3600_micro_action_isr); free_irq(IRQ_GPIO_H3600_NPOWER_BUTTON, h3600_micro_power_isr); free_irq(IRQ_GPIO_H3600_OPT_DET, h3600_micro_sleeve_isr); h3600_unregister_pm_callback( h3600_micro_pm_callback ); if ( micro_proc_dir ) { remove_proc_entry(H3600_MICRO_PROC_STATS, micro_proc_dir); remove_proc_entry(H3600_MICRO_PROC_DIR, NULL ); micro_proc_dir = NULL; } } }
static int __init sa1100_pcmcia_machine_init(void) { #ifdef CONFIG_SA1100_ASSABET if(machine_is_assabet()) { if(machine_has_neponset()) { #ifdef CONFIG_ASSABET_NEPONSET pcmcia_low_level = &neponset_pcmcia_ops; #else printk(KERN_ERR "Card Services disabled: missing Neponset support\n"); return -1; #endif } else pcmcia_low_level = &assabet_pcmcia_ops; } #endif #ifdef CONFIG_SA1100_BADGE4 if (machine_is_badge4()) pcmcia_low_level = &badge4_pcmcia_ops; #endif #ifdef CONFIG_SA1100_FREEBIRD if (machine_is_freebird()) pcmcia_low_level = &freebird_pcmcia_ops; #endif #ifdef CONFIG_SA1100_H3600 if (machine_is_h3600()) pcmcia_low_level = &h3600_pcmcia_ops; #endif #ifdef CONFIG_SA1100_CERF if (machine_is_cerf()) pcmcia_low_level = &cerf_pcmcia_ops; #endif #ifdef CONFIG_SA1100_GRAPHICSCLIENT if (machine_is_graphicsclient()) pcmcia_low_level = &gcplus_pcmcia_ops; #endif #ifdef CONFIG_SA1100_XP860 if (machine_is_xp860()) pcmcia_low_level = &xp860_pcmcia_ops; #endif #ifdef CONFIG_SA1100_YOPY if (machine_is_yopy()) pcmcia_low_level = &yopy_pcmcia_ops; #endif #ifdef CONFIG_SA1100_SHANNON if (machine_is_shannon()) pcmcia_low_level = &shannon_pcmcia_ops; #endif #ifdef CONFIG_SA1100_PANGOLIN if (machine_is_pangolin()) pcmcia_low_level = &pangolin_pcmcia_ops; #endif #ifdef CONFIG_SA1100_JORNADA720 if (machine_is_jornada720()) pcmcia_low_level = &jornada720_pcmcia_ops; #endif #ifdef CONFIG_SA1100_PFS168 if(machine_is_pfs168()) pcmcia_low_level = &pfs168_pcmcia_ops; #endif #ifdef CONFIG_SA1100_FLEXANET if(machine_is_flexanet()) pcmcia_low_level = &flexanet_pcmcia_ops; #endif #ifdef CONFIG_SA1100_SIMPAD if(machine_is_simpad()) pcmcia_low_level = &simpad_pcmcia_ops; #endif #ifdef CONFIG_SA1100_GRAPHICSMASTER if(machine_is_graphicsmaster()) pcmcia_low_level = &graphicsmaster_pcmcia_ops; #endif #ifdef CONFIG_SA1100_ADSAGC if(machine_is_adsagc()) pcmcia_low_level = &graphicsmaster_pcmcia_ops; #endif #ifdef CONFIG_SA1100_ADSBITSY if(machine_is_adsbitsy()) pcmcia_low_level = &adsbitsy_pcmcia_ops; #endif #ifdef CONFIG_SA1100_ADSBITSYPLUS if(machine_is_adsbitsyplus()) pcmcia_low_level = &adsbitsyplus_pcmcia_ops; #endif #ifdef CONFIG_SA1100_STORK if(machine_is_stork()) pcmcia_low_level = &stork_pcmcia_ops; #endif if (!pcmcia_low_level) { printk(KERN_ERR "This hardware is not supported by the SA1100 Card Service driver\n"); return -ENODEV; } return 0; }
/* * Set the IrDA communications speed. */ static int sa1100_irda_set_speed(struct sa1100_irda *si, int speed) { unsigned long flags; int brd, ret = -EINVAL; switch (speed) { case 9600: case 19200: case 38400: case 57600: case 115200: brd = 3686400 / (16 * speed) - 1; /* * Stop the receive DMA. */ if (IS_FIR(si)) sa1100_dma_stop(si->rxdma); local_irq_save(flags); Ser2UTCR3 = 0; Ser2HSCR0 = HSCR0_UART; Ser2UTCR1 = brd >> 8; Ser2UTCR2 = brd; /* * Clear status register */ Ser2UTSR0 = UTSR0_REB | UTSR0_RBB | UTSR0_RID; Ser2UTCR3 = UTCR3_RIE | UTCR3_RXE | UTCR3_TXE; if (machine_is_assabet()) ASSABET_BCR_clear(ASSABET_BCR_IRDA_FSEL); if (machine_is_h3600()) clr_h3600_egpio(EGPIO_H3600_IR_FSEL); if (machine_is_yopy()) PPSR &= ~GPIO_IRDA_FIR; si->speed = speed; local_irq_restore(flags); ret = 0; break; case 4000000: save_flags(flags); cli(); si->hscr0 = 0; Ser2HSSR0 = 0xff; Ser2HSCR0 = si->hscr0 | HSCR0_HSSP; Ser2UTCR3 = 0; si->speed = speed; if (machine_is_assabet()) ASSABET_BCR_set(ASSABET_BCR_IRDA_FSEL); if (machine_is_h3600()) set_h3600_egpio(EGPIO_H3600_IR_FSEL); if (machine_is_yopy()) PPSR |= GPIO_IRDA_FIR; sa1100_irda_rx_alloc(si); sa1100_irda_rx_dma_start(si); restore_flags(flags); break; default: break; } return ret; }
static int h3600_micro_setup( void ) { int result, i; printk("%s: setting up microcontroller interface\n", __FUNCTION__); if ( machine_is_h3100() ) { g_micro_ops = &h3100_micro_ops; } else if ( machine_is_h3600() ) { g_micro_ops = &h3600_micro_ops; } else { printk("%s: illegal iPAQ model %s\n", __FUNCTION__, h3600_generic_name() ); return -ENODEV; } /* Set up our structures */ for(i = 0; i < NUM_HANDLERS; i++) { init_waitqueue_head((wait_queue_head_t *) &g_handlers[i].waitq ); } init_MUTEX((struct semaphore *) &g_txdev.lock ); /* Start working */ h3600_micro_reset_comm(); /* Set up interrupts */ result = request_irq(IRQ_Ser1UART, h3600_micro_serial_isr, SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM, "h3600_ts", h3600_micro_serial_isr); if ( result ) { printk(KERN_CRIT "%s: unable to grab serial port IRQ\n", __FUNCTION__); return result; } result = request_irq(IRQ_GPIO_H3600_ACTION_BUTTON, h3600_micro_action_isr, SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM, "h3600_action", h3600_micro_action_isr); set_irq_type( IRQ_GPIO_H3600_ACTION_BUTTON, IRQT_BOTHEDGE ); if ( result ) { printk(KERN_CRIT "%s: unable to grab action button IRQ\n", __FUNCTION__); goto failed0; } result = request_irq(IRQ_GPIO_H3600_NPOWER_BUTTON, h3600_micro_power_isr, SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM, "h3600_suspend", h3600_micro_power_isr); set_irq_type( IRQ_GPIO_H3600_NPOWER_BUTTON, IRQT_BOTHEDGE ); if ( result ) { printk(KERN_CRIT "%s: unable to grab power button IRQ\n", __FUNCTION__); goto failed1; } result = request_irq(IRQ_GPIO_H3600_OPT_DET, h3600_micro_sleeve_isr, SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM, "h3600_sleeve", h3600_micro_sleeve_isr); set_irq_type( IRQ_GPIO_H3600_OPT_DET, IRQT_BOTHEDGE ); if ( result ){ printk(KERN_CRIT "%s: unable to grab option pack detect IRQ\n", __FUNCTION__); goto failed2; } /* Register in /proc filesystem */ micro_proc_dir = proc_mkdir(H3600_MICRO_PROC_DIR, NULL); if ( micro_proc_dir ) create_proc_read_entry(H3600_MICRO_PROC_STATS, 0, micro_proc_dir, h3600_micro_proc_stats_read, NULL ); else printk(KERN_ALERT "%s: unable to create proc entry %s\n", __FUNCTION__, H3600_MICRO_PROC_DIR); /* Register with power management */ h3600_register_pm_callback( h3600_micro_pm_callback ); /* Set some GPIO direction registers */ GPDR |= (GPIO_H3600_CLK_SET0 | GPIO_H3600_CLK_SET1); return 0; failed2: free_irq( IRQ_GPIO_H3600_NPOWER_BUTTON, h3600_micro_power_isr); failed1: free_irq( IRQ_GPIO_H3600_ACTION_BUTTON, h3600_micro_action_isr ); failed0: free_irq( IRQ_Ser1UART, h3600_micro_serial_isr ); return result; }