All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Cc: "Cyrille Pitchen" <cyrille.pitchen@atmel.com>,
	"David Woodhouse" <dwmw2@infradead.org>,
	"Brian Norris" <computersforpeace@gmail.com>,
	"Javier Martinez Canillas" <javier@osg.samsung.com>,
	"Stephen Warren" <swarren@nvidia.com>,
	"Jagan Teki" <jteki@openedev.com>, "Vignesh R" <vigneshr@ti.com>,
	"Marek Vasut" <marex@denx.de>,
	"Ezequiel García" <ezequiel@vanguardiasur.com.ar>,
	"Rafał Miłecki" <zajec5@gmail.com>,
	"Furquan Shaikh" <furquan@google.com>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mtd: spi-nor: Add support for S3AN spi-nor devices
Date: Wed, 21 Sep 2016 10:20:07 +0200	[thread overview]
Message-ID: <20160921102007.47181440@bbrezillon> (raw)
In-Reply-To: <20160921101420.7ea87f2d@bbrezillon>

On Wed, 21 Sep 2016 10:14:20 +0200
Boris Brezillon <boris.brezillon@free-electrons.com> wrote:

> On Wed, 21 Sep 2016 09:57:23 +0200
> Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> wrote:
> 
> > Hi Boris
> > 
> > On Wed, Sep 21, 2016 at 9:07 AM, Boris Brezillon
> > <boris.brezillon@free-electrons.com> wrote:  
> > > Hi Ricardo,
> > >
> > > Please try to pass the version in your subject prefix (pass
> > > --subject-prefix="PATCH vX" to git format-patch).
> > >    
> > 
> > Sorry about that.
> > 
> >   
> > > On Tue, 20 Sep 2016 17:45:51 +0200
> > > Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> wrote:    
> >   
> > >>  /*
> > >> + * This code converts an address to the Default Address Mode, that has non
> > >> + * power of two page sizes. We must support this mode because it is the default
> > >> + * mode supported by Xilinx tools, it can access the whole flash area and
> > >> + * changing over to the Power-of-two mode is irreversible and corrupts the
> > >> + * original data.
> > >> + */
> > >> +static loff_t spi_nor_s3an_addr_convert(struct spi_nor *nor, unsigned int addr)
> > >> +{
> > >> +     unsigned int offset;
> > >> +
> > >> +     offset = (nor->page_size == 264) ? (addr % 264) : (addr % 528);    
> > >
> > > Can you send a new version with
> > >
> > >         offset = addr % nor->page_size;
> > >
> > > to see if kbuild test robot still complains.
> > >    
> > 
> > This code:
> > 
> > static loff_t spi_nor_s3an_addr_convert(struct spi_nor *nor, loff_t addr)
> > {
> > unsigned int offset;
> > 
> > offset = addr % nor->page_size;
> > 
> > return ((addr - offset) << 1) | offset;
> > }
> > 
> > 
> > When built like:
> > 
> >    wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
> > -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         # save the attached .config to linux build tree
> >         make.cross ARCH=blackfin
> > 
> > Produces this error:
> > 
> > 
> > drivers/built-in.o: In function `spi_nor_write':
> > drivers/mtd/spi-nor/spi-nor.c:(.text+0xfeb8): undefined reference to `__moddi3'
> > drivers/built-in.o: In function `spi_nor_read':
> > drivers/mtd/spi-nor/spi-nor.c:(.text+0x10248): undefined reference to `__moddi3'
> > drivers/built-in.o: In function `spi_nor_erase':
> > drivers/mtd/spi-nor/spi-nor.c:(.text+0x1034e): undefined reference to `__moddi3'
> > Makefile:956: recipe for target 'vmlinux' failed
> > 
> > 
> > But I think I found the right combination:
> > 
> > 
> > static loff_t spi_nor_s3an_addr_convert(struct spi_nor *nor, loff_t addr)
> > {
> > unsigned int offset = addr;
> > 
> > offset %= nor->page_size;
> > 
> > return ((addr - offset) << 1) | offset;
> > }
> > 
> > 
> > This one works fine on x86 and blackfin
> > 
> > Sending v7  
> 
> Wait. If you really want to manipulate an loff_t variable, you can do
> 
> 	offset = do_div(addr, nor->page_size);
> 
> 

Actually, you should have an intermediate u64 var, or just turn addr
into an u64 (loff_t is a long long not an unsigned long long).

  parent reply	other threads:[~2016-09-21  8:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-20 15:45 [PATCH] mtd: spi-nor: Add support for S3AN spi-nor devices Ricardo Ribalda Delgado
2016-09-21  7:07 ` Boris Brezillon
2016-09-21  7:57   ` Ricardo Ribalda Delgado
2016-09-21  8:14     ` Boris Brezillon
2016-09-21  8:19       ` Ricardo Ribalda Delgado
2016-09-21  8:21         ` Boris Brezillon
2016-09-21  8:26           ` Ricardo Ribalda Delgado
2016-10-20 14:03             ` Ricardo Ribalda Delgado
2016-09-21  8:20       ` Boris Brezillon [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-01-15 16:25 Ricardo Ribalda Delgado
2016-01-22 14:52 ` Ricardo Ribalda Delgado
2016-03-05  9:24   ` Ricardo Ribalda Delgado

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160921102007.47181440@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=cyrille.pitchen@atmel.com \
    --cc=dwmw2@infradead.org \
    --cc=ezequiel@vanguardiasur.com.ar \
    --cc=furquan@google.com \
    --cc=javier@osg.samsung.com \
    --cc=jteki@openedev.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marex@denx.de \
    --cc=ricardo.ribalda@gmail.com \
    --cc=swarren@nvidia.com \
    --cc=vigneshr@ti.com \
    --cc=zajec5@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.