9
0
Fork 0

Merge branch 'work/dns' into next

This commit is contained in:
Sascha Hauer 2012-04-16 11:34:41 +02:00
commit 86b9eb2105
51 changed files with 143 additions and 137 deletions

View File

@ -109,15 +109,15 @@ static int a9m2410_devices_init(void)
writel(reg, S3C_MISCCR);
/* ----------- the devices the boot loader should work with -------- */
add_generic_device("s3c24x0_nand", -1, NULL, S3C24X0_NAND_BASE, 0,
IORESOURCE_MEM, &nand_info);
add_generic_device("s3c24x0_nand", DEVICE_ID_DYNAMIC, NULL, S3C24X0_NAND_BASE,
0, IORESOURCE_MEM, &nand_info);
/*
* SMSC 91C111 network controller on the baseboard
* connected to CS line 1 and interrupt line
* GPIO3, data width is 32 bit
*/
add_generic_device("smc91c111", -1, NULL, S3C_CS1_BASE + 0x300, 16,
IORESOURCE_MEM, NULL);
add_generic_device("smc91c111", DEVICE_ID_DYNAMIC, NULL, S3C_CS1_BASE + 0x300,
16, IORESOURCE_MEM, NULL);
#ifdef CONFIG_NAND
/* ----------- add some vital partitions -------- */
@ -145,8 +145,8 @@ void __bare_init nand_boot(void)
static int a9m2410_console_init(void)
{
add_generic_device("s3c_serial", -1, NULL, S3C_UART1_BASE, S3C_UART1_SIZE,
IORESOURCE_MEM, NULL);
add_generic_device("s3c_serial", DEVICE_ID_DYNAMIC, NULL, S3C_UART1_BASE,
S3C_UART1_SIZE, IORESOURCE_MEM, NULL);
return 0;
}

View File

@ -129,15 +129,15 @@ static int a9m2440_devices_init(void)
writel(reg, S3C_MISCCR);
/* ----------- the devices the boot loader should work with -------- */
add_generic_device("s3c24x0_nand", -1, NULL, S3C24X0_NAND_BASE, 0,
add_generic_device("s3c24x0_nand", DEVICE_ID_DYNAMIC, NULL, S3C24X0_NAND_BASE, 0,
IORESOURCE_MEM, &nand_info);
/*
* cs8900 network controller onboard
* Connected to CS line 5 + A24 and interrupt line EINT9,
* data width is 16 bit
*/
add_generic_device("cs8900", -1, NULL, S3C_CS5_BASE + (1 << 24) + 0x300, 16,
IORESOURCE_MEM, NULL);
add_generic_device("cs8900", DEVICE_ID_DYNAMIC, NULL,
S3C_CS5_BASE + (1 << 24) + 0x300, 16, IORESOURCE_MEM, NULL);
#ifdef CONFIG_NAND
/* ----------- add some vital partitions -------- */
@ -164,8 +164,8 @@ void __bare_init nand_boot(void)
static int a9m2440_console_init(void)
{
add_generic_device("s3c_serial", -1, NULL, S3C_UART1_BASE, S3C_UART1_SIZE,
IORESOURCE_MEM, NULL);
add_generic_device("s3c_serial", DEVICE_ID_DYNAMIC, NULL, S3C_UART1_BASE,
S3C_UART1_SIZE, IORESOURCE_MEM, NULL);
return 0;
}

View File

@ -294,12 +294,12 @@ mem_initcall(beagle_mem_init);
static int beagle_devices_init(void)
{
i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
add_generic_device("i2c-omap", -1, NULL, OMAP_I2C1_BASE, SZ_4K,
add_generic_device("i2c-omap", DEVICE_ID_DYNAMIC, NULL, OMAP_I2C1_BASE, SZ_4K,
IORESOURCE_MEM, NULL);
#ifdef CONFIG_USB_EHCI_OMAP
if (ehci_omap_init(&omap_ehci_pdata) >= 0)
add_usb_ehci_device(-1, OMAP_EHCI_BASE,
add_usb_ehci_device(DEVICE_ID_DYNAMIC, OMAP_EHCI_BASE,
OMAP_EHCI_BASE + 0x10, &ehci_pdata);
#endif /* CONFIG_USB_EHCI_OMAP */
#ifdef CONFIG_OMAP_GPMC
@ -309,7 +309,7 @@ static int beagle_devices_init(void)
gpmc_generic_nand_devices_init(0, 16,
OMAP_ECC_HAMMING_CODE_HW_ROMCODE, &omap3_nand_cfg);
add_generic_device("omap-hsmmc", -1, NULL, OMAP_MMC1_BASE, SZ_4K,
add_generic_device("omap-hsmmc", DEVICE_ID_DYNAMIC, NULL, OMAP_MMC1_BASE, SZ_4K,
IORESOURCE_MEM, NULL);
armlinux_set_bootparams((void *)0x80000100);

View File

@ -72,7 +72,8 @@ static int ep93xx_devices_init(void)
* Up to 32MiB NOR type flash, connected to
* CS line 6, data width is 16 bit
*/
add_generic_device("ep93xx_eth", -1, NULL, 0, 0, IORESOURCE_MEM, NULL);
add_generic_device("ep93xx_eth", DEVICE_ID_DYNAMIC, NULL, 0, 0, IORESOURCE_MEM,
NULL);
armlinux_set_bootparams((void *)CONFIG_EP93XX_SDRAM_BANK0_BASE + 0x100);
@ -101,7 +102,7 @@ static int edb93xx_console_init(void)
writel(0xAA, &syscon->sysswlock);
writel(value, &syscon->devicecfg);
add_generic_device("pl010_serial", -1, NULL, UART1_BASE, 4096,
add_generic_device("pl010_serial", DEVICE_ID_DYNAMIC, NULL, UART1_BASE, 4096,
IORESOURCE_MEM, NULL);
return 0;

View File

@ -253,9 +253,9 @@ static int eukrea_cpuimx25_devices_init(void)
#ifdef CONFIG_USB
imx25_usb_init();
add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
add_generic_usb_ehci_device(DEVICE_ID_DYNAMIC, IMX_OTG_BASE + 0x400, NULL);
#endif
add_generic_device("fsl-udc", -1, NULL, IMX_OTG_BASE, 0x200,
add_generic_device("fsl-udc", DEVICE_ID_DYNAMIC, NULL, IMX_OTG_BASE, 0x200,
IORESOURCE_MEM, &usb_pdata);
armlinux_set_bootparams((void *)0x80000100);

View File

@ -162,13 +162,13 @@ static int eukrea_cpuimx35_devices_init(void)
#ifdef CONFIG_USB
imx35_usb_init();
add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
add_generic_usb_ehci_device(DEVICE_ID_DYNAMIC, IMX_OTG_BASE + 0x400, NULL);
#endif
#ifdef CONFIG_USB_GADGET
/* Workaround ENGcm09152 */
tmp = readl(IMX_OTG_BASE + 0x608);
writel(tmp | (1 << 23), IMX_OTG_BASE + 0x608);
add_generic_device("fsl-udc", -1, NULL, IMX_OTG_BASE, 0x200,
add_generic_device("fsl-udc", DEVICE_ID_DYNAMIC, NULL, IMX_OTG_BASE, 0x200,
IORESOURCE_MEM, &usb_pdata);
#endif
armlinux_set_bootparams((void *)0x80000100);

View File

@ -181,7 +181,7 @@ static int f3s_devices_init(void)
imx35_add_i2c0(NULL);
imx35_add_fec(&fec_info);
add_generic_device("smc911x", -1, NULL, IMX_CS5_BASE, IMX_CS5_RANGE,
add_generic_device("smc911x", DEVICE_ID_DYNAMIC, NULL, IMX_CS5_BASE, IMX_CS5_RANGE,
IORESOURCE_MEM, NULL);
imx35_add_mmc0(NULL);

View File

@ -168,7 +168,7 @@ static int mx21ads_devices_init(void)
add_cfi_flash_device(-1, 0xC8000000, 32 * 1024 * 1024, 0);
imx21_add_nand(&nand_info);
add_generic_device("cs8900", -1, NULL, IMX_CS1_BASE, 0x1000,
add_generic_device("cs8900", DEVICE_ID_DYNAMIC, NULL, IMX_CS1_BASE, 0x1000,
IORESOURCE_MEM, NULL);
imx21_add_fb(&imx_fb_data);

View File

@ -297,8 +297,8 @@ static int mini2440_devices_init(void)
reg |= 0x10000;
writel(reg, S3C_MISCCR);
add_generic_device("s3c24x0_nand", -1, NULL, S3C24X0_NAND_BASE, 0,
IORESOURCE_MEM, &nand_info);
add_generic_device("s3c24x0_nand", DEVICE_ID_DYNAMIC, NULL, S3C24X0_NAND_BASE,
0, IORESOURCE_MEM, &nand_info);
add_dm9000_device(0, S3C_CS4_BASE + 0x300, S3C_CS4_BASE + 0x304,
IORESOURCE_MEM_16BIT, &dm9000_data);
@ -344,8 +344,8 @@ static int mini2440_console_init(void)
s3c_gpio_mode(GPH2_TXD0);
s3c_gpio_mode(GPH3_RXD0);
add_generic_device("s3c_serial", -1, NULL, S3C_UART1_BASE, S3C_UART1_SIZE,
IORESOURCE_MEM, NULL);
add_generic_device("s3c_serial", DEVICE_ID_DYNAMIC, NULL, S3C_UART1_BASE,
S3C_UART1_SIZE, IORESOURCE_MEM, NULL);
return 0;
}

View File

@ -123,8 +123,8 @@ static int mioa701_devices_init(void)
pxa_add_fb((void *)0x44000000, &mioa701_pxafb_info);
pxa_add_mmc((void *)0x41100000, -1, &mioa701_mmc_info);
docg3_iospace = map_io_sections(0x0, (void *)0xe0000000, 0x2000);
add_generic_device("docg3", -1, NULL, (ulong) docg3_iospace, 0x2000,
IORESOURCE_MEM, NULL);
add_generic_device("docg3", DEVICE_ID_DYNAMIC, NULL, (ulong) docg3_iospace,
0x2000, IORESOURCE_MEM, NULL);
armlinux_set_bootparams((void *)0xa0000100);
armlinux_set_architecture(MACH_TYPE_MIOA701);

View File

@ -49,8 +49,10 @@ mem_initcall(netx_mem_init);
static int netx_devices_init(void) {
add_cfi_flash_device(-1, 0xC0000000, 32 * 1024 * 1024, 0);
add_generic_device("netx-eth", -1, NULL, 0, 0, IORESOURCE_MEM, &eth0_data);
add_generic_device("netx-eth", -1, NULL, 0, 0, IORESOURCE_MEM, &eth1_data);
add_generic_device("netx-eth", DEVICE_ID_DYNAMIC, NULL, 0, 0, IORESOURCE_MEM,
&eth0_data);
add_generic_device("netx-eth", DEVICE_ID_DYNAMIC, NULL, 0, 0, IORESOURCE_MEM,
&eth1_data);
devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self0");
@ -75,7 +77,7 @@ static int netx_console_init(void)
*(volatile unsigned long *)(0x00100808) = 2;
*(volatile unsigned long *)(0x0010080c) = 2;
add_generic_device("netx_serial", -1, NULL, NETX_PA_UART0, 0x40,
add_generic_device("netx_serial", DEVICE_ID_DYNAMIC, NULL, NETX_PA_UART0, 0x40,
IORESOURCE_MEM, NULL);
return 0;
}

View File

@ -69,7 +69,7 @@ static struct resource nhk8815_nand_resources[] = {
};
static struct device_d nhk8815_nand_device = {
.id = -1,
.id = DEVICE_ID_DYNAMIC,
.name = "nomadik_nand",
.num_resources = ARRAY_SIZE(nhk8815_nand_resources),
.resource = nhk8815_nand_resources,
@ -95,7 +95,7 @@ static int nhk8815_devices_init(void)
writel(0x0000305b, FSMC_BCR(1));
writel(0x00033f33, FSMC_BTR(1));
add_generic_device("smc91c111", -1, NULL, 0x34000300, 16,
add_generic_device("smc91c111", DEVICE_ID_DYNAMIC, NULL, 0x34000300, 16,
IORESOURCE_MEM, NULL);
register_device(&nhk8815_nand_device);

View File

@ -230,7 +230,7 @@ static struct NS16550_plat serial_plat = {
*/
static int omap3evm_init_console(void)
{
add_ns16550_device(-1,
add_ns16550_device(DEVICE_ID_DYNAMIC,
#if defined(CONFIG_OMAP3EVM_UART1)
OMAP_UART1_BASE,
#elif defined(CONFIG_OMAP3EVM_UART3)
@ -260,7 +260,7 @@ static int omap3evm_init_devices(void)
gpmc_generic_init(0x10);
#endif
#ifdef CONFIG_MCI_OMAP_HSMMC
add_generic_device("omap-hsmmc", -1, NULL, OMAP_MMC1_BASE, SZ_4K,
add_generic_device("omap-hsmmc", DEVICE_ID_DYNAMIC, NULL, OMAP_MMC1_BASE, SZ_4K,
IORESOURCE_MEM, NULL);
#endif
armlinux_set_bootparams((void *)0x80000100);

View File

@ -38,8 +38,8 @@ static struct NS16550_plat serial_plat = {
static int panda_console_init(void)
{
/* Register the serial port */
add_ns16550_device(-1, OMAP44XX_UART3_BASE, 1024, IORESOURCE_MEM_8BIT,
&serial_plat);
add_ns16550_device(DEVICE_ID_DYNAMIC, OMAP44XX_UART3_BASE, 1024,
IORESOURCE_MEM_8BIT, &serial_plat);
return 0;
}
@ -133,7 +133,7 @@ static int panda_devices_init(void)
sr32(OMAP44XX_SCRM_ALTCLKSRC, 2, 2, 0x3);
}
add_generic_device("omap-hsmmc", -1, NULL, 0x4809C100, SZ_4K,
add_generic_device("omap-hsmmc", DEVICE_ID_DYNAMIC, NULL, 0x4809C100, SZ_4K,
IORESOURCE_MEM, NULL);
panda_ehci_init();

View File

@ -154,11 +154,11 @@ static int pcm027_devices_init(void)
{
void *cfi_iospace;
add_generic_device("smc91c111", -1, NULL, 0x14000300, 16,
add_generic_device("smc91c111", DEVICE_ID_DYNAMIC, NULL, 0x14000300, 16,
IORESOURCE_MEM, NULL);
cfi_iospace = map_io_sections(0x0, (void *)0xe0000000, SZ_32M);
add_cfi_flash_device(-1, (unsigned long)cfi_iospace, SZ_32M, 0);
add_cfi_flash_device(DEVICE_ID_DYNAMIC, (unsigned long)cfi_iospace, SZ_32M, 0);
pxa_add_fb((void *)0x44000000, &fb_pdata);

View File

@ -188,7 +188,7 @@ static int imx31_devices_init(void)
* Up to 32MiB NOR type flash, connected to
* CS line 0, data width is 16 bit
*/
add_cfi_flash_device(-1, IMX_CS0_BASE, 32 * 1024 * 1024, 0);
add_cfi_flash_device(DEVICE_ID_DYNAMIC, IMX_CS0_BASE, 32 * 1024 * 1024, 0);
/*
* Create partitions that should be
@ -212,13 +212,13 @@ static int imx31_devices_init(void)
* connected to CS line 1 and interrupt line
* GPIO3, data width is 16 bit
*/
add_generic_device("smc911x", -1, NULL, IMX_CS1_BASE, IMX_CS1_RANGE,
IORESOURCE_MEM, NULL);
add_generic_device("smc911x", DEVICE_ID_DYNAMIC, NULL, IMX_CS1_BASE,
IMX_CS1_RANGE, IORESOURCE_MEM, NULL);
#ifdef CONFIG_USB
pcm037_usb_init();
add_generic_usb_ehci_device(-1, IMX_OTG_BASE, NULL);
add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
add_generic_usb_ehci_device(DEVICE_ID_DYNAMIC, IMX_OTG_BASE, NULL);
add_generic_usb_ehci_device(DEVICE_ID_DYNAMIC, IMX_OTG_BASE + 0x400, NULL);
#endif
armlinux_set_bootparams((void *)0x80000100);

View File

@ -50,7 +50,8 @@ static struct NS16550_plat serial_plat = {
static int pcm049_console_init(void)
{
/* Register the serial port */
add_ns16550_device(-1, OMAP44XX_UART3_BASE, 1024, IORESOURCE_MEM_8BIT, &serial_plat);
add_ns16550_device(DEVICE_ID_DYNAMIC, OMAP44XX_UART3_BASE, 1024,
IORESOURCE_MEM_8BIT, &serial_plat);
return 0;
}
@ -83,7 +84,7 @@ static void pcm049_network_init(void)
{
gpmc_cs_config(5, &net_cfg);
add_generic_device("smc911x", -1, NULL, 0x2C000000, 0x4000,
add_generic_device("smc911x", DEVICE_ID_DYNAMIC, NULL, 0x2C000000, 0x4000,
IORESOURCE_MEM, NULL);
}
@ -96,10 +97,10 @@ static struct i2c_board_info i2c_devices[] = {
static int pcm049_devices_init(void)
{
i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
add_generic_device("i2c-omap", -1, NULL, 0x48070000, 0x1000,
add_generic_device("i2c-omap", DEVICE_ID_DYNAMIC, NULL, 0x48070000, 0x1000,
IORESOURCE_MEM, NULL);
add_generic_device("omap-hsmmc", -1, NULL, 0x4809C100, SZ_4K,
add_generic_device("omap-hsmmc", DEVICE_ID_DYNAMIC, NULL, 0x4809C100, SZ_4K,
IORESOURCE_MEM, NULL);
gpmc_generic_init(0x10);

View File

@ -311,13 +311,13 @@ struct omap_hsmmc_platform_data pcaal1_hsmmc_plat = {
static int pcaal1_init_devices(void)
{
#ifdef CONFIG_MCI_OMAP_HSMMC
add_generic_device("omap-hsmmc", -1, NULL, OMAP_MMC1_BASE, SZ_4K,
add_generic_device("omap-hsmmc", DEVICE_ID_DYNAMIC, NULL, OMAP_MMC1_BASE, SZ_4K,
IORESOURCE_MEM, &pcaal1_hsmmc_plat);
#endif
#ifdef CONFIG_DRIVER_NET_SMC911X
pcaal1_setup_net_chip();
add_generic_device("smc911x", -1, NULL, SMC911X_BASE, SZ_4K,
add_generic_device("smc911x", DEVICE_ID_DYNAMIC, NULL, SMC911X_BASE, SZ_4K,
IORESOURCE_MEM, NULL);
#endif

View File

@ -109,7 +109,7 @@ static int pcaaxl2_devices_init(void)
u32 value;
i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
add_generic_device("i2c-omap", -1, NULL, 0x48070000, 0x1000,
add_generic_device("i2c-omap", DEVICE_ID_DYNAMIC, NULL, 0x48070000, 0x1000,
IORESOURCE_MEM, NULL);
value = readl(OMAP4_CONTROL_PBIASLITE);
@ -117,7 +117,7 @@ static int pcaaxl2_devices_init(void)
value |= (OMAP4_MMC1_PBIASLITE_PWRDNZ | OMAP4_MMC1_PWRDNZ);
writel(value, OMAP4_CONTROL_PBIASLITE);
add_generic_device("omap-hsmmc", -1, NULL, 0x4809C100, SZ_4K,
add_generic_device("omap-hsmmc", DEVICE_ID_DYNAMIC, NULL, 0x4809C100, SZ_4K,
IORESOURCE_MEM, &mmc_device);
gpmc_generic_init(0x10);

View File

@ -54,8 +54,8 @@ static int vpb_devices_init(void)
devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self");
devfs_add_partition("nor0", 0x40000, 0x20000, PARTITION_FIXED, "env0");
add_generic_device("smc91c111", -1, NULL, VERSATILE_ETH_BASE, 64 * 1024,
IORESOURCE_MEM, NULL);
add_generic_device("smc91c111", DEVICE_ID_DYNAMIC, NULL, VERSATILE_ETH_BASE,
64 * 1024, IORESOURCE_MEM, NULL);
armlinux_set_architecture(MACH_TYPE_VERSATILE_PB);
armlinux_set_bootparams((void *)(0x00000100));

View File

@ -38,8 +38,8 @@ void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data)
if (!data)
return;
add_generic_device("at91_ohci", -1, NULL, AT91RM9200_UHP_BASE, 1024 * 1024,
IORESOURCE_MEM, data);
add_generic_device("at91_ohci", DEVICE_ID_DYNAMIC, NULL, AT91RM9200_UHP_BASE,
1024 * 1024, IORESOURCE_MEM, data);
}
#else
void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data) {}
@ -60,8 +60,8 @@ void __init at91_add_device_udc(struct at91_udc_data *data)
if (data->pullup_pin > 0)
at91_set_gpio_output(data->pullup_pin, 0);
add_generic_device("at91_udc", -1, NULL, AT91RM9200_BASE_UDP, SZ_16K,
IORESOURCE_MEM, data);
add_generic_device("at91_udc", DEVICE_ID_DYNAMIC, NULL, AT91RM9200_BASE_UDP,
SZ_16K, IORESOURCE_MEM, data);
}
#else
void __init at91_add_device_udc(struct at91_udc_data *data) {}

View File

@ -40,8 +40,8 @@ void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data)
if (!data)
return;
add_generic_device("at91_ohci", -1, NULL, AT91SAM9260_UHP_BASE, 1024 * 1024,
IORESOURCE_MEM, data);
add_generic_device("at91_ohci", DEVICE_ID_DYNAMIC, NULL, AT91SAM9260_UHP_BASE,
1024 * 1024, IORESOURCE_MEM, data);
}
#else
void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data) {}
@ -59,8 +59,8 @@ void __init at91_add_device_udc(struct at91_udc_data *data)
at91_set_deglitch(data->vbus_pin, 1);
}
add_generic_device("at91_udc", -1, NULL, AT91SAM9260_BASE_UDP, SZ_16K,
IORESOURCE_MEM, data);
add_generic_device("at91_udc", DEVICE_ID_DYNAMIC, NULL, AT91SAM9260_BASE_UDP,
SZ_16K, IORESOURCE_MEM, data);
}
#else
void __init at91_add_device_udc(struct at91_udc_data *data) {}

View File

@ -43,8 +43,8 @@ void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data)
if (!data)
return;
add_generic_device("at91_ohci", -1, NULL, AT91SAM9261_UHP_BASE, 1024 * 1024,
IORESOURCE_MEM, data);
add_generic_device("at91_ohci", DEVICE_ID_DYNAMIC, NULL, AT91SAM9261_UHP_BASE,
1024 * 1024, IORESOURCE_MEM, data);
}
#else
void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data) {}
@ -62,8 +62,8 @@ void __init at91_add_device_udc(struct at91_udc_data *data)
at91_set_deglitch(data->vbus_pin, 1);
}
add_generic_device("at91_udc", -1, NULL, AT91SAM9261_BASE_UDP, SZ_16K,
IORESOURCE_MEM, data);
add_generic_device("at91_udc", DEVICE_ID_DYNAMIC, NULL, AT91SAM9261_BASE_UDP,
SZ_16K, IORESOURCE_MEM, data);
}
#else
void __init at91_add_device_udc(struct at91_udc_data *data) {}

View File

@ -48,8 +48,8 @@ void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data)
at91_set_gpio_output(data->vbus_pin[i], 0);
}
add_generic_device("at91_ohci", -1, NULL, AT91SAM9263_UHP_BASE, 1024 * 1024,
IORESOURCE_MEM, data);
add_generic_device("at91_ohci", DEVICE_ID_DYNAMIC, NULL, AT91SAM9263_UHP_BASE,
1024 * 1024, IORESOURCE_MEM, data);
}
#else
void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data) {}
@ -67,7 +67,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data)
at91_set_deglitch(data->vbus_pin, 1);
}
add_generic_device("at91_udc", -1, NULL, AT91SAM9263_BASE_UDP, SZ_16K,
add_generic_device("at91_udc", DEVICE_ID_DYNAMIC, NULL, AT91SAM9263_BASE_UDP, SZ_16K,
IORESOURCE_MEM, data);
}
#else
@ -145,7 +145,7 @@ void at91_add_device_nand(struct atmel_nand_data *data)
if (data->det_pin)
at91_set_gpio_input(data->det_pin, 1);
add_generic_device_res("atmel_nand", -1, nand_resources,
add_generic_device_res("atmel_nand", DEVICE_ID_DYNAMIC, nand_resources,
ARRAY_SIZE(nand_resources), data);
}
#else

View File

@ -46,8 +46,8 @@ void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data)
at91_set_gpio_output(data->vbus_pin[i], 0);
}
add_generic_device("at91_ohci", -1, NULL, AT91SAM9G45_OHCI_BASE, 1024 * 1024,
IORESOURCE_MEM, data);
add_generic_device("at91_ohci", DEVICE_ID_DYNAMIC, NULL, AT91SAM9G45_OHCI_BASE,
1024 * 1024, IORESOURCE_MEM, data);
}
#else
void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data) {}
@ -125,7 +125,7 @@ void at91_add_device_nand(struct atmel_nand_data *data)
if (data->det_pin)
at91_set_gpio_input(data->det_pin, 1);
add_generic_device_res("atmel_nand", -1, nand_resources,
add_generic_device_res("atmel_nand", DEVICE_ID_DYNAMIC, nand_resources,
ARRAY_SIZE(nand_resources), data);
}
#else

View File

@ -47,8 +47,8 @@ void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data)
at91_set_gpio_output(data->vbus_pin[i], 0);
}
add_generic_device("at91_ohci", -1, NULL, AT91SAM9X5_OHCI_BASE, SZ_1M,
IORESOURCE_MEM, data);
add_generic_device("at91_ohci", DEVICE_ID_DYNAMIC, NULL, AT91SAM9X5_OHCI_BASE,
SZ_1M, IORESOURCE_MEM, data);
}
#else
void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data) {}

View File

@ -76,7 +76,7 @@ static inline struct device_d *imx51_add_nand(struct imx_nand_platform_data *pda
memcpy(dev->resource, res, sizeof(struct resource) * ARRAY_SIZE(res));
dev->num_resources = ARRAY_SIZE(res);
strcpy(dev->name, "imx_nand");
dev->id = -1;
dev->id = DEVICE_ID_DYNAMIC;
dev->platform_data = pdata;
register_device(dev);

View File

@ -75,7 +75,7 @@ static inline struct device_d *imx53_add_nand(struct imx_nand_platform_data *pda
memcpy(dev->resource, res, sizeof(struct resource) * ARRAY_SIZE(res));
dev->num_resources = ARRAY_SIZE(res);
strcpy(dev->name, "imx_nand");
dev->id = -1;
dev->id = DEVICE_ID_DYNAMIC;
dev->platform_data = pdata;
register_device(dev);

View File

@ -68,8 +68,8 @@ int gpmc_generic_nand_devices_init(int cs, int width,
/* Configure GPMC CS before register */
gpmc_cs_config(nand_plat.cs, nand_cfg);
add_generic_device("gpmc_nand", -1, NULL, OMAP_GPMC_BASE, 1024 * 4,
IORESOURCE_MEM, &nand_plat);
add_generic_device("gpmc_nand", DEVICE_ID_DYNAMIC, NULL, OMAP_GPMC_BASE,
1024 * 4, IORESOURCE_MEM, &nand_plat);
return 0;
}

View File

@ -6,7 +6,7 @@
#include <fs.h>
static int ipe337_devices_init(void) {
add_cfi_flash_device(-1, 0x20000000, 32 * 1024 * 1024, 0);
add_cfi_flash_device(DEVICE_ID_DYNAMIC, 0x20000000, 32 * 1024 * 1024, 0);
add_mem_device("ram0", 0x0, 128 * 1024 * 1024,
IORESOURCE_MEM_WRITEABLE);
@ -16,7 +16,7 @@ static int ipe337_devices_init(void) {
mdelay(100);
*pFIO0_FLAG_S = (1<<12);
add_generic_device("smc911x", -1, NULL, 0x24000000, 4096,
add_generic_device("smc911x", DEVICE_ID_DYNAMIC, NULL, 0x24000000, 4096,
IORESOURCE_MEM, NULL);
devfs_add_partition("nor0", 0x00000, 0x20000, PARTITION_FIXED, "self0");
@ -31,7 +31,7 @@ device_initcall(ipe337_devices_init);
static int blackfin_console_init(void)
{
add_generic_device("blackfin_serial", -1, NULL, 0, 4096,
add_generic_device("blackfin_serial", DEVICE_ID_DYNAMIC, NULL, 0, 4096,
IORESOURCE_MEM, NULL);
return 0;

View File

@ -25,7 +25,7 @@ static struct resource mac_resources[] = {
};
static struct device_d mac_dev = {
.id = -1,
.id = DEVICE_ID_DYNAMIC,
.name = "altera_tse",
.num_resources = ARRAY_SIZE(mac_resources),
.resource = mac_resources,
@ -53,8 +53,8 @@ device_initcall(generic_devices_init);
static int altera_console_init(void)
{
add_generic_device("altera_serial", -1, NULL, NIOS_SOPC_UART_BASE, 0x20,
IORESOURCE_MEM, NULL);
add_generic_device("altera_serial", DEVICE_ID_DYNAMIC, NULL,
NIOS_SOPC_UART_BASE, 0x20, IORESOURCE_MEM, NULL);
return 0;
}

View File

@ -53,9 +53,9 @@ static int devices_init (void)
* what we find later.
*/
mpc5200_setup_cs(MPC5200_BOOTCS, 0xfe000000, SZ_32M, 0x0008fd00);
add_cfi_flash_device(-1, 0xfe000000, 32 * 1024 * 1024, 0);
add_cfi_flash_device(DEVICE_ID_DYNAMIC, 0xfe000000, 32 * 1024 * 1024, 0);
add_generic_device("fec_mpc5xxx", -1, NULL, MPC5XXX_FEC, 0x200,
add_generic_device("fec_mpc5xxx", DEVICE_ID_DYNAMIC, NULL, MPC5XXX_FEC, 0x200,
IORESOURCE_MEM, &fec_info);
ret = stat("/dev/nor0", &s);
@ -72,9 +72,9 @@ device_initcall(devices_init);
static int console_init(void)
{
add_generic_device("mpc5xxx_serial", -1, NULL, MPC5XXX_PSC3, 0x200,
add_generic_device("mpc5xxx_serial", DEVICE_ID_DYNAMIC, NULL, MPC5XXX_PSC3, 0x200,
IORESOURCE_MEM, NULL);
add_generic_device("mpc5xxx_serial", -1, NULL, MPC5XXX_PSC6, 0x200,
add_generic_device("mpc5xxx_serial", DEVICE_ID_DYNAMIC, NULL, MPC5XXX_PSC6, 0x200,
IORESOURCE_MEM, NULL);
return 0;
}

View File

@ -28,7 +28,7 @@
#include <errno.h>
static struct device_d tap_device = {
.id = -1,
.id = DEVICE_ID_DYNAMIC,
.name = "tap",
};

View File

@ -102,7 +102,7 @@ device_initcall(hf_init);
int barebox_register_filedev(struct hf_platform_data *hf)
{
return !add_generic_device("hostfile", -1, NULL, hf->base, hf->size,
return !add_generic_device("hostfile", DEVICE_ID_DYNAMIC, NULL, hf->base, hf->size,
IORESOURCE_MEM, hf);
}

View File

@ -51,7 +51,8 @@ static int devices_init(void)
/* extended memory only */
add_mem_device("ram0", 0x0, bios_get_memsize() << 10,
IORESOURCE_MEM_WRITEABLE);
add_generic_device("biosdrive", -1, NULL, 0, 0, IORESOURCE_MEM, NULL);
add_generic_device("biosdrive", DEVICE_ID_DYNAMIC, NULL, 0, 0, IORESOURCE_MEM,
NULL);
if (pers_env_size != PATCH_AREA_PERS_SIZE_UNUSED) {
rc = devfs_add_partition("biosdisk0",

View File

@ -141,7 +141,7 @@ int console_register(struct console_device *newcdev)
if (initialized == CONSOLE_UNINITIALIZED)
console_init_early();
dev->id = -1;
dev->id = DEVICE_ID_DYNAMIC;
strcpy(dev->name, "cs");
if (newcdev->dev)
dev_add_child(newcdev->dev, dev);

View File

@ -103,7 +103,7 @@ int register_device(struct device_d *new_device)
{
struct driver_d *drv;
if (new_device->id < 0) {
if (new_device->id == DEVICE_ID_DYNAMIC) {
new_device->id = get_free_deviceid(new_device->name);
} else {
if (get_device_by_name_id(new_device->name, new_device->id)) {
@ -302,7 +302,10 @@ const char *dev_id(const struct device_d *dev)
{
static char buf[MAX_DRIVER_NAME + 16];
snprintf(buf, sizeof(buf), FORMAT_DRIVER_NAME_ID, dev->name, dev->id);
if (dev->id != DEVICE_ID_SINGLE)
snprintf(buf, sizeof(buf), FORMAT_DRIVER_NAME_ID, dev->name, dev->id);
else
snprintf(buf, sizeof(buf), "%s", dev->name);
return buf;
}

View File

@ -1515,7 +1515,7 @@ int mci_register(struct mci_host *host)
{
struct device_d *mci_dev = xzalloc(sizeof(struct device_d));
mci_dev->id = -1;
mci_dev->id = DEVICE_ID_DYNAMIC;
strcpy(mci_dev->name, mci_driver.name);
mci_dev->platform_data = host;
dev_add_child(host->hw_dev, mci_dev);

View File

@ -219,7 +219,7 @@ int add_mtd_device(struct mtd_info *mtd, char *devname)
if (!devname)
devname = "mtd";
strcpy(mtd->class_dev.name, devname);
mtd->class_dev.id = -1;
mtd->class_dev.id = DEVICE_ID_DYNAMIC;
register_device(&mtd->class_dev);
mtd->cdev.ops = &mtd_ops;

View File

@ -246,7 +246,7 @@ static struct driver_d miidev_drv = {
int mii_register(struct mii_device *mdev)
{
mdev->dev.priv = mdev;
mdev->dev.id = -1;
mdev->dev.id = DEVICE_ID_DYNAMIC;
strcpy(mdev->dev.name, "miidev");
if (mdev->parent)
dev_add_child(mdev->parent, &mdev->dev);

View File

@ -154,7 +154,7 @@ static struct driver_d arm_dcc_driver = {
};
static struct device_d arm_dcc_device = {
.id = -1,
.id = DEVICE_ID_DYNAMIC,
.name = "arm_dcc",
};

View File

@ -63,7 +63,7 @@ static int at91_ohci_probe(struct device_d *dev)
*/
writel(0, &regs->control);
add_generic_device("ohci", -1, NULL, dev->resource[0].start,
add_generic_device("ohci", DEVICE_ID_DYNAMIC, NULL, dev->resource[0].start,
dev->resource[0].size, IORESOURCE_MEM, NULL);
return 0;

View File

@ -603,7 +603,7 @@ static int tftp_probe(struct device_d *dev)
dev->priv = priv;
string_to_ip(fsdev->backingstore, &priv->server);
priv->server = resolv(fsdev->backingstore);
return 0;
}

View File

@ -126,6 +126,11 @@ struct driver_d {
#define RW_SIZE(x) (x)
#define RW_SIZE_MASK 0x7
/* dynamically assign the next free id */
#define DEVICE_ID_DYNAMIC -1
/* do not use an id (only one device available */
#define DEVICE_ID_SINGLE -2
/* Register devices and drivers.
*/
int register_driver(struct driver_d *);
@ -206,7 +211,7 @@ struct device_d *add_generic_device_res(const char* devname, int id,
static inline struct device_d *add_mem_device(const char *name, resource_size_t start,
resource_size_t size, unsigned int flags)
{
return add_generic_device("mem", -1, name, start, size,
return add_generic_device("mem", DEVICE_ID_DYNAMIC, name, start, size,
IORESOURCE_MEM | flags, NULL);
}

View File

@ -274,16 +274,12 @@ static inline void net_copy_uint32(uint32_t *to, uint32_t *from)
}
/* Convert an IP address to a string */
char *ip_to_string (IPaddr_t x, char *s);
char *ip_to_string (IPaddr_t x);
/* Convert a string to ip address */
int string_to_ip(const char *s, IPaddr_t *ip);
IPaddr_t getenv_ip_dns(const char *name, int dns);
static inline IPaddr_t getenv_ip(const char *name)
{
return getenv_ip_dns(name, 0);
}
IPaddr_t getenv_ip(const char *name);
int setenv_ip(const char *name, IPaddr_t ip);
int string_to_ethaddr(const char *str, char *enetaddr);

View File

@ -74,11 +74,7 @@ IPaddr_t dev_get_param_ip(struct device_d *dev, char *name)
int dev_set_param_ip(struct device_d *dev, char *name, IPaddr_t ip)
{
char ipstr[sizeof("xxx.xxx.xxx.xxx")];
ip_to_string(ip, ipstr);
return dev_set_param(dev, name, ipstr);
return dev_set_param(dev, name, ip_to_string(ip));
}
#endif

View File

@ -170,7 +170,7 @@ struct dhcp_opt dhcp_options[] = {
}, {
.option = 6,
.handle = env_ip_handle,
.barebox_var_name = "nameserver",
.barebox_var_name = "net.nameserver",
}, {
.option = 12,
.handle = env_str_handle,
@ -178,7 +178,7 @@ struct dhcp_opt dhcp_options[] = {
}, {
.option = 15,
.handle = env_str_handle,
.barebox_var_name = "domainname",
.barebox_var_name = "net.domainname",
}, {
.option = 17,
.handle = env_str_handle,
@ -697,9 +697,7 @@ BAREBOX_CMD_START(dhcp)
BAREBOX_CMD_END
BAREBOX_MAGICVAR(bootfile, "bootfile returned from DHCP request");
BAREBOX_MAGICVAR(nameserver, "Nameserver returned from DHCP request");
BAREBOX_MAGICVAR(hostname, "hostname returned from DHCP request");
BAREBOX_MAGICVAR(domainname, "domainname returned from DHCP request");
BAREBOX_MAGICVAR(rootpath, "rootpath returned from DHCP request");
BAREBOX_MAGICVAR(dhcp_vendor_id, "vendor id to send to the DHCP server");
BAREBOX_MAGICVAR(dhcp_client_uuid, "cliend uuid to send to the DHCP server");

View File

@ -77,7 +77,7 @@ static int dns_send(char *name)
header->nauth = 0;
header->nother = 0;
domain = getenv("domainname");
domain = getenv("net.domainname");
if (!strchr(name, '.') && domain && *domain)
fullname = asprintf(".%s.%s.", name, domain);
@ -97,7 +97,7 @@ static int dns_send(char *name)
dotptr = s;
} while (*(dotptr + 1));
*dotptr = 0;
//memory_display(fullname, 0, strlen(fullname), 1);
strcpy(header->data, fullname);
p = header->data + strlen(fullname);
@ -205,11 +205,11 @@ IPaddr_t resolv(char *host)
dns_state = STATE_INIT;
ip = getenv_ip_dns("nameserver", 0);
ip = getenv_ip("net.nameserver");
if (!ip)
return 0;
debug("resolving host %s via nameserver %s\n", host, getenv("nameserver"));
debug("resolving host %s via nameserver %s\n", host, ip_to_string(ip));
dns_con = net_udp_new(ip, DNS_PORT, dns_handler, NULL);
if (IS_ERR(dns_con))

View File

@ -198,7 +198,7 @@ int eth_register(struct eth_device *edev)
}
strcpy(edev->dev.name, "eth");
edev->dev.id = -1;
edev->dev.id = DEVICE_ID_DYNAMIC;
if (edev->parent)
dev_add_child(edev->parent, &edev->dev);

View File

@ -85,8 +85,10 @@ uint16_t net_checksum(unsigned char *ptr, int len)
return xsum & 0xffff;
}
char *ip_to_string (IPaddr_t x, char *s)
char *ip_to_string (IPaddr_t x)
{
static char s[sizeof("xxx.xxx.xxx.xxx")];
x = ntohl (x);
sprintf (s, "%d.%d.%d.%d",
(int) ((x >> 24) & 0xff),
@ -127,7 +129,7 @@ int string_to_ip(const char *s, IPaddr_t *ip)
return 0;
}
IPaddr_t getenv_ip_dns(const char *name, int dns)
IPaddr_t getenv_ip(const char *name)
{
IPaddr_t ip;
const char *var = getenv(name);
@ -138,17 +140,14 @@ IPaddr_t getenv_ip_dns(const char *name, int dns)
if (!string_to_ip(var, &ip))
return ip;
if (!dns)
return 0;
return resolv((char*)var);
}
int setenv_ip(const char *name, IPaddr_t ip)
{
char str[sizeof("xxx.xxx.xxx.xxx")];
const char *str;
ip_to_string(ip, str);
str = ip_to_string(ip);
setenv(name, str);
@ -157,11 +156,7 @@ int setenv_ip(const char *name, IPaddr_t ip)
void print_IPaddr (IPaddr_t x)
{
char tmp[16];
ip_to_string (x, tmp);
puts (tmp);
puts(ip_to_string(x));
}
int string_to_ethaddr(const char *str, char *enetaddr)
@ -668,6 +663,11 @@ out:
return ret;
}
static struct device_d net_device = {
.name = "net",
.id = DEVICE_ID_SINGLE,
};
static int net_init(void)
{
int i;
@ -675,6 +675,10 @@ static int net_init(void)
for (i = 0; i < PKTBUFSRX; i++)
NetRxPackets[i] = net_alloc_packet();
register_device(&net_device);
dev_add_param(&net_device, "nameserver", NULL, NULL, 0);
dev_add_param(&net_device, "domainname", NULL, NULL, 0);
return 0;
}

View File

@ -273,7 +273,6 @@ static void tftp_handler(void *ctx, char *packet, unsigned len)
static int do_tftpb(int argc, char *argv[])
{
char *localfile, *remotefile, *file1, *file2;
char ip1[16];
int opt;
struct stat s;
unsigned long flags;
@ -328,7 +327,7 @@ static int do_tftpb(int argc, char *argv[])
printf("TFTP %s server %s ('%s' -> '%s')\n",
tftp_push ? "to" : "from",
ip_to_string(net_get_serverip(), ip1),
ip_to_string(net_get_serverip()),
file1, file2);
init_progression_bar(tftp_push ? s.st_size : 0);