From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Thu, 22 Oct 2015 03:53:53 +0200 Subject: [U-Boot] [PATCH] net: convert altera_tse to driver model and phylib In-Reply-To: <56278E87.9000208@wytron.com.tw> References: <1445222181-30241-1-git-send-email-thomas@wytron.com.tw> <201510191431.55460.marex@denx.de> <56278E87.9000208@wytron.com.tw> Message-ID: <201510220353.53509.marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wednesday, October 21, 2015 at 03:09:27 PM, Thomas Chou wrote: > Hi Marek, Hi! > On 10/19/2015 08:31 PM, Marek Vasut wrote: > >> + /* decode regs, assume address-cells and size-cells are both one */ > >> + list = fdt_getprop(blob, node, "reg-names", &len); > >> + if (!list) > >> + return -ENOENT; > >> + end = list + len; > >> + cell = fdt_getprop(blob, node, "reg", &len); > >> + if (!cell) > >> + return -ENOENT; > >> + idx = 0; > >> + while (list < end) { > >> + addr = fdt_translate_address((void *)blob, > >> + node, cell + idx); > >> + size = fdt_addr_to_cpu(cell[idx + 1]); > >> + base = ioremap(addr, size); > >> + len = strlen(list); > >> + if (strcmp(list, "control_port") == 0) > >> + priv->mac_dev = base; > > > > fdtdec_get_addr() won't do here? > > There are multiple "reg" tuples, and need to match "reg-names". That's > beyond fdtdec_get_addr(). > > tse_mac: ethernet at 0x4000 { > compatible = "altr,tse-1.0"; > reg = <0x00004000 0x00000400>, > <0x00004400 0x00000040>, > <0x00004800 0x00000040>, > <0x00002000 0x00002000>; > reg-names = "control_port", "rx_csr", "tx_csr", "s1"; > > Thanks a lot for your reviews. Gotcha, thanks! Best regards, Marek Vasut