From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfgang Denk Date: Fri, 01 Apr 2011 15:55:19 +0200 Subject: [U-Boot] [PATCH] serial: ns16550: fix different reg size access In-Reply-To: References: <1301586774-25447-1-git-send-email-leiwen@marvell.com> <20110331155851.BA1F1F03209@gemini.denx.de> <20110401053518.ADF2AF0320A@gemini.denx.de> <20110401073922.5A7ECF0320A@gemini.denx.de> <20110401102526.C1F09F03209@gemini.denx.de> <20110401124131.22020F0320A@gemini.denx.de> Message-ID: <20110401135519.7271CF0320A@gemini.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 Dear Lei Wen, In message you wrote: > > >> I think my code also could handle this. They only could set the > >> CONFIG_SYS_NS16550_REG_SIZE =A0to be 1 > >> and CONFIG_SYS_NS16550_MAX_REG_SIZE to be 4. Then > >> the other bits is untouched by this driver. > > > > I don't think so. You still use just a single writel() call then. =A0To > > leave the other bits untouched, you would have to perform a readl() > > first, then insert one data byte, and then write it back. =A0Your patch > > does not do that. > > My original patch is like below, so where it call writel?... > +#elif (CONFIG_SYS_NS16550_REG_SIZE == 1) || (CONFIG_SYS_NS16550_REG_SIZE == -1) > +#ifdef CONFIG_SYS_NS16550_PORT_MAPPED > +#define serial_out(x, y) outb(x, y) > +#define serial_in(y) inb(y) > +#else > +#define serial_out(x, y) writeb(x, y) > +#define serial_in(y) readb(y) If you use writeb() [as the current driver would do as well}, then how do you expect to set this bit 8 (which is in the next byte) to 0 as you claim you have to? Either I don't understand what you want, or you don't understand how the ns16550 driver works. I can see no shortcomings in the existent driver, thus no need to make it more complicated than it already is. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Time is a drug. Too much of it kills you. - Terry Pratchett, _Small Gods_