[PATCH v4 4/4] MIPS: Octeon: flash: use the simple map accessors without a shared eMMC

sashiko-bot at kernel.org sashiko-bot at kernel.org
Tue Nov 17 14:06:41 PST 2026


Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] MIPS: Octeon: flash: simple_map_init() breaks little-endian
  mtd_point()
--

commit 56e2d356f36cb97dd336d231b8f3f9d7b285369c
Author: Orgad Shaneh <orgads at gmail.com>

MIPS: Octeon: flash: use the simple map accessors without a shared eMMC

This commit checks whether the boot bus is shared with a
"cavium,octeon-6130-mmc" device node and calls simple_map_init() when it
is not, while checking map_bankwidth_supported() before mapping the
flash.

> diff --git a/arch/mips/cavium-octeon/flash_setup.c b/arch/mips/cavium-octeon/flash_setup.c
> index 0e5652fc0c2ef..62612cd75d1b0 100644
> --- a/arch/mips/cavium-octeon/flash_setup.c
> +++ b/arch/mips/cavium-octeon/flash_setup.c

[ ... ]

> @@ -107,11 +124,20 @@ static int octeon_flash_probe(struct platform_device *pdev)
>  			return -ENOMEM;
>  		pr_notice("Bootbus flash: Setting flash for %luMB flash at "
>  			  "0x%08llx\n", map->size >> 20, map->phys);
> -		WARN_ON(!map_bankwidth_supported(map->bankwidth));
> -		map->read = octeon_flash_map_read;
> -		map->write = octeon_flash_map_write;
> -		map->copy_from = octeon_flash_map_copy_from;
> -		map->copy_to = octeon_flash_map_copy_to;
> +		/*
> +		 * The boot bus semaphore only serializes the flash against
> +		 * an eMMC host that shares the bus (the CIU3 parts have
> +		 * their own). Without one, use the simple accessors: they
> +		 * let MTD point at the flash, so jffs2 scans it in place.
> +		 */
> +		if (octeon_flash_bus_shared()) {
> +			map->read = octeon_flash_map_read;
> +			map->write = octeon_flash_map_write;
> +			map->copy_from = octeon_flash_map_copy_from;
> +			map->copy_to = octeon_flash_map_copy_to;
> +		} else {
> +			simple_map_init(map);
> +		}

[Severity: Medium]
Does calling simple_map_init(map) break mtd_point() on little-endian
Octeon kernels (CONFIG_CPU_LITTLE_ENDIAN=y)?

On Octeon, the boot bus is wired big-endian into the 64-bit IOB, so
sub-64-bit MMIO accesses under __LITTLE_ENDIAN require address swizzling:

arch/mips/include/asm/mach-cavium-octeon/mangle-port.h:
# define __swizzle_addr_b(port)	\
	(__should_swizzle_addr(port) ? (port) ^ 7 : (port))
# define __swizzle_addr_w(port)	\
	(__should_swizzle_addr(port) ? (port) ^ 6 : (port))
# define __swizzle_addr_l(port)	\
	(__should_swizzle_addr(port) ? (port) ^ 4 : (port))

inline_map_read() and inline_map_write() go through __raw_readb()/w() and
__raw_writeb()/w(), which apply those swizzles.  Marking the map as simple
causes cfi_cmdset_0001 and cfi_cmdset_0002 to wire up mtd->_point, so
callers such as JFFS2 directly dereference map->virt + ofs with normal CPU
loads and read scrambled flash offsets.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261117214141.3826637-1-orgads@gmail.com?part=4



More information about the linux-mtd mailing list