コード例 #1
0
static int __init wgt634u_init(void)
{
	/* There is no easy way to detect that we are running on a WGT634U
	 * machine. Use the MAC address as an heuristic. Netgear Inc. has
	 * been allocated ranges 00:09:5b:xx:xx:xx and 00:0f:b5:xx:xx:xx.
	 */
	u8 *et0mac;

	if (bcm47xx_bus_type != BCM47XX_BUS_TYPE_SSB)
		return -ENODEV;

	et0mac = bcm47xx_bus.ssb.sprom.et0mac;

	if (et0mac[0] == 0x00 &&
	    ((et0mac[1] == 0x09 && et0mac[2] == 0x5b) ||
	     (et0mac[1] == 0x0f && et0mac[2] == 0xb5))) {
		struct ssb_mipscore *mcore = &bcm47xx_bus.ssb.mipscore;

		printk(KERN_INFO "WGT634U machine detected.\n");

		if (!request_irq(gpio_to_irq(WGT634U_GPIO_RESET),
				 gpio_interrupt, IRQF_SHARED,
				 "WGT634U GPIO", &bcm47xx_bus.ssb.chipco)) {
			gpio_direction_input(WGT634U_GPIO_RESET);
			gpio_intmask(WGT634U_GPIO_RESET, 1);
			ssb_chipco_irq_mask(&bcm47xx_bus.ssb.chipco,
					    SSB_CHIPCO_IRQ_GPIO,
					    SSB_CHIPCO_IRQ_GPIO);
		}

		wgt634u_flash_data.width = mcore->flash_buswidth;
		wgt634u_flash_resource.start = mcore->flash_window;
		wgt634u_flash_resource.end = mcore->flash_window
					   + mcore->flash_window_size
					   - 1;
		return platform_add_devices(wgt634u_devices,
					    ARRAY_SIZE(wgt634u_devices));
	} else
		return -ENODEV;
}
コード例 #2
0
ファイル: wgt634u.c プロジェクト: Blackburn29/PsycoKernel
static int __init wgt634u_init(void)
{
	u8 *et0mac;

	if (bcm47xx_bus_type != BCM47XX_BUS_TYPE_SSB)
		return -ENODEV;

	et0mac = bcm47xx_bus.ssb.sprom.et0mac;

	if (et0mac[0] == 0x00 &&
	    ((et0mac[1] == 0x09 && et0mac[2] == 0x5b) ||
	     (et0mac[1] == 0x0f && et0mac[2] == 0xb5))) {
		struct ssb_mipscore *mcore = &bcm47xx_bus.ssb.mipscore;

		printk(KERN_INFO "WGT634U machine detected.\n");

		if (!request_irq(gpio_to_irq(WGT634U_GPIO_RESET),
				 gpio_interrupt, IRQF_SHARED,
				 "WGT634U GPIO", &bcm47xx_bus.ssb.chipco)) {
			gpio_direction_input(WGT634U_GPIO_RESET);
			gpio_intmask(WGT634U_GPIO_RESET, 1);
			ssb_chipco_irq_mask(&bcm47xx_bus.ssb.chipco,
					    SSB_CHIPCO_IRQ_GPIO,
					    SSB_CHIPCO_IRQ_GPIO);
		}

		wgt634u_flash_data.width = mcore->flash_buswidth;
		wgt634u_flash_resource.start = mcore->flash_window;
		wgt634u_flash_resource.end = mcore->flash_window
					   + mcore->flash_window_size
					   - 1;
		return platform_add_devices(wgt634u_devices,
					    ARRAY_SIZE(wgt634u_devices));
	} else
		return -ENODEV;
}