9
0
Fork 0

Merge branch 'resource' of git://uboot.jcrosoft.org/barebox into next

This commit is contained in:
Sascha Hauer 2011-08-01 14:10:38 +02:00
commit b821d73607
53 changed files with 408 additions and 744 deletions

View File

@ -40,25 +40,6 @@ static struct s3c24x0_nand_platform_data nand_info = {
.nand_timing = CALC_NFCONF_TIMING(A9M2410_TACLS, A9M2410_TWRPH0, A9M2410_TWRPH1)
};
static struct device_d nand_dev = {
.id = -1,
.name = "s3c24x0_nand",
.map_base = S3C24X0_NAND_BASE,
.platform_data = &nand_info,
};
/*
* SMSC 91C111 network controller on the baseboard
* connected to CS line 1 and interrupt line
* GPIO3, data width is 32 bit
*/
static struct device_d network_dev = {
.id = -1,
.name = "smc91c111",
.map_base = CS1_BASE + 0x300,
.size = 16,
};
static int a9m2410_devices_init(void)
{
uint32_t reg;
@ -141,10 +122,17 @@ static int a9m2410_devices_init(void)
writel(reg, MISCCR);
/* ----------- the devices the boot loader should work with -------- */
register_device(&nand_dev);
add_generic_device("s3c24x0_nand", -1, NULL, S3C24X0_NAND_BASE, 0,
IORESOURCE_MEM, &nand_info);
sdram_dev = add_mem_device("ram0", CS6_BASE, size,
IORESOURCE_MEM_WRITEABLE);
register_device(&network_dev);
/*
* 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, CS1_BASE + 0x300, 16,
IORESOURCE_MEM, NULL);
#ifdef CONFIG_NAND
/* ----------- add some vital partitions -------- */
@ -171,16 +159,10 @@ void __bare_init nand_boot(void)
}
#endif
static struct device_d a9m2410_serial_device = {
.id = -1,
.name = "s3c24x0_serial",
.map_base = UART1_BASE,
.size = UART1_SIZE,
};
static int a9m2410_console_init(void)
{
register_device(&a9m2410_serial_device);
add_generic_device("s3c24x0_serial", -1, NULL, UART1_BASE, UART1_SIZE,
IORESOURCE_MEM, NULL);
return 0;
}

View File

@ -42,25 +42,6 @@ static struct s3c24x0_nand_platform_data nand_info = {
.nand_timing = CALC_NFCONF_TIMING(A9M2440_TACLS, A9M2440_TWRPH0, A9M2440_TWRPH1)
};
static struct device_d nand_dev = {
.id = -1,
.name = "s3c24x0_nand",
.map_base = S3C24X0_NAND_BASE,
.platform_data = &nand_info,
};
/*
* cs8900 network controller onboard
* Connected to CS line 5 + A24 and interrupt line EINT9,
* data width is 16 bit
*/
static struct device_d network_dev = {
.id = -1,
.name = "cs8900",
.map_base = CS5_BASE + (1 << 24) + 0x300,
.size = 16,
};
static int a9m2440_check_for_ram(uint32_t addr)
{
uint32_t tmp1, tmp2;
@ -145,10 +126,17 @@ static int a9m2440_devices_init(void)
writel(reg, MISCCR);
/* ----------- the devices the boot loader should work with -------- */
register_device(&nand_dev);
add_generic_device("s3c24x0_nand", -1, NULL, S3C24X0_NAND_BASE, 0,
IORESOURCE_MEM, &nand_info);
sdram_dev = add_mem_device("ram0", CS6_BASE, s3c24x0_get_memory_size(),
IORESOURCE_MEM_WRITEABLE);
register_device(&network_dev);
/*
* 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, CS5_BASE + (1 << 24) + 0x300, 16,
IORESOURCE_MEM, NULL);
#ifdef CONFIG_NAND
/* ----------- add some vital partitions -------- */
@ -174,16 +162,10 @@ void __bare_init nand_boot(void)
}
#endif
static struct device_d a9m2440_serial_device = {
.id = -1,
.name = "s3c24x0_serial",
.map_base = UART1_BASE,
.size = UART1_SIZE,
};
static int a9m2440_console_init(void)
{
register_device(&a9m2440_serial_device);
add_generic_device("s3c24x0_serial", -1, NULL, UART1_BASE, UART1_SIZE,
IORESOURCE_MEM, NULL);
return 0;
}

View File

@ -89,31 +89,9 @@ static void ek_add_device_nand(void)
*/
#if defined(CONFIG_DRIVER_NET_DM9000)
static struct dm9000_platform_data dm9000_data = {
.buswidth = DM9000_WIDTH_16,
.srom = 0,
};
static struct resource dm9000_resources[] = {
[0] = {
.start = AT91_CHIPSELECT_2,
.size = 4,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = AT91_CHIPSELECT_2 + 4,
.size = 4,
.flags = IORESOURCE_MEM,
},
};
static struct device_d dm9000_dev = {
.id = 0,
.name = "dm9000",
.num_resources = ARRAY_SIZE(dm9000_resources),
.resource = dm9000_resources,
.platform_data = &dm9000_data,
};
/*
* SMC timings for the DM9000.
* Note: These timings were calculated for MASTER_CLOCK = 100000000 according to the DM9000 timings.
@ -147,7 +125,8 @@ static void __init ek_add_device_dm9000(void)
/* Configure Interrupt pin as input, no pull-up */
at91_set_gpio_input(AT91_PIN_PC11, 0);
register_device(&dm9000_dev);
add_dm9000_device(0, AT91_CHIPSELECT_2, AT91_CHIPSELECT_2 + 4,
IORESOURCE_MEM_16BIT, &dm9000_data);
}
#else
static void __init ek_add_device_dm9000(void) {}

View File

@ -39,12 +39,6 @@ static struct mxs_mci_platform_data mci_pdata = {
.voltages = MMC_VDD_32_33 | MMC_VDD_33_34, /* fixed to 3.3 V */
};
static struct device_d mci_dev = {
.name = "mxs_mci",
.map_base = IMX_SSP1_BASE,
.platform_data = &mci_pdata,
};
#define GPIO_LCD_RESET 50
#define GPIO_LCD_BACKLIGHT 60
@ -98,13 +92,6 @@ static struct imx_fb_platformdata fb_mode = {
.fixed_screen_size = MAX_FB_SIZE,
};
static struct device_d ldcif_dev = {
.name = "stmfb",
.map_base = IMX_FB_BASE,
.size = 4096,
.platform_data = &fb_mode,
};
static const uint32_t pad_setup[] = {
/* may be not required as already done by the bootlet code */
#if 0
@ -327,20 +314,6 @@ static int register_persistant_environment(void)
return devfs_add_partition("disk0.1", 0, cdev->size, DEVFS_PARTITION_FIXED, "env0");
}
static struct ehci_platform_data chumby_usb_pdata = {
.flags = EHCI_HAS_TT,
.hccr_offset = 0x100,
.hcor_offset = 0x140,
};
static struct device_d usb_dev = {
.name = "ehci",
.id = -1,
.map_base = IMX_USB_BASE,
.size = 0x200,
.platform_data = &chumby_usb_pdata,
};
#define GPIO_USB_HUB_RESET 29
#define GPIO_USB_HUB_POWER 26
@ -353,7 +326,8 @@ static void falconwing_init_usb(void)
gpio_direction_output(GPIO_USB_HUB_RESET, 1);
imx_usb_phy_enable();
register_device(&usb_dev);
add_generic_usb_ehci_device(-1, IMX_USB_BASE, NULL);
}
static int falconwing_devices_init(void)
@ -370,8 +344,10 @@ static int falconwing_devices_init(void)
imx_set_ioclk(480000000); /* enable IOCLK to run at the PLL frequency */
/* run the SSP unit clock at 100,000 kHz */
imx_set_sspclk(0, 100000000, 1);
register_device(&mci_dev);
register_device(&ldcif_dev);
add_generic_device("mxs_mci", 0, NULL, IMX_SSP1_BASE, 0,
IORESOURCE_MEM, &mci_pdata);
add_generic_device("stmfb", 0, NULL, IMX_FB_BASE, 4096,
IORESOURCE_MEM, &fb_mode);
falconwing_init_usb();
@ -388,15 +364,12 @@ static int falconwing_devices_init(void)
device_initcall(falconwing_devices_init);
static struct device_d falconwing_serial_device = {
.name = "stm_serial",
.map_base = IMX_DBGUART_BASE,
.size = 8192,
};
static int falconwing_console_init(void)
{
return register_device(&falconwing_serial_device);
add_generic_device("stm_serial", 0, NULL, IMX_DBGUART_BASE, 8192,
IORESOURCE_MEM, NULL);
return 0;
}
console_initcall(falconwing_console_init);

View File

@ -34,15 +34,6 @@
#define DEVCFG_U1EN (1 << 18)
/*
* Up to 32MiB NOR type flash, connected to
* CS line 6, data width is 16 bit
*/
static struct device_d eth_dev = {
.id = -1,
.name = "ep93xx_eth",
};
static int ep93xx_devices_init(void)
{
struct device_d *sdram_dev;
@ -81,7 +72,11 @@ static int ep93xx_devices_init(void)
armlinux_add_dram(sdram_dev);
#endif
register_device(&eth_dev);
/*
* 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);
armlinux_set_bootparams((void *)CONFIG_EP93XX_SDRAM_BANK0_BASE + 0x100);
@ -92,13 +87,6 @@ static int ep93xx_devices_init(void)
device_initcall(ep93xx_devices_init);
static struct device_d edb93xx_serial_device = {
.id = -1,
.name = "pl010_serial",
.map_base = UART1_BASE,
.size = 4096,
};
static int edb93xx_console_init(void)
{
struct syscon_regs *syscon = (struct syscon_regs *)SYSCON_BASE;
@ -117,7 +105,8 @@ static int edb93xx_console_init(void)
writel(0xAA, &syscon->sysswlock);
writel(value, &syscon->devicecfg);
register_device(&edb93xx_serial_device);
add_generic_device("pl010_serial", -1, NULL, UART1_BASE, 4096,
IORESOURCE_MEM, NULL);
return 0;
}

View File

@ -149,12 +149,6 @@ static void imx25_usb_init(void)
writel(tmp | 0x3, IMX_OTG_BASE + 0x5a8);
}
static struct device_d usbh2_dev = {
.id = -1,
.name = "ehci",
.map_base = IMX_OTG_BASE + 0x400,
.size = 0x200,
};
#endif
static struct fsl_usb2_platform_data usb_pdata = {
@ -162,13 +156,6 @@ static struct fsl_usb2_platform_data usb_pdata = {
.phy_mode = FSL_USB2_PHY_UTMI,
};
static struct device_d usbotg_dev = {
.name = "fsl-udc",
.map_base = IMX_OTG_BASE,
.size = 0x200,
.platform_data = &usb_pdata,
};
#ifdef CONFIG_MMU
static void eukrea_cpuimx25_mmu_init(void)
{
@ -284,9 +271,10 @@ static int eukrea_cpuimx25_devices_init(void)
#ifdef CONFIG_USB
imx25_usb_init();
register_device(&usbh2_dev);
add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
#endif
register_device(&usbotg_dev);
add_generic_device("fsl-udc", -1, NULL, IMX_OTG_BASE, 0x200,
IORESOURCE_MEM, &usb_pdata);
armlinux_set_bootparams((void *)0x80000100);
armlinux_set_architecture(MACH_TYPE_EUKREA_CPUIMX25);

View File

@ -66,28 +66,9 @@ struct imx_nand_platform_data nand_info = {
};
#ifdef CONFIG_DRIVER_SERIAL_NS16550
unsigned int quad_uart_read(unsigned long base, unsigned char reg_idx)
{
unsigned int reg_addr = (unsigned int)base;
reg_addr += reg_idx << 1;
return 0xff & readw(reg_addr);
}
EXPORT_SYMBOL(quad_uart_read);
void quad_uart_write(unsigned int val, unsigned long base,
unsigned char reg_idx)
{
unsigned int reg_addr = (unsigned int)base;
reg_addr += reg_idx << 1;
writew(0xff & val, reg_addr);
}
EXPORT_SYMBOL(quad_uart_write);
static struct NS16550_plat quad_uart_serial_plat = {
.clock = 14745600,
.f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR,
.reg_read = quad_uart_read,
.reg_write = quad_uart_write,
.shift = 1,
};
#ifdef CONFIG_EUKREA_CPUIMX27_QUART1
@ -99,7 +80,6 @@ static struct NS16550_plat quad_uart_serial_plat = {
#elif defined CONFIG_EUKREA_CPUIMX27_QUART4
#define QUART_OFFSET 0x1000000
#endif
#endif
static struct i2c_board_info i2c_devices[] = {
@ -150,14 +130,6 @@ static struct imx_fb_platform_data eukrea_cpuimx27_fb_data = {
.lscr1 = 0x00120300,
.dmacr = 0x00020010,
};
static struct device_d imxfb_dev = {
.id = -1,
.name = "imxfb",
.map_base = 0x10021000,
.size = 0x1000,
.platform_data = &eukrea_cpuimx27_fb_data,
};
#endif
static int eukrea_cpuimx27_devices_init(void)
@ -253,7 +225,7 @@ static int eukrea_cpuimx27_devices_init(void)
printf("Using environment in %s Flash\n", envdev);
#ifdef CONFIG_DRIVER_VIDEO_IMX
register_device(&imxfb_dev);
imx_add_fb((void *)0x10021000, &eukrea_cpuimx27_fb_data);
gpio_direction_output(GPIO_PORTE | 5, 0);
gpio_set_value(GPIO_PORTE | 5, 1);
gpio_direction_output(GPIO_PORTA | 25, 0);
@ -268,19 +240,10 @@ static int eukrea_cpuimx27_devices_init(void)
device_initcall(eukrea_cpuimx27_devices_init);
#ifdef CONFIG_DRIVER_SERIAL_IMX
static struct device_d eukrea_cpuimx27_serial_device = {
.id = -1,
.name = "imx_serial",
.map_base = IMX_UART1_BASE,
.size = 4096,
};
#endif
static int eukrea_cpuimx27_console_init(void)
{
#ifdef CONFIG_DRIVER_SERIAL_IMX
register_device(&eukrea_cpuimx27_serial_device);
imx_add_uart((void *)IMX_UART1_BASE, -1);
#endif
/* configure 8 bit UART on cs3 */
FMCR &= ~0x2;
@ -289,7 +252,7 @@ static int eukrea_cpuimx27_console_init(void)
CS3A = 0x00D20000;
#ifdef CONFIG_DRIVER_SERIAL_NS16550
add_ns16550_device(-1, IMX_CS3_BASE + QUART_OFFSET, 0xf,
&quad_uart_serial_plat);
IORESOURCE_MEM_16BIT, &quad_uart_serial_plat);
#endif
return 0;
}

View File

@ -117,26 +117,14 @@ static void imx35_usb_init(void)
tmp = readl(IMX_OTG_BASE + 0x5a8);
writel(tmp | 0x3, IMX_OTG_BASE + 0x5a8);
}
static struct device_d usbh2_dev = {
.id = -1,
.name = "ehci",
.map_base = IMX_OTG_BASE + 0x400,
.size = 0x200,
};
#endif
#ifdef CONFIG_USB_GADGET
static struct fsl_usb2_platform_data usb_pdata = {
.operating_mode = FSL_USB2_DR_DEVICE,
.phy_mode = FSL_USB2_PHY_UTMI,
};
static struct device_d usbotg_dev = {
.name = "fsl-udc",
.map_base = IMX_OTG_BASE,
.size = 0x200,
.platform_data = &usb_pdata,
};
#endif
#ifdef CONFIG_MMU
static int eukrea_cpuimx35_mmu_init(void)
@ -181,13 +169,14 @@ static int eukrea_cpuimx35_devices_init(void)
#ifdef CONFIG_USB
imx35_usb_init();
register_device(&usbh2_dev);
add_generic_usb_ehci_device(-1, 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);
register_device(&usbotg_dev);
add_generic_device("fsl-udc", -1, NULL, IMX_OTG_BASE, 0x200,
IORESOURCE_MEM, &usb_pdata);
#endif
armlinux_set_bootparams((void *)0x80000100);
armlinux_set_architecture(MACH_TYPE_EUKREA_CPUIMX35);

View File

@ -40,15 +40,12 @@ static int mx23_evk_devices_init(void)
device_initcall(mx23_evk_devices_init);
static struct device_d mx23_evk_serial_device = {
.name = "stm_serial",
.map_base = IMX_DBGUART_BASE,
.size = 8192,
};
static int mx23_evk_console_init(void)
{
return register_device(&mx23_evk_serial_device);
add_generic_device("stm_serial", 0, NULL, IMX_DBGUART_BASE, 8192,
IORESOURCE_MEM, NULL);
return 0;
}
console_initcall(mx23_evk_console_init);

View File

@ -138,13 +138,6 @@ static void imx25_usb_init(void)
tmp = readl(IMX_OTG_BASE + 0x5a8);
writel(tmp | 0x3, IMX_OTG_BASE + 0x5a8);
}
static struct device_d usbh2_dev = {
.id = -1,
.name = "ehci",
.map_base = IMX_OTG_BASE + 0x400,
.size = 0x200,
};
#endif
static struct i2c_board_info i2c_devices[] = {
@ -208,7 +201,7 @@ static int imx25_devices_init(void)
* the CPLD has to be initialized.
*/
imx25_usb_init();
register_device(&usbh2_dev);
add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
#endif
imx25_iim_register_fec_ethaddr();

View File

@ -114,14 +114,6 @@ static struct imx_fb_platform_data neso_fb_data = {
};
#ifdef CONFIG_USB
static struct device_d usbh2_dev = {
.id = -1,
.name = "ehci",
.map_base = IMX_OTG_BASE + 0x400,
.size = 0x200,
};
static void neso_usbh_init(void)
{
uint32_t temp;
@ -304,7 +296,7 @@ static int neso_devices_init(void)
#ifdef CONFIG_USB
neso_usbh_init();
register_device(&usbh2_dev);
add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
#endif
imx27_add_fec(&fec_info);

View File

@ -35,24 +35,12 @@ static struct mxs_mci_platform_data mci_pdata = {
.f_max = 25000000,
};
static struct device_d mci_socket = {
.name = "mxs_mci",
.map_base = IMX_SSP0_BASE,
.platform_data = &mci_pdata,
};
/* PhyAD[0..2]=0, RMIISEL=1 */
static struct fec_platform_data fec_info = {
.xcv_type = RMII,
.phy_addr = 0,
};
static struct device_d fec_dev = {
.name = "fec_imx",
.map_base = IMX_FEC0_BASE,
.platform_data = &fec_info,
};
/*
* The TX28 EVK comes with a VGA connector. We can support many video modes
*
@ -215,13 +203,6 @@ static struct imx_fb_platformdata tx28_fb_pdata = {
.enable = tx28_fb_enable,
};
static struct device_d ldcif_dev = {
.name = "stmfb",
.map_base = IMX_FB_BASE,
.size = 4096,
.platform_data = &tx28_fb_pdata,
};
static const uint32_t tx28_starterkit_pad_setup[] = {
/*
* Part II of phy's initialization
@ -378,17 +359,20 @@ void base_board_init(void)
/* run the SSP unit clock at 100 MHz */
imx_set_sspclk(0, 100000000, 1);
register_device(&mci_socket);
add_generic_device("mxs_mci", 0, NULL, IMX_SSP0_BASE, 0,
IORESOURCE_MEM, &mci_pdata);
if (tx28_fb_pdata.fixed_screen < (void *)&_end) {
printf("Warning: fixed_screen overlaps barebox\n");
tx28_fb_pdata.fixed_screen = NULL;
}
register_device(&ldcif_dev);
add_generic_device("stmfb", 0, NULL, IMX_FB_BASE, 4096,
IORESOURCE_MEM, &tx28_fb_pdata);
imx_enable_enetclk();
register_device(&fec_dev);
add_generic_device("fec_imx", 0, NULL, IMX_FEC0_BASE, 0,
IORESOURCE_MEM, &fec_info);
ret = register_persistent_environment();
if (ret != 0)
@ -396,15 +380,12 @@ void base_board_init(void)
"storage (%d)\n", ret);
}
static struct device_d tx28kit_serial_device = {
.name = "stm_serial",
.map_base = IMX_DBGUART_BASE,
.size = 8192,
};
static int tx28kit_console_init(void)
{
return register_device(&tx28kit_serial_device);
add_generic_device("stm_serial", 0, NULL, IMX_DBGUART_BASE, 8192,
IORESOURCE_MEM, NULL);
return 0;
}
console_initcall(tx28kit_console_init);

View File

@ -49,12 +49,6 @@ static struct s3c24x0_nand_platform_data nand_info = {
.flash_bbt = 1, /* same as the kernel */
};
static struct device_d nand_dev = {
.name = "s3c24x0_nand",
.map_base = S3C24X0_NAND_BASE,
.platform_data = &nand_info,
};
/*
* dm9000 network controller onboard
* Connected to CS line 4 and interrupt line EINT7,
@ -63,30 +57,9 @@ static struct device_d nand_dev = {
* Area 2: Offset 0x304...0x307
*/
static struct dm9000_platform_data dm9000_data = {
.buswidth = DM9000_WIDTH_16,
.srom = 1,
};
static struct resource dm9000_resources[] = {
[0] = {
.start = CS4_BASE + 0x300,
.size = 4,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = CS4_BASE + 0x304,
.size = 4,
.flags = IORESOURCE_MEM,
},
};
static struct device_d dm9000_dev = {
.name = "dm9000",
.num_resources = ARRAY_SIZE(dm9000_resources),
.resource = dm9000_resources,
.platform_data = &dm9000_data,
};
static struct s3c_mci_platform_data mci_data = {
.caps = MMC_MODE_4BIT | MMC_MODE_HS | MMC_MODE_HS_52MHz,
.voltages = MMC_VDD_32_33 | MMC_VDD_33_34,
@ -94,12 +67,6 @@ static struct s3c_mci_platform_data mci_data = {
.detect_invert = 0,
};
static struct device_d mci_dev = {
.name = "s3c_mci",
.map_base = S3C2410_SDI_BASE,
.platform_data = &mci_data,
};
static struct fb_videomode s3c24x0_fb_modes[] = {
#ifdef CONFIG_MINI2440_VIDEO_N35
{
@ -165,12 +132,6 @@ static struct s3c_fb_platform_data s3c24x0_fb_data = {
.passive_display = 0,
};
static struct device_d s3cfb_dev = {
.name = "s3c_fb",
.map_base = S3C2410_LCD_BASE,
.platform_data = &s3c24x0_fb_data,
};
static const unsigned pin_usage[] = {
/* address bus, used by NOR, SDRAM */
GPA1_ADDR16,
@ -326,13 +287,15 @@ static int mini2440_devices_init(void)
reg |= 0x10000;
writel(reg, MISCCR);
register_device(&nand_dev);
add_generic_device("s3c24x0_nand", -1, NULL, S3C24X0_NAND_BASE, 0,
IORESOURCE_MEM, &nand_info);
sdram_dev = add_mem_device("ram0", CS6_BASE, s3c24x0_get_memory_size(),
IORESOURCE_MEM_WRITEABLE);
armlinux_add_dram(sdram_dev);
register_device(&dm9000_dev);
add_dm9000_device(0, CS4_BASE + 0x300, CS4_BASE + 0x304,
IORESOURCE_MEM_16BIT, &dm9000_data);
#ifdef CONFIG_NAND
/* ----------- add some vital partitions -------- */
devfs_del_partition("self_raw");
@ -343,8 +306,10 @@ static int mini2440_devices_init(void)
devfs_add_partition("nand0", 0x40000, 0x20000, PARTITION_FIXED, "env_raw");
dev_add_bb_dev("env_raw", "env0");
#endif
register_device(&mci_dev);
register_device(&s3cfb_dev);
add_generic_device("s3c_mci", 0, NULL, S3C2410_SDI_BASE, 0,
IORESOURCE_MEM, &mci_data);
add_generic_device("s3c_fb", 0, NULL, S3C2410_LCD_BASE, 0,
IORESOURCE_MEM, &s3c24x0_fb_data);
armlinux_set_bootparams(dev_get_mem_region(sdram_dev, 0) + 0x100);
armlinux_set_architecture(MACH_TYPE_MINI2440);
@ -360,12 +325,6 @@ void __bare_init nand_boot(void)
}
#endif
static struct device_d mini2440_serial_device = {
.name = "s3c24x0_serial",
.map_base = UART1_BASE,
.size = UART1_SIZE,
};
static int mini2440_console_init(void)
{
/*
@ -377,7 +336,8 @@ static int mini2440_console_init(void)
s3c_gpio_mode(GPH2_TXD0);
s3c_gpio_mode(GPH3_RXD0);
register_device(&mini2440_serial_device);
add_generic_device("s3c24x0_serial", -1, NULL, UART1_BASE, UART1_SIZE,
IORESOURCE_MEM, NULL);
return 0;
}

View File

@ -34,22 +34,10 @@ struct netx_eth_platform_data eth0_data = {
.xcno = 0,
};
static struct device_d netx_eth_dev0 = {
.id = -1,
.name = "netx-eth",
.platform_data = &eth0_data,
};
struct netx_eth_platform_data eth1_data = {
.xcno = 1,
};
static struct device_d netx_eth_dev1 = {
.id = -1,
.name = "netx-eth",
.platform_data = &eth1_data,
};
static int netx_devices_init(void) {
struct device_d *sdram_dev;
@ -58,8 +46,8 @@ static int netx_devices_init(void) {
sdram_dev = add_mem_device("ram0", 0x80000000, 64 * 1024 * 1024,
IORESOURCE_MEM_WRITEABLE);
armlinux_add_dram(sdram_dev);
register_device(&netx_eth_dev0);
register_device(&netx_eth_dev1);
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);
devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self0");
@ -76,13 +64,6 @@ static int netx_devices_init(void) {
device_initcall(netx_devices_init);
static struct device_d netx_serial_device = {
.id = -1,
.name = "netx_serial",
.map_base = NETX_PA_UART0,
.size = 0x40,
};
static int netx_console_init(void)
{
/* configure gpio for serial */
@ -91,7 +72,8 @@ static int netx_console_init(void)
*(volatile unsigned long *)(0x00100808) = 2;
*(volatile unsigned long *)(0x0010080c) = 2;
register_device(&netx_serial_device);
add_generic_device("netx_serial", -1, NULL, NETX_PA_UART0, 0x40,
IORESOURCE_MEM, NULL);
return 0;
}

View File

@ -237,9 +237,6 @@ void board_init(void)
static struct NS16550_plat serial_plat = {
.clock = 48000000, /* 48MHz (APLL96/2) */
.f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR,
.reg_read = omap_uart_read,
.reg_write = omap_uart_write,
};
/**
@ -251,7 +248,8 @@ static struct NS16550_plat serial_plat = {
static int beagle_console_init(void)
{
/* Register the serial port */
add_ns16550_device(-1, OMAP_UART3_BASE, 1024, &serial_plat);
add_ns16550_device(-1, OMAP_UART3_BASE, 1024, IORESOURCE_MEM_8BIT,
&serial_plat);
return 0;
}
@ -271,38 +269,15 @@ static struct omap_hcd omap_ehci_pdata = {
static struct ehci_platform_data ehci_pdata = {
.flags = 0,
.hccr_offset = 0x100,
.hcor_offset = 0x110,
};
static struct device_d usbh_dev = {
.id = -1,
.name = "ehci",
.map_base = 0x48064700,
.size = 4 * 1024,
.platform_data = &ehci_pdata,
};
#endif /* CONFIG_USB_EHCI_OMAP */
static struct device_d i2c_dev = {
.id = -1,
.name = "i2c-omap",
.map_base = OMAP_I2C1_BASE,
};
static struct i2c_board_info i2c_devices[] = {
{
I2C_BOARD_INFO("twl4030", 0x48),
},
};
static struct device_d hsmmc_dev = {
.id = -1,
.name = "omap-hsmmc",
.map_base = 0x4809C000,
.size = SZ_4K,
};
static int beagle_devices_init(void)
{
struct device_d *sdram_dev;
@ -314,11 +289,13 @@ static int beagle_devices_init(void)
armlinux_add_dram(sdram_dev);
i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
register_device(&i2c_dev);
add_generic_device("i2c-omap", -1, NULL, 0x4809C000, SZ_4K,
IORESOURCE_MEM, NULL);
#ifdef CONFIG_USB_EHCI_OMAP
if (ehci_omap_init(&omap_ehci_pdata) >= 0)
register_device(&usbh_dev);
add_usb_ehci_device(-1, 0x48064700 + 0x100,
0x48064700 + 0x110, &ehci_pdata);
#endif /* CONFIG_USB_EHCI_OMAP */
#ifdef CONFIG_GPMC
/* WP is made high and WAIT1 active Low */
@ -326,7 +303,8 @@ static int beagle_devices_init(void)
#endif
gpmc_generic_nand_devices_init(0, 16, OMAP_ECC_HAMMING_CODE_HW_ROMCODE);
register_device(&hsmmc_dev);
add_generic_device("omap-hsmmc", -1, NULL, OMAP_I2C1_BASE, 0,
IORESOURCE_MEM, NULL);
armlinux_set_bootparams((void *)0x80000100);
armlinux_set_architecture(MACH_TYPE_OMAP3_BEAGLE);

View File

@ -213,9 +213,6 @@ void board_init(void)
static struct NS16550_plat serial_plat = {
.clock = 48000000, /* 48MHz (APLL96/2) */
.f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR,
.reg_read = omap_uart_read,
.reg_write = omap_uart_write,
};
/**
@ -231,7 +228,7 @@ static int omap3evm_init_console(void)
#elif defined(CONFIG_OMAP3EVM_UART3)
OMAP_UART3_BASE,
#endif
1024, &serial_plat);
1024, IORESOURCE_MEM_8BIT, &serial_plat);
return 0;
}

View File

@ -605,9 +605,6 @@ static void mux_config(void)
static struct NS16550_plat serial_plat = {
.clock = 48000000, /* 48MHz (APLL96/2) */
.f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR,
.reg_read = omap_uart_read,
.reg_write = omap_uart_write,
};
/**
@ -618,7 +615,8 @@ static struct NS16550_plat serial_plat = {
static int sdp3430_console_init(void)
{
/* Register the serial port */
add_ns16550_device(-1, OMAP_UART3_BASE, 1024, &serial_plat);
add_ns16550_device(-1, OMAP_UART3_BASE, 1024, IORESOURCE_MEM_8BIT,
&serial_plat);
return 0;
}
@ -641,7 +639,6 @@ static int sdp3430_flash_init(void)
static int sdp3430_devices_init(void)
{
struct device_d *sdram_dev;
int ret;
sdram_dev = add_mem_device("ram0", 0x80000000, 128 * 1024 * 1024,
IORESOURCE_MEM_WRITEABLE);

View File

@ -32,15 +32,13 @@ static int board_revision;
static struct NS16550_plat serial_plat = {
.clock = 48000000, /* 48MHz (APLL96/2) */
.f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR,
.reg_read = omap_uart_read,
.reg_write = omap_uart_write,
};
static int panda_console_init(void)
{
/* Register the serial port */
add_ns16550_device(-1, OMAP44XX_UART3_BASE, 1024, &serial_plat);
add_ns16550_device(-1, OMAP44XX_UART3_BASE, 1024, IORESOURCE_MEM_8BIT,
&serial_plat);
return 0;
}
@ -61,18 +59,9 @@ static int panda_mmu_init(void)
device_initcall(panda_mmu_init);
#endif
#ifdef CONFIG_USB_EHCI
static struct ehci_platform_data ehci_pdata = {
.flags = 0,
.hccr_offset = 0x0,
.hcor_offset = 0x10,
};
static struct device_d usbh_dev = {
.id = -1,
.name = "ehci",
.map_base = 0x4a064c00,
.size = 4 * 1024,
.platform_data = &ehci_pdata,
};
static void panda_ehci_init(void)
@ -105,8 +94,13 @@ static void panda_ehci_init(void)
/* enable power to hub */
gpio_set_value(GPIO_HUB_POWER, 1);
register_device(&usbh_dev);
add_usb_ehci_device(-1, 0x4a064c00,
0x4a064c00 + 0x10, &ehci_pdata);
}
#else
static void panda_ehci_init(void)
{}
#endif
static void __init panda_boardrev_init(void)
{
@ -117,13 +111,6 @@ static void __init panda_boardrev_init(void)
pr_info("PandaBoard Revision: %03d\n", board_revision);
}
static struct device_d hsmmc_dev = {
.id = -1,
.name = "omap-hsmmc",
.map_base = 0x4809C100,
.size = SZ_4K,
};
static int panda_devices_init(void)
{
struct device_d *sdram_dev;
@ -157,7 +144,8 @@ static int panda_devices_init(void)
sdram_dev = add_mem_device("ram0", 0x80000000, SZ_1G,
IORESOURCE_MEM_WRITEABLE);
armlinux_add_dram(sdram_dev);
register_device(&hsmmc_dev);
add_generic_device("omap-hsmmc", -1, NULL, 0x4809C100, SZ_4K,
IORESOURCE_MEM, NULL);
panda_ehci_init();
armlinux_set_bootparams((void *)0x80000100);

View File

@ -58,20 +58,6 @@ struct imx_nand_platform_data nand_info = {
};
#ifdef CONFIG_USB
static struct device_d usbotg_dev = {
.id = -1,
.name = "ehci",
.map_base = IMX_OTG_BASE,
.size = 0x200,
};
static struct device_d usbh2_dev = {
.id = -1,
.name = "ehci",
.map_base = IMX_OTG_BASE + 0x400,
.size = 0x200,
};
static void pcm037_usb_init(void)
{
u32 tmp;
@ -245,8 +231,8 @@ static int imx31_devices_init(void)
#endif
#ifdef CONFIG_USB
pcm037_usb_init();
register_device(&usbotg_dev);
register_device(&usbh2_dev);
add_generic_usb_ehci_device(-1, IMX_OTG_BASE, NULL);
add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
#endif
armlinux_set_bootparams((void *)0x80000100);

View File

@ -109,13 +109,6 @@ static struct imx_fb_platform_data pcm038_fb_data = {
};
#ifdef CONFIG_USB
static struct device_d usbh2_dev = {
.id = -1,
.name = "ehci",
.map_base = IMX_OTG_BASE + 0x400,
.size = 0x200,
};
static void pcm038_usbh_init(void)
{
uint32_t temp;
@ -271,7 +264,7 @@ static int pcm038_devices_init(void)
#ifdef CONFIG_USB
pcm038_usbh_init();
register_device(&usbh2_dev);
add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
#endif
/* Register the fec device after the PLL re-initialisation

View File

@ -43,15 +43,12 @@
static struct NS16550_plat serial_plat = {
.clock = 48000000, /* 48MHz (APLL96/2) */
.f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR,
.reg_read = omap_uart_read,
.reg_write = omap_uart_write,
};
static int pcm049_console_init(void)
{
/* Register the serial port */
add_ns16550_device(-1, OMAP44XX_UART3_BASE, 1024, &serial_plat);
add_ns16550_device(-1, OMAP44XX_UART3_BASE, 1024, IORESOURCE_MEM_8BIT, &serial_plat);
return 0;
}
@ -73,20 +70,6 @@ static int pcm049_mmu_init(void)
device_initcall(pcm049_mmu_init);
#endif
static struct device_d hsmmc_dev = {
.id = -1,
.name = "omap-hsmmc",
.map_base = 0x4809C100,
.size = SZ_4K,
};
static struct device_d smc911x_dev = {
.id = -1,
.name = "smc911x",
.map_base = 0x2C000000,
.size = 0x4000,
};
static struct gpmc_config net_cfg = {
.cfg = {
0x00001000, /* CONF1 */
@ -104,7 +87,8 @@ static void pcm049_network_init(void)
{
gpmc_cs_config(5, &net_cfg);
register_device(&smc911x_dev);
add_generic_device("smc911x", -1, NULL, 0x2C000000, 0x4000,
IORESOURCE_MEM, NULL);
}
static int pcm049_devices_init(void)
@ -116,7 +100,8 @@ static int pcm049_devices_init(void)
armlinux_add_dram(sdram_dev);
add_mem_device("ram0", 0x40300000, 48 * 1024,
IORESOURCE_MEM_WRITEABLE);
register_device(&hsmmc_dev);
add_generic_device("omap-hsmmc", -1, NULL, 0x4809C100, SZ_4K,
IORESOURCE_MEM, NULL);
gpmc_generic_init(0x10);

View File

@ -53,20 +53,6 @@ struct imx_nand_platform_data nand_info = {
};
#ifdef CONFIG_USB
static struct device_d usbotg_dev = {
.id = -1,
.name = "ehci",
.map_base = IMX_OTG_BASE,
.size = 0x200,
};
static struct device_d usbh2_dev = {
.id = -1,
.name = "ehci",
.map_base = IMX_OTG_BASE + 0x400,
.size = 0x200,
};
static void pca100_usb_register(void)
{
mdelay(10);
@ -77,9 +63,9 @@ static void pca100_usb_register(void)
mdelay(10);
isp1504_set_vbus_power((void *)(IMX_OTG_BASE + 0x170), 1);
register_device(&usbotg_dev);
add_generic_usb_ehci_device(-1, IMX_OTG_BASE, NULL);
isp1504_set_vbus_power((void *)(IMX_OTG_BASE + 0x570), 1);
register_device(&usbh2_dev);
add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
}
#endif

View File

@ -89,31 +89,9 @@ static void pm_add_device_nand(void)
*/
#if defined(CONFIG_DRIVER_NET_DM9000)
static struct dm9000_platform_data dm9000_data = {
.buswidth = DM9000_WIDTH_16,
.srom = 1,
};
static struct resource dm9000_resources[] = {
[0] = {
.start = AT91_CHIPSELECT_2,
.size = 4,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = AT91_CHIPSELECT_2 + 4,
.size = 4,
.flags = IORESOURCE_MEM,
},
};
static struct device_d dm9000_dev = {
.id = 0,
.name = "dm9000",
.num_resources = ARRAY_SIZE(dm9000_resources),
.resource = dm9000_resources,
.platform_data = &dm9000_data,
};
/*
* SMC timings for the DM9000.
* Note: These timings were calculated for MASTER_CLOCK = 100000000 according to the DM9000 timings.
@ -141,7 +119,8 @@ static void __init pm_add_device_dm9000(void)
/* Configure chip-select 2 (DM9000) */
sam9_smc_configure(2, &dm9000_smc_config);
register_device(&dm9000_dev);
add_dm9000_device(0, AT91_CHIPSELECT_2, AT91_CHIPSELECT_2 + 4,
IORESOURCE_MEM_16BIT, &dm9000_data);
}
#else
static void __init ek_add_device_dm9000(void) {}
@ -151,6 +130,7 @@ static int pm9261_devices_init(void)
{
at91_add_device_sdram(64 * 1024 * 1024);
pm_add_device_nand();
pm_add_device_dm9000();
add_cfi_flash_device(0, AT91_CHIPSELECT_0, 4 * 1024 * 1024, 0);
devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self");

View File

@ -35,31 +35,9 @@
#include <mach/devices-imx1.h>
static struct dm9000_platform_data dm9000_data = {
.buswidth = DM9000_WIDTH_16,
.srom = 1,
};
static struct resource dm9000_resources[] = {
[0] = {
.start = 0x16000000,
.size = 4,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = 0x16000004,
.size = 4,
.flags = IORESOURCE_MEM,
},
};
static struct device_d dm9000_dev = {
.id = -1,
.name = "dm9000",
.num_resources = ARRAY_SIZE(dm9000_resources),
.resource = dm9000_resources,
.platform_data = &dm9000_data,
};
struct gpio_led leds[] = {
{
.gpio = 32 + 21,
@ -107,7 +85,8 @@ static int scb9328_devices_init(void)
sdram_dev = add_mem_device("ram0", 0x08000000, 16 * 1024 * 1024,
IORESOURCE_MEM_WRITEABLE);
armlinux_add_dram(sdram_dev);
register_device(&dm9000_dev);
add_dm9000_device(-1, 0x16000000, 0x16000004,
IORESOURCE_MEM_16BIT, &dm9000_data);
devfs_add_partition("nor0", 0x00000, 0x40000, PARTITION_FIXED, "self0");
devfs_add_partition("nor0", 0x40000, 0x20000, PARTITION_FIXED, "env0");

View File

@ -25,4 +25,4 @@ obj-$(CONFIG_ARCH_OMAP3) += omap3_core.o omap3_generic.o
obj-$(CONFIG_ARCH_OMAP4) += omap4_generic.o omap4_clock.o
obj-$(CONFIG_OMAP3_CLOCK_CONFIG) += omap3_clock_core.o omap3_clock.o
obj-$(CONFIG_OMAP_GPMC) += gpmc.o devices-gpmc-nand.o
obj-y += omap-uart.o gpio.o xload.o
obj-y += gpio.o xload.o

View File

@ -70,15 +70,6 @@ static struct gpmc_nand_platform_data nand_plat = {
.priv = (void *)&nand_cfg,
};
/** NAND device definition */
static struct device_d gpmc_generic_nand_nand_device = {
.id = -1,
.name = "gpmc_nand",
.map_base = OMAP_GPMC_BASE,
.size = 1024 * 4, /* GPMC size */
.platform_data = (void *)&nand_plat,
};
/**
* @brief gpmc_generic_nand_devices_init - init generic nand device
*
@ -99,5 +90,9 @@ int gpmc_generic_nand_devices_init(int cs, int width,
/* Configure GPMC CS before register */
gpmc_cs_config(nand_plat.cs, &nand_cfg);
return register_device(&gpmc_generic_nand_nand_device);
add_generic_device("gpmc_nand", -1, NULL, OMAP_GPMC_BASE, 1024 * 4,
IORESOURCE_MEM, &nand_plat);
return 0;
}

View File

@ -57,8 +57,4 @@ static inline void sr32(u32 addr, u32 start_bit, u32 num_bits, u32 value)
u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound);
void sdelay(unsigned long loops);
/** All architectures need to implement these */
void omap_uart_write(unsigned int val, unsigned long base,
unsigned char reg_idx);
unsigned int omap_uart_read(unsigned long base, unsigned char reg_idx);
#endif /* __ASM_ARCH_OMAP_SYSLIB_H_ */

View File

@ -1,36 +0,0 @@
#include <common.h>
#include <asm/io.h>
/**
* @brief Uart port register read function for OMAP3
*
* @param base base address of UART
* @param reg_idx register index
*
* @return character read from register
*/
unsigned int omap_uart_read(unsigned long base, unsigned char reg_idx)
{
unsigned int *reg_addr = (unsigned int *)base;
reg_addr += reg_idx;
return readb(reg_addr);
}
EXPORT_SYMBOL(omap_uart_read);
/**
* @brief Uart port register write function for OMAP3
*
* @param val value to write
* @param base base address of UART
* @param reg_idx register index
*
* @return void
*/
void omap_uart_write(unsigned int val, unsigned long base,
unsigned char reg_idx)
{
unsigned int *reg_addr = (unsigned int *)base;
reg_addr += reg_idx;
writeb(val, reg_addr);
}
EXPORT_SYMBOL(omap_uart_write);

View File

@ -5,13 +5,6 @@
#include <partition.h>
#include <fs.h>
static struct device_d smc911x_dev = {
.id = -1,
.name = "smc911x",
.map_base = 0x24000000,
.size = 4096,
};
static int ipe337_devices_init(void) {
add_cfi_flash_device(-1, 0x20000000, 32 * 1024 * 1024, 0);
add_mem_device("ram0", 0x0, 128 * 1024 * 1024,
@ -23,7 +16,8 @@ static int ipe337_devices_init(void) {
mdelay(100);
*pFIO0_FLAG_S = (1<<12);
register_device(&smc911x_dev);
add_generic_device("smc911x", -1, NULL, 0x24000000, 4096,
IORESOURCE_MEM, NULL);
devfs_add_partition("nor0", 0x00000, 0x20000, PARTITION_FIXED, "self0");
devfs_add_partition("nor0", 0x20000, 0x20000, PARTITION_FIXED, "env0");
@ -35,16 +29,10 @@ static int ipe337_devices_init(void) {
device_initcall(ipe337_devices_init);
static struct device_d blackfin_serial_device = {
.id = -1,
.name = "blackfin_serial",
.map_base = 0,
.size = 4096,
};
static int blackfin_console_init(void)
{
register_device(&blackfin_serial_device);
add_generic_device("blackfin_serial", -1, NULL, 0, 4096,
IORESOURCE_MEM, NULL);
return 0;
}

View File

@ -32,14 +32,6 @@ static struct device_d mac_dev = {
.platform_data = &phy_address,
};
/*
static struct device_d epcs_flash_device = {
.id = -1,
.name = "epcs_flash",
.map_base = NIOS_SOPC_EPCS_BASE,
};
*/
static int generic_devices_init(void)
{
add_cfi_flash_device(-1, NIOS_SOPC_FLASH_BASE, NIOS_SOPC_FLASH_SIZE, 0);

View File

@ -41,19 +41,13 @@ static struct mpc5xxx_fec_platform_data fec_info = {
.xcv_type = MII100,
};
struct device_d eth_dev = {
.id = -1,
.name = "fec_mpc5xxx",
.map_base = MPC5XXX_FEC,
.platform_data = &fec_info,
};
static int devices_init (void)
{
add_cfi_flash_device(-1, 0xff000000, 16 * 1024 * 1024, 0);
add_mem_device("ram0", 0x0, 64 * 1024 * 1024,
IORESOURCE_MEM_WRITEABLE);
register_device(&eth_dev);
add_generic_device("fec_mpc5xxx", -1, NULL, MPC5XXX_FEC, 0,
IORESOURCE_MEM, &fec_info);
devfs_add_partition("nor0", 0x00f00000, 0x40000, PARTITION_FIXED, "self0");
devfs_add_partition("nor0", 0x00f60000, 0x20000, PARTITION_FIXED, "env0");
@ -63,24 +57,12 @@ static int devices_init (void)
device_initcall(devices_init);
static struct device_d psc3 = {
.id = -1,
.name = "mpc5xxx_serial",
.map_base = MPC5XXX_PSC3,
.size = 4096,
};
static struct device_d psc6 = {
.id = -1,
.name = "mpc5xxx_serial",
.map_base = MPC5XXX_PSC6,
.size = 4096,
};
static int console_init(void)
{
register_device(&psc3);
register_device(&psc6);
add_generic_device("mpc5xxx_serial", -1, NULL, MPC5XXX_PSC3, 4096,
IORESOURCE_MEM, NULL);
add_generic_device("mpc5xxx_serial", -1, NULL, MPC5XXX_PSC6, 4096,
IORESOURCE_MEM, NULL);
return 0;
}

View File

@ -102,17 +102,7 @@ device_initcall(hf_init);
int barebox_register_filedev(struct hf_platform_data *hf)
{
struct device_d *dev;
dev = xzalloc(sizeof(struct device_d));
dev->platform_data = hf;
strcpy(dev->name, "hostfile");
dev->size = hf->size;
dev->id = -1;
dev->map_base = hf->map_base;
return register_device(dev);
return !add_generic_device("hostfile", -1, NULL, hf->base, hf->size,
IORESOURCE_MEM, hf);
}

View File

View File

@ -4,7 +4,7 @@
struct hf_platform_data {
int fd;
size_t size;
unsigned long map_base;
unsigned long base;
char *filename;
char *name;
};

View File

@ -236,10 +236,10 @@ static int add_image(char *str, char *name)
hf->name = strdup(name);
if (map) {
hf->map_base = (unsigned long)mmap(NULL, hf->size,
hf->base = (unsigned long)mmap(NULL, hf->size,
PROT_READ | (readonly ? 0 : PROT_WRITE),
MAP_SHARED, fd, 0);
if ((void *)hf->map_base == MAP_FAILED)
if ((void *)hf->base == MAP_FAILED)
printf("warning: mmapping %s failed\n", file);
}

View File

@ -78,7 +78,6 @@ device_initcall(devices_init);
static struct NS16550_plat serial_plat = {
.clock = 1843200,
.f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR,
.reg_read = x86_uart_read,
.reg_write = x86_uart_write,
};
@ -86,7 +85,7 @@ static struct NS16550_plat serial_plat = {
static int pc_console_init(void)
{
/* Register the serial port */
add_ns16550_device(-1, 0x3f8, 8, &serial_plat);
add_ns16550_device(-1, 0x3f8, 8, 0, &serial_plat);
return 0;
}

View File

@ -197,7 +197,7 @@ static int disk_probe(struct device_d *dev)
dev_info(dev, "Drive size guessed to %u kiB\n", dev->size / 1024);
}
#endif
atablk->blk.num_blocks = dev->size / SECTOR_SIZE;
atablk->blk.num_blocks = dev->resource[0].size / SECTOR_SIZE;
atablk->blk.ops = &ataops;
atablk->blk.blockbits = 9;
atablk->dev = dev;

View File

@ -103,26 +103,6 @@ int register_device(struct device_d *new_device)
{
struct driver_d *drv;
/* if no map_base available use the first resource if available
* so we do not need to duplicate it
* Temporary fixup until we get rid of map_base and size
*/
if (new_device->map_base) {
if (new_device->resource) {
dev_err(new_device, "map_base and resource specifed\n");
return -EIO;
}
dev_warn(new_device, "uses map_base. Please convert to use resources\n");
new_device->resource = xzalloc(sizeof(struct resource));
new_device->resource[0].start = new_device->map_base;
new_device->resource[0].size = new_device->size;
new_device->resource[0].flags = IORESOURCE_MEM;
new_device->num_resources = 1;
} else if (new_device->resource) {
new_device->map_base = new_device->resource[0].start;
new_device->size = new_device->resource[0].size;
}
if (new_device->id < 0) {
new_device->id = get_free_deviceid(new_device->name);
} else {
@ -263,7 +243,7 @@ int generic_memmap_ro(struct cdev *cdev, void **map, int flags)
if (flags & PROT_WRITE)
return -EACCES;
*map = (void *)cdev->dev->map_base;
*map = dev_get_mem_region(cdev->dev, 0);
return 0;
}
@ -272,7 +252,7 @@ int generic_memmap_rw(struct cdev *cdev, void **map, int flags)
if (!cdev->dev)
return -EINVAL;
*map = (void *)cdev->dev->map_base;
*map = dev_get_mem_region(cdev->dev, 0);
return 0;
}
@ -339,6 +319,8 @@ static int do_devinfo(struct command *cmdtp, int argc, char *argv[])
struct device_d *dev;
struct driver_d *drv;
struct param_d *param;
int i;
struct resource *res;
if (argc == 1) {
printf("devices:\n");
@ -359,9 +341,17 @@ static int do_devinfo(struct command *cmdtp, int argc, char *argv[])
return -1;
}
printf("base : 0x%08x\nsize : 0x%08x\ndriver: %s\n\n",
dev->map_base, dev->size,
dev->driver ?
printf("resources:\n");
for (i = 0; i < dev->num_resources; i++) {
res = &dev->resource[i];
printf("num : %d\n", i);
if (res->name)
printf("name : %s\n", res->name);
printf("start : 0x%08x\nsize : 0x%08x\n",
res->start, res->size);
}
printf("driver: %s\n\n", dev->driver ?
dev->driver->name : "none");
if (dev->driver)

View File

@ -25,15 +25,25 @@
#include <driver.h>
#include <xfuncs.h>
struct device_d *add_generic_device(const char* devname, int id, const char *resname,
resource_size_t start, resource_size_t size, unsigned int flags,
void *pdata)
static struct device_d *alloc_device(const char* devname, int id, void *pdata)
{
struct device_d *dev;
dev = xzalloc(sizeof(*dev));
strcpy(dev->name, devname);
dev->id = id;
dev->platform_data = pdata;
return dev;
}
struct device_d *add_generic_device(const char* devname, int id, const char *resname,
resource_size_t start, resource_size_t size, unsigned int flags,
void *pdata)
{
struct device_d *dev;
dev = alloc_device(devname, id, pdata);
dev->resource = xzalloc(sizeof(struct resource));
dev->num_resources = 1;
if (resname)
@ -41,10 +51,70 @@ struct device_d *add_generic_device(const char* devname, int id, const char *res
dev->resource[0].start = start;
dev->resource[0].size = size;
dev->resource[0].flags = flags;
dev->platform_data = pdata;
register_device(dev);
return dev;
}
EXPORT_SYMBOL(add_generic_device);
#ifdef CONFIG_DRIVER_NET_DM9000
struct device_d *add_dm9000_device(int id, resource_size_t base,
resource_size_t data, int flags, void *pdata)
{
struct device_d *dev;
resource_size_t size;
dev = alloc_device("dm9000", id, pdata);
dev->resource = xzalloc(sizeof(struct resource) * 2);
dev->num_resources = 2;
switch (flags) {
case IORESOURCE_MEM_32BIT:
size = 8;
break;
case IORESOURCE_MEM_16BIT:
size = 4;
break;
case IORESOURCE_MEM_8BIT:
size = 2;
break;
default:
printf("dm9000: memory width flag missing\n");
return NULL;
}
dev->resource[0].start = base;
dev->resource[0].size = size;
dev->resource[0].flags = IORESOURCE_MEM | flags;
dev->resource[1].start = data;
dev->resource[1].size = size;
dev->resource[1].flags = IORESOURCE_MEM | flags;
register_device(dev);
return dev;
}
EXPORT_SYMBOL(add_dm9000_device);
#endif
#ifdef CONFIG_USB_EHCI
struct device_d *add_usb_ehci_device(int id, resource_size_t hccr,
resource_size_t hcor, void *pdata)
{
struct device_d *dev;
dev = alloc_device("ehci", id, pdata);
dev->resource = xzalloc(sizeof(struct resource) * 2);
dev->num_resources = 2;
dev->resource[0].start = hccr;
dev->resource[0].flags = IORESOURCE_MEM;
dev->resource[1].start = hcor;
dev->resource[1].flags = IORESOURCE_MEM;
register_device(dev);
return dev;
}
EXPORT_SYMBOL(add_usb_ehci_device);
#endif

View File

@ -1175,7 +1175,6 @@ static int mci_card_probe(struct device_d *mci_dev)
{
struct mci *mci = GET_MCI_DATA(mci_dev);
struct mci_host *host = GET_MCI_PDATA(mci_dev);
struct device_d *disk_dev;
struct ata_interface *p;
int rc;
@ -1221,8 +1220,7 @@ static int mci_card_probe(struct device_d *mci_dev)
* An MMC/SD card acts like an ordinary disk.
* So, re-use the disk driver to gain access to this media
*/
disk_dev = xzalloc(sizeof(struct device_d) + sizeof(struct ata_interface));
p = (struct ata_interface*)&disk_dev[1];
p = xzalloc(sizeof(struct ata_interface));
#ifdef CONFIG_MCI_WRITE
p->write = mci_sd_write;
@ -1230,11 +1228,7 @@ static int mci_card_probe(struct device_d *mci_dev)
p->read = mci_sd_read;
p->priv = mci_dev;
strcpy(disk_dev->name, "disk");
disk_dev->size = mci->capacity;
disk_dev->platform_data = p;
register_device(disk_dev);
add_generic_device("disk", -1, NULL, 0, mci->capacity, IORESOURCE_MEM, p);
pr_debug("SD Card successfully added\n");

View File

@ -294,16 +294,16 @@ static int dm9000_eth_send (struct eth_device *edev,
writeb(DM9000_MWCMD, priv->iobase);
switch (priv->buswidth) {
case DM9000_WIDTH_8:
case IORESOURCE_MEM_8BIT:
for (i = 0; i < length; i++)
writeb(data_ptr[i] & 0xff, priv->iodata);
break;
case DM9000_WIDTH_16:
case IORESOURCE_MEM_16BIT:
tmplen = (length + 1) / 2;
for (i = 0; i < tmplen; i++)
writew(((u16 *)data_ptr)[i], priv->iodata);
break;
case DM9000_WIDTH_32:
case IORESOURCE_MEM_32BIT:
tmplen = (length + 3) / 4;
for (i = 0; i < tmplen; i++)
writel(((u32 *) data_ptr)[i], priv->iodata);
@ -371,20 +371,20 @@ static int dm9000_eth_rx (struct eth_device *edev)
/* Move data from DM9000 */
/* Read received packet from RX SRAM */
switch (priv->buswidth) {
case DM9000_WIDTH_8:
case IORESOURCE_MEM_8BIT:
RxStatus = readb(priv->iodata) + (readb(priv->iodata) << 8);
RxLen = readb(priv->iodata) + (readb(priv->iodata) << 8);
for (i = 0; i < RxLen; i++)
rdptr[i] = readb(priv->iodata);
break;
case DM9000_WIDTH_16:
case IORESOURCE_MEM_16BIT:
RxStatus = readw(priv->iodata);
RxLen = readw(priv->iodata);
tmplen = (RxLen + 1) / 2;
for (i = 0; i < tmplen; i++)
((u16 *) rdptr)[i] = readw(priv->iodata);
break;
case DM9000_WIDTH_32:
case IORESOURCE_MEM_32BIT:
tmpdata = readl(priv->iodata);
RxStatus = tmpdata;
RxLen = tmpdata >> 16;
@ -500,7 +500,8 @@ static int dm9000_probe(struct device_d *dev)
pdata = dev->platform_data;
priv = edev->priv;
priv->buswidth = pdata->buswidth;
priv->buswidth = dev->resource[0].flags & IORESOURCE_MEM_TYPE_MASK;
priv->iodata = dev_request_mem_region(dev, 1);
priv->iobase = dev_request_mem_region(dev, 0);
priv->srom = pdata->srom;

View File

@ -988,7 +988,7 @@ static int cfi_probe (struct device_d *dev)
if (info->flash_id == FLASH_UNKNOWN) {
printf ("## Unknown FLASH on Bank at 0x%08x - Size = 0x%08lx = %ld MB\n",
dev->map_base, info->size, info->size << 20);
dev->resource[0].start, info->size, info->size << 20);
return -ENODEV;
}

View File

@ -48,6 +48,70 @@
/*********** Private Functions **********************************/
/**
* @brief read register
*
* @param[in] cdev pointer to console device
* @param[in] offset
*
* @return value
*/
static uint32_t ns16550_read(struct console_device *cdev, uint32_t off)
{
struct device_d *dev = cdev->dev;
struct NS16550_plat *plat = (struct NS16550_plat *)dev->platform_data;
int width = dev->resource[0].flags & IORESOURCE_MEM_TYPE_MASK;
off <<= plat->shift;
if (plat->reg_read)
return plat->reg_read((unsigned long)dev->priv, off);
switch (width) {
case IORESOURCE_MEM_8BIT:
return readb(dev->priv + off);
case IORESOURCE_MEM_16BIT:
return readw(dev->priv + off);
case IORESOURCE_MEM_32BIT:
return readl(dev->priv + off);
}
return -1;
}
/**
* @brief write register
*
* @param[in] cdev pointer to console device
* @param[in] offset
* @param[in] val
*/
static void ns16550_write(struct console_device *cdev, uint32_t val,
uint32_t off)
{
struct device_d *dev = cdev->dev;
struct NS16550_plat *plat = (struct NS16550_plat *)dev->platform_data;
int width = dev->resource[0].flags & IORESOURCE_MEM_TYPE_MASK;
off <<= plat->shift;
if (plat->reg_write) {
plat->reg_write(val, (unsigned long)dev->priv, off);
return;
}
switch (width) {
case IORESOURCE_MEM_8BIT:
writeb(val & 0xff, dev->priv + off);
break;
case IORESOURCE_MEM_16BIT:
writew(val & 0xffff, dev->priv + off);
break;
case IORESOURCE_MEM_32BIT:
writel(val, dev->priv + off);
break;
}
}
/**
* @brief Compute the divisor for a baud rate
*
@ -74,27 +138,24 @@ static unsigned int ns16550_calc_divisor(struct console_device *cdev,
*/
static void ns16550_serial_init_port(struct console_device *cdev)
{
struct NS16550_plat *plat = (struct NS16550_plat *)
cdev->dev->platform_data;
unsigned long base = cdev->dev->map_base;
unsigned int baud_divisor;
/* Setup the serial port with the defaults first */
baud_divisor = ns16550_calc_divisor(cdev, CONFIG_BAUDRATE);
/* initializing the device for the first time */
plat->reg_write(0x00, base, ier);
ns16550_write(cdev, 0x00, ier);
#ifdef CONFIG_DRIVER_SERIAL_NS16550_OMAP_EXTENSIONS
plat->reg_write(0x07, base, mdr1); /* Disable */
ns16550_write(cdev, 0x07, mdr1); /* Disable */
#endif
plat->reg_write(LCR_BKSE | LCRVAL, base, lcr);
plat->reg_write(baud_divisor & 0xFF, base, dll);
plat->reg_write((baud_divisor >> 8) & 0xff, base, dlm);
plat->reg_write(LCRVAL, base, lcr);
plat->reg_write(MCRVAL, base, mcr);
plat->reg_write(FCRVAL, base, fcr);
ns16550_write(cdev, LCR_BKSE | LCRVAL, lcr);
ns16550_write(cdev, baud_divisor & 0xFF, dll);
ns16550_write(cdev, (baud_divisor >> 8) & 0xff, dlm);
ns16550_write(cdev, LCRVAL, lcr);
ns16550_write(cdev, MCRVAL, mcr);
ns16550_write(cdev, FCRVAL, fcr);
#ifdef CONFIG_DRIVER_SERIAL_NS16550_OMAP_EXTENSIONS
plat->reg_write(0x00, base, mdr1);
ns16550_write(cdev, 0x00, mdr1);
#endif
}
@ -108,12 +169,9 @@ static void ns16550_serial_init_port(struct console_device *cdev)
*/
static void ns16550_putc(struct console_device *cdev, char c)
{
struct NS16550_plat *plat = (struct NS16550_plat *)
cdev->dev->platform_data;
unsigned long base = cdev->dev->map_base;
/* Loop Doing Nothing */
while ((plat->reg_read(base, lsr) & LSR_THRE) == 0) ;
plat->reg_write(c, base, thr);
while ((ns16550_read(cdev, lsr) & LSR_THRE) == 0) ;
ns16550_write(cdev, c, thr);
}
/**
@ -125,12 +183,9 @@ static void ns16550_putc(struct console_device *cdev, char c)
*/
static int ns16550_getc(struct console_device *cdev)
{
struct NS16550_plat *plat = (struct NS16550_plat *)
cdev->dev->platform_data;
unsigned long base = cdev->dev->map_base;
/* Loop Doing Nothing */
while ((plat->reg_read(base, lsr) & LSR_DR) == 0) ;
return plat->reg_read(base, rbr);
while ((ns16550_read(cdev, lsr) & LSR_DR) == 0) ;
return ns16550_read(cdev, rbr);
}
/**
@ -142,10 +197,7 @@ static int ns16550_getc(struct console_device *cdev)
*/
static int ns16550_tstc(struct console_device *cdev)
{
struct NS16550_plat *plat = (struct NS16550_plat *)
cdev->dev->platform_data;
unsigned long base = cdev->dev->map_base;
return ((plat->reg_read(base, lsr) & LSR_DR) != 0);
return ((ns16550_read(cdev, lsr) & LSR_DR) != 0);
}
/**
@ -158,17 +210,15 @@ static int ns16550_tstc(struct console_device *cdev)
*/
static int ns16550_setbaudrate(struct console_device *cdev, int baud_rate)
{
struct NS16550_plat *plat = (struct NS16550_plat *)
cdev->dev->platform_data;
unsigned long base = cdev->dev->map_base;
unsigned int baud_divisor = ns16550_calc_divisor(cdev, baud_rate);
plat->reg_write(0x00, base, ier);
plat->reg_write(LCR_BKSE, base, lcr);
plat->reg_write(baud_divisor & 0xff, base, dll);
plat->reg_write((baud_divisor >> 8) & 0xff, base, dlm);
plat->reg_write(LCRVAL, base, lcr);
plat->reg_write(MCRVAL, base, mcr);
plat->reg_write(FCRVAL, base, fcr);
ns16550_write(cdev, 0x00, ier);
ns16550_write(cdev, LCR_BKSE, lcr);
ns16550_write(cdev, baud_divisor & 0xff, dll);
ns16550_write(cdev, (baud_divisor >> 8) & 0xff, dlm);
ns16550_write(cdev, LCRVAL, lcr);
ns16550_write(cdev, MCRVAL, mcr);
ns16550_write(cdev, FCRVAL, fcr);
return 0;
}
@ -189,14 +239,19 @@ static int ns16550_probe(struct device_d *dev)
/* we do expect platform specific data */
if (plat == NULL)
return -EINVAL;
if ((plat->reg_read == NULL) || (plat->reg_write == NULL))
if (!(dev->resource[0].flags & IORESOURCE_MEM_TYPE_MASK) &&
((plat->reg_read == NULL) || (plat->reg_write == NULL)))
return -EINVAL;
dev->priv = dev_request_mem_region(dev, 0);
cdev = xzalloc(sizeof(*cdev));
dev->type_data = cdev;
cdev->dev = dev;
cdev->f_caps = plat->f_caps;
if (plat->f_caps)
cdev->f_caps = plat->f_caps;
else
cdev->f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR;
cdev->tstc = ns16550_tstc;
cdev->putc = ns16550_putc;
cdev->getc = ns16550_getc;

View File

@ -2239,7 +2239,7 @@ static int fsl_udc_probe(struct device_d *dev)
udc_controller = xzalloc(sizeof(*udc_controller));
udc_controller->stopped = 1;
dr_regs = (void *)dev->map_base;
dr_regs = dev_request_mem_region(dev, 0);
/* Read Device Controller Capability Parameters register */
dccparams = readl(&dr_regs->dccparams);

View File

@ -900,20 +900,22 @@ static int ehci_probe(struct device_d *dev)
host = &ehci->host;
dev->priv = ehci;
if (pdata) {
/* default to EHCI_HAS_TT to not change behaviour of boards
* without platform_data
*/
if (pdata)
ehci->flags = pdata->flags;
ehci->hccr = (void *)(dev->map_base + pdata->hccr_offset);
ehci->hcor = (void *)(dev->map_base + pdata->hcor_offset);
}
else {
/* default to EHCI_HAS_TT to not change behaviour of boards
* with platform_data
*/
else
ehci->flags = EHCI_HAS_TT;
ehci->hccr = (void *)(dev->map_base + 0x100);
ehci->hcor = (void *)(dev->map_base + 0x140);
if (dev->num_resources < 2) {
printf("echi: need 2 resources base and data");
return -ENODEV;
}
ehci->hccr = dev_request_mem_region(dev, 0);
ehci->hcor = dev_request_mem_region(dev, 1);
host->init = ehci_init;
host->submit_int_msg = submit_int_msg;
host->submit_control_msg = submit_control_msg;

View File

@ -84,9 +84,9 @@ static int fb_setup_mode(struct device_d *dev, struct param_d *param,
ret = info->fbops->fb_activate_var(info);
if (!ret) {
dev->map_base = (unsigned long)info->screen_base;
dev->resource[0].start = (resource_size_t)info->screen_base;
info->cdev.size = info->xres * info->yres * (info->bits_per_pixel >> 3);
dev->size = info->cdev.size;
dev->resource[0].size = info->cdev.size;
dev_param_set_generic(dev, param, val);
} else
info->cdev.size = 0;
@ -107,15 +107,19 @@ int register_framebuffer(struct fb_info *info)
int id = get_free_deviceid("fb");
struct device_d *dev;
dev = &info->dev;
info->cdev.ops = &fb_ops;
info->cdev.name = asprintf("fb%d", id);
info->cdev.size = info->xres * info->yres * (info->bits_per_pixel >> 3);
info->cdev.dev = &info->dev;
info->cdev.dev = dev;
info->cdev.priv = info;
info->cdev.dev->map_base = (unsigned long)info->screen_base;
info->cdev.dev->size = info->cdev.size;
dev->resource = xzalloc(sizeof(struct resource));
dev->resource[0].start = (resource_size_t)info->screen_base;
dev->resource[0].size = info->cdev.size;
dev->resource[0].flags = IORESOURCE_MEM;
dev->num_resources = 1;
dev = &info->dev;
dev->priv = info;
dev->id = id;

View File

@ -331,11 +331,12 @@ static int s3cfb_activate_var(struct fb_info *fb_info)
static void s3cfb_info(struct device_d *hw_dev)
{
uint32_t con1, addr1, addr2, addr3;
struct s3cfb_info *fbi = hw_dev->priv;
con1 = readl(hw_dev->map_base + LCDCON1);
addr1 = readl(hw_dev->map_base + LCDSADDR1);
addr2 = readl(hw_dev->map_base + LCDSADDR2);
addr3 = readl(hw_dev->map_base + LCDSADDR3);
con1 = readl(fbi->base + LCDCON1);
addr1 = readl(fbi->base + LCDSADDR1);
addr2 = readl(fbi->base + LCDSADDR2);
addr3 = readl(fbi->base + LCDSADDR3);
printf(" Video hardware info:\n");
printf(" Video clock is running at %u Hz\n", s3c24xx_get_hclk() / ((GET_CLKVAL(con1) + 1) * 2));
@ -371,15 +372,16 @@ static int s3cfb_probe(struct device_d *hw_dev)
if (! pdata)
return -ENODEV;
writel(0, hw_dev->map_base + LCDCON1);
writel(0, hw_dev->map_base + LCDCON5); /* FIXME not 0 for some displays */
fbi.base = dev_request_mem_region(hw_dev, 0);
writel(0, fbi.base + LCDCON1);
writel(0, fbi.base + LCDCON5); /* FIXME not 0 for some displays */
/* just init */
fbi.info.priv = &fbi;
/* add runtime hardware info */
fbi.hw_dev = hw_dev;
fbi.base = (void*)hw_dev->map_base;
hw_dev->priv = &fbi;
/* add runtime video info */
fbi.info.mode_list = pdata->mode_list;

View File

@ -488,7 +488,7 @@ static int stmfb_probe(struct device_d *hw_dev)
/* add runtime hardware info */
fbi.hw_dev = hw_dev;
fbi.base = (void *)hw_dev->map_base;
fbi.base = dev_request_mem_region(hw_dev, 0);
fbi.pdata = pdata;
/* add runtime video info */

View File

@ -161,7 +161,9 @@ static int devfs_ioctl(struct device_d *_dev, FILE *f, int request, void *buf)
static int devfs_truncate(struct device_d *dev, FILE *f, ulong size)
{
if (size > f->dev->size)
if (f->dev->num_resources < 1)
return -ENOSPC;
if (size > f->dev->resource[0].size)
return -ENOSPC;
return 0;
}

View File

@ -1043,11 +1043,11 @@ ssize_t mem_read(struct cdev *cdev, void *buf, size_t count, ulong offset, ulong
ulong size;
struct device_d *dev;
if (!cdev->dev)
if (!cdev->dev || cdev->dev->num_resources < 1)
return -1;
dev = cdev->dev;
size = min((ulong)count, dev->size - offset);
size = min((ulong)count, dev->resource[0].size - offset);
memcpy_sz(buf, dev_get_mem_region(dev, 0) + offset, size, flags & O_RWSIZE_MASK);
return size;
}
@ -1058,11 +1058,11 @@ ssize_t mem_write(struct cdev *cdev, const void *buf, size_t count, ulong offset
ulong size;
struct device_d *dev;
if (!cdev->dev)
if (!cdev->dev || cdev->dev->num_resources < 1)
return -1;
dev = cdev->dev;
size = min((ulong)count, dev->size - offset);
size = min((ulong)count, dev->resource[0].size - offset);
memcpy_sz(dev_get_mem_region(dev, 0) + offset, buf, size, flags & O_RWSIZE_MASK);
return size;
}

View File

@ -2,12 +2,7 @@
#ifndef __DM9000_H__
#define __DM9000_H__
#define DM9000_WIDTH_8 1
#define DM9000_WIDTH_16 2
#define DM9000_WIDTH_32 3
struct dm9000_platform_data {
int buswidth;
int srom;
};

View File

@ -71,12 +71,6 @@ struct device_d {
* something like eth0 or nor0. */
int id;
resource_size_t size;
/*! For devices which are directly mapped into memory, i.e. NOR
* Flash or SDRAM. */
resource_size_t map_base;
struct resource *resource;
int num_resources;
@ -229,10 +223,38 @@ static inline struct device_d *add_cfi_flash_device(int id, resource_size_t star
struct NS16550_plat;
static inline struct device_d *add_ns16550_device(int id, resource_size_t start,
resource_size_t size, struct NS16550_plat *pdata)
resource_size_t size, int flags, struct NS16550_plat *pdata)
{
return add_generic_device("serial_ns16550", id, NULL, start, size,
IORESOURCE_MEM, pdata);
IORESOURCE_MEM | flags, pdata);
}
#ifdef CONFIG_DRIVER_NET_DM9000
struct device_d *add_dm9000_device(int id, resource_size_t base,
resource_size_t data, int flags, void *pdata);
#else
static inline struct device_d *add_dm9000_device(int id, resource_size_t base,
resource_size_t data, int flags, void *pdata)
{
return NULL;
}
#endif
#ifdef CONFIG_USB_EHCI
struct device_d *add_usb_ehci_device(int id, resource_size_t hccr,
resource_size_t hcor, void *pdata);
#else
static inline struct device_d *add_usb_ehci_device(int id, resource_size_t hccr,
resource_size_t hcor, void *pdata)
{
return NULL;
}
#endif
static inline struct device_d *add_generic_usb_ehci_device(int id,
resource_size_t base, void *pdata)
{
return add_usb_ehci_device(id, base + 0x100, base + 0x140, pdata);
}
/* linear list over all available devices

View File

@ -50,6 +50,8 @@ struct NS16550_plat {
*/
void (*reg_write) (unsigned int val, unsigned long base,
unsigned char reg_offset);
int shift;
};
#endif /* __NS16650_PLATFORM_H_ */