From: Masahiro Yamada Date: Fri, 03 Oct 2014 21:45:49 +0900 Subject: [U-Boot] How does Driver Model UART work? Message-ID: <20141003214549.D7B7.AA925319@jp.panasonic.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Simon, Now I am seeing driver/serial/serial_tegra.c U_BOOT_DRIVER(serial_ns16550) = { .name = "serial_tegra20", .id = UCLASS_SERIAL, .of_match = tegra_serial_ids, .ofdata_to_platdata = tegra_serial_ofdata_to_platdata, .platdata_auto_alloc_size = sizeof(struct ns16550_platdata), .priv_auto_alloc_size = sizeof(struct NS16550), .probe = ns16550_serial_probe, .ops = &ns16550_serial_ops, You require sizeof(struct NS16550) (= about 30~ 40 bytes) for .priv_auto_alloc_size. Seems strange. It looks like the private date is used as the base address of the hardware Here, struct NS16550 *const com_port = dev_get_priv(dev); If the hardware register has 0x10000 width, do we need to allocation 0x10000 memory for .priv data? I think 4 byte (or 8 byte on 64bit architectures) is enough to store the base address. It looks like the memory is allocated for .priv in device_probe() function, but I could not find where .priv is set for pointing to the base address. Perhaps I am not understanding well yet, but I'm still not convinced how it is working. Best Regards Masahiro Yamada