mpc85xx: update to linux 4.4, remove unnecessary patches

Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 48297
This commit is contained in:
Felix Fietkau 2016-01-17 21:05:19 +00:00
parent 495935a3b8
commit 93a2b8a6c4
12 changed files with 53 additions and 186 deletions

View file

@ -14,7 +14,7 @@ FEATURES:=squashfs
MAINTAINER:=Imre Kaloz <kaloz@openwrt.org> MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
SUBTARGETS=generic p1020 SUBTARGETS=generic p1020
KERNEL_PATCHVER:=3.18 KERNEL_PATCHVER:=4.4
include $(INCLUDE_DIR)/target.mk include $(INCLUDE_DIR)/target.mk

View file

@ -6,6 +6,9 @@ CONFIG_AR8216_PHY_LEDS=y
CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
CONFIG_ARCH_HAS_DMA_SET_COHERENT_MASK=y
CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
CONFIG_ARCH_HAS_ILOG2_U32=y CONFIG_ARCH_HAS_ILOG2_U32=y
CONFIG_ARCH_HAS_SG_CHAIN=y CONFIG_ARCH_HAS_SG_CHAIN=y
CONFIG_ARCH_HAS_WALK_MEMORY=y CONFIG_ARCH_HAS_WALK_MEMORY=y
@ -35,8 +38,13 @@ CONFIG_CMDLINE_BOOL=y
# CONFIG_CORENET_GENERIC is not set # CONFIG_CORENET_GENERIC is not set
# CONFIG_CPM2 is not set # CONFIG_CPM2 is not set
CONFIG_CPU_BIG_ENDIAN=y CONFIG_CPU_BIG_ENDIAN=y
# CONFIG_CPU_LITTLE_ENDIAN is not set # CONFIG_CRYPTO_AES_PPC_SPE is not set
# CONFIG_CRYPTO_MD5_PPC is not set
CONFIG_CRYPTO_RNG2=y
# CONFIG_CRYPTO_SHA1_PPC is not set # CONFIG_CRYPTO_SHA1_PPC is not set
# CONFIG_CRYPTO_SHA1_PPC_SPE is not set
# CONFIG_CRYPTO_SHA256_PPC_SPE is not set
CONFIG_CRYPTO_WORKQUEUE=y
CONFIG_DEBUG_BUGVERBOSE=y CONFIG_DEBUG_BUGVERBOSE=y
CONFIG_DEFAULT_UIMAGE=y CONFIG_DEFAULT_UIMAGE=y
CONFIG_DEVKMEM=y CONFIG_DEVKMEM=y
@ -45,6 +53,8 @@ CONFIG_DTC=y
# CONFIG_E200 is not set # CONFIG_E200 is not set
CONFIG_E500=y CONFIG_E500=y
CONFIG_EARLY_PRINTK=y CONFIG_EARLY_PRINTK=y
CONFIG_EDAC_ATOMIC_SCRUB=y
CONFIG_EDAC_SUPPORT=y
CONFIG_ENABLE_MUST_CHECK=y CONFIG_ENABLE_MUST_CHECK=y
# CONFIG_EPAPR_BOOT is not set # CONFIG_EPAPR_BOOT is not set
CONFIG_ETHERNET_PACKET_MANGLE=y CONFIG_ETHERNET_PACKET_MANGLE=y
@ -59,7 +69,6 @@ CONFIG_FSL_ULI1575=y
CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_ATOMIC64=y
CONFIG_GENERIC_BUG=y CONFIG_GENERIC_BUG=y
CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_CMOS_UPDATE=y
# CONFIG_GENERIC_CSUM is not set # CONFIG_GENERIC_CSUM is not set
CONFIG_GENERIC_IO=y CONFIG_GENERIC_IO=y
@ -88,10 +97,13 @@ CONFIG_HAS_IOPORT_MAP=y
CONFIG_HAS_RAPIDIO=y CONFIG_HAS_RAPIDIO=y
# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set # CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
CONFIG_HAVE_ARCH_AUDITSYSCALL=y CONFIG_HAVE_ARCH_AUDITSYSCALL=y
# CONFIG_HAVE_ARCH_BITREVERSE is not set
CONFIG_HAVE_ARCH_JUMP_LABEL=y CONFIG_HAVE_ARCH_JUMP_LABEL=y
CONFIG_HAVE_ARCH_KGDB=y CONFIG_HAVE_ARCH_KGDB=y
CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
CONFIG_HAVE_ARCH_TRACEHOOK=y CONFIG_HAVE_ARCH_TRACEHOOK=y
# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set # CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
CONFIG_HAVE_BPF_JIT=y
CONFIG_HAVE_DEBUG_KMEMLEAK=y CONFIG_HAVE_DEBUG_KMEMLEAK=y
CONFIG_HAVE_DEBUG_STACKOVERFLOW=y CONFIG_HAVE_DEBUG_STACKOVERFLOW=y
CONFIG_HAVE_DMA_API_DEBUG=y CONFIG_HAVE_DMA_API_DEBUG=y
@ -102,6 +114,7 @@ CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
CONFIG_HAVE_FUNCTION_TRACER=y CONFIG_HAVE_FUNCTION_TRACER=y
# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
CONFIG_HAVE_GENERIC_RCU_GUP=y
CONFIG_HAVE_IDE=y CONFIG_HAVE_IDE=y
CONFIG_HAVE_IOREMAP_PROT=y CONFIG_HAVE_IOREMAP_PROT=y
CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y
@ -157,11 +170,13 @@ CONFIG_MPIC_TIMER=y
# CONFIG_MTD_CFI is not set # CONFIG_MTD_CFI is not set
CONFIG_MTD_M25P80=y CONFIG_MTD_M25P80=y
CONFIG_MTD_SPI_NOR=y CONFIG_MTD_SPI_NOR=y
# CONFIG_MVME2500 is not set
# CONFIG_NEED_DMA_MAP_STATE is not set # CONFIG_NEED_DMA_MAP_STATE is not set
# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
CONFIG_NEED_PER_CPU_KM=y CONFIG_NEED_PER_CPU_KM=y
CONFIG_NEED_SG_DMA_LENGTH=y CONFIG_NEED_SG_DMA_LENGTH=y
# CONFIG_NONSTATIC_KERNEL is not set # CONFIG_NONSTATIC_KERNEL is not set
CONFIG_NO_BOOTMEM=y
CONFIG_NR_IRQS=512 CONFIG_NR_IRQS=512
CONFIG_OF=y CONFIG_OF=y
CONFIG_OF_ADDRESS=y CONFIG_OF_ADDRESS=y
@ -182,7 +197,6 @@ CONFIG_P1010_RDB=y
# CONFIG_P1022_DS is not set # CONFIG_P1022_DS is not set
# CONFIG_P1022_RDK is not set # CONFIG_P1022_RDK is not set
# CONFIG_P1023_RDB is not set # CONFIG_P1023_RDB is not set
CONFIG_PAGEFLAGS_EXTENDED=y
CONFIG_PAGE_OFFSET=0xc0000000 CONFIG_PAGE_OFFSET=0xc0000000
CONFIG_PCI=y CONFIG_PCI=y
CONFIG_PCIEAER=y CONFIG_PCIEAER=y
@ -193,6 +207,7 @@ CONFIG_PCIEASPM_DEFAULT=y
# CONFIG_PCIEASPM_POWERSAVE is not set # CONFIG_PCIEASPM_POWERSAVE is not set
CONFIG_PCIEPORTBUS=y CONFIG_PCIEPORTBUS=y
CONFIG_PCI_DOMAINS=y CONFIG_PCI_DOMAINS=y
CONFIG_PGTABLE_LEVELS=2
CONFIG_PHYLIB=y CONFIG_PHYLIB=y
CONFIG_PHYSICAL_ALIGN=0x04000000 CONFIG_PHYSICAL_ALIGN=0x04000000
CONFIG_PHYSICAL_START=0x00000000 CONFIG_PHYSICAL_START=0x00000000
@ -229,7 +244,6 @@ CONFIG_PPC_LIB_RHEAP=y
CONFIG_PPC_MMU_NOHASH=y CONFIG_PPC_MMU_NOHASH=y
# CONFIG_PPC_MM_SLICES is not set # CONFIG_PPC_MM_SLICES is not set
# CONFIG_PPC_MPC106 is not set # CONFIG_PPC_MPC106 is not set
CONFIG_PPC_OF=y
# CONFIG_PPC_P7_NAP is not set # CONFIG_PPC_P7_NAP is not set
CONFIG_PPC_PCI_CHOICE=y CONFIG_PPC_PCI_CHOICE=y
# CONFIG_PPC_QEMU_E500 is not set # CONFIG_PPC_QEMU_E500 is not set
@ -239,7 +253,6 @@ CONFIG_PPC_UDBG_16550=y
CONFIG_PPC_WERROR=y CONFIG_PPC_WERROR=y
# CONFIG_PPC_XICS is not set # CONFIG_PPC_XICS is not set
# CONFIG_PQ2ADS is not set # CONFIG_PQ2ADS is not set
# CONFIG_PREEMPT_RCU is not set
CONFIG_PROC_PAGE_MONITOR=y CONFIG_PROC_PAGE_MONITOR=y
# CONFIG_PTP_1588_CLOCK_GIANFAR is not set # CONFIG_PTP_1588_CLOCK_GIANFAR is not set
CONFIG_QE_GPIO=y CONFIG_QE_GPIO=y
@ -249,6 +262,7 @@ CONFIG_RAS=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y CONFIG_RWSEM_XCHGADD_ALGORITHM=y
# CONFIG_SBC8548 is not set # CONFIG_SBC8548 is not set
CONFIG_SCHED_HRTICK=y CONFIG_SCHED_HRTICK=y
# CONFIG_SCHED_INFO is not set
# CONFIG_SCSI_DMA is not set # CONFIG_SCSI_DMA is not set
CONFIG_SERIAL_8250_EXTENDED=y CONFIG_SERIAL_8250_EXTENDED=y
CONFIG_SERIAL_8250_FSL=y CONFIG_SERIAL_8250_FSL=y
@ -267,8 +281,11 @@ CONFIG_SPI=y
CONFIG_SPI_FSL_ESPI=y CONFIG_SPI_FSL_ESPI=y
CONFIG_SPI_FSL_LIB=y CONFIG_SPI_FSL_LIB=y
CONFIG_SPI_MASTER=y CONFIG_SPI_MASTER=y
CONFIG_SRCU=y
# CONFIG_STRICT_MM_TYPECHECKS is not set
# CONFIG_STRIP_ASM_SYMS is not set # CONFIG_STRIP_ASM_SYMS is not set
# CONFIG_STX_GP3 is not set # CONFIG_STX_GP3 is not set
# CONFIG_SUNXI_SRAM is not set
CONFIG_SWCONFIG=y CONFIG_SWCONFIG=y
CONFIG_SWIOTLB=y CONFIG_SWIOTLB=y
CONFIG_SYSCTL_EXCEPTION_TRACE=y CONFIG_SYSCTL_EXCEPTION_TRACE=y
@ -286,6 +303,7 @@ CONFIG_UCC_FAST=y
CONFIG_UCC_GETH=y CONFIG_UCC_GETH=y
# CONFIG_UGETH_TX_ON_DEMAND is not set # CONFIG_UGETH_TX_ON_DEMAND is not set
CONFIG_USB_SUPPORT=y CONFIG_USB_SUPPORT=y
CONFIG_VDSO32=y
CONFIG_VM_EVENT_COUNTERS=y CONFIG_VM_EVENT_COUNTERS=y
CONFIG_WORD_SIZE=32 CONFIG_WORD_SIZE=32
# CONFIG_XES_MPC85xx is not set # CONFIG_XES_MPC85xx is not set

View file

@ -21,12 +21,12 @@ endef
zImage:=$(BIN_DIR)/$(IMG_PREFIX)-zImage zImage:=$(BIN_DIR)/$(IMG_PREFIX)-zImage
DTS_TARGETS = mpc8548cds_32b p1010rdb-pa tl-wdr4900-v1 p1020rdb DTS_TARGETS = fsl/p1010rdb-pa tl-wdr4900-v1 fsl/p1020rdb
define Image/BuildKernel define Image/BuildKernel
cp $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-zImage cp $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-zImage
$(foreach dts,$(DTS_TARGETS), $(foreach dts,$(DTS_TARGETS),
$(LINUX_DIR)/scripts/dtc/dtc -I dts -O dtb $(DTS_DIR)/$(dts).dts > $(BIN_DIR)/$(IMG_PREFIX)-$(dts).fdt $(LINUX_DIR)/scripts/dtc/dtc -I dts -O dtb $(DTS_DIR)/$(dts).dts > $(BIN_DIR)/$(IMG_PREFIX)-$(notdir $(dts)).fdt
) )
endef endef

View file

@ -1,21 +1,17 @@
CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y CONFIG_ARCH_HAS_TICK_BROADCAST=y
CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
# CONFIG_ARCH_RANDOM is not set
CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y
CONFIG_CPU_RMAP=y CONFIG_CPU_RMAP=y
# CONFIG_GENERIC_CSUM is not set CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
CONFIG_GENERIC_TBSYNC=y CONFIG_GENERIC_TBSYNC=y
CONFIG_HAVE_DEBUG_STACKOVERFLOW=y
CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y
CONFIG_HAVE_RCU_TABLE_FREE=y CONFIG_HAVE_RCU_TABLE_FREE=y
CONFIG_LOCK_SPIN_ON_OWNER=y
CONFIG_MUTEX_SPIN_ON_OWNER=y CONFIG_MUTEX_SPIN_ON_OWNER=y
CONFIG_NET_FLOW_LIMIT=y CONFIG_NET_FLOW_LIMIT=y
CONFIG_NR_CPUS=2 CONFIG_NR_CPUS=2
CONFIG_RCU_STALL_COMMON=y CONFIG_RCU_STALL_COMMON=y
CONFIG_RFS_ACCEL=y CONFIG_RFS_ACCEL=y
CONFIG_RPS=y CONFIG_RPS=y
CONFIG_RWSEM_SPIN_ON_OWNER=y
CONFIG_SLUB_CPU_PARTIAL=y CONFIG_SLUB_CPU_PARTIAL=y
CONFIG_SMP=y CONFIG_SMP=y
CONFIG_STOP_MACHINE=y
CONFIG_TREE_RCU=y CONFIG_TREE_RCU=y
CONFIG_XPS=y CONFIG_XPS=y

View file

@ -1,32 +0,0 @@
--- a/arch/powerpc/boot/dts/fsl/mpc8568si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/mpc8568si-post.dtsi
@@ -134,17 +134,8 @@
};
- duart-sleep-nexus {
- #address-cells = <1>;
- #size-cells = <1>;
- compatible = "simple-bus";
- sleep = <&pmc 0x00000002>;
- ranges;
-
/include/ "pq3-duart-0.dtsi"
- };
-
L2: l2-cache-controller@20000 {
compatible = "fsl,mpc8568-l2-cache-controller";
reg = <0x20000 0x1000>;
--- a/arch/powerpc/boot/dts/mpc8568mds.dts
+++ b/arch/powerpc/boot/dts/mpc8568mds.dts
@@ -309,6 +309,9 @@
gpios = <&bcsr5 3 0>;
};
};
+ chosen {
+ linux,stdout-path = "/soc8568@e0000000/serial@4500";
+ };
};
/include/ "fsl/mpc8568si-post.dtsi"

View file

@ -1,19 +0,0 @@
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -858,10 +858,13 @@ static int gfar_of_init(struct platform_
if (stash_len || stash_idx)
priv->device_flags |= FSL_GIANFAR_DEV_HAS_BUF_STASHING;
- mac_addr = of_get_mac_address(np);
+ err = of_get_mac_address_mtd(np, dev->dev_addr);
+ if (err) {
+ mac_addr = of_get_mac_address(np);
- if (mac_addr)
- memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
+ if (mac_addr)
+ memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
+ }
if (model && !strcasecmp(model, "TSEC"))
priv->device_flags |= FSL_GIANFAR_DEV_HAS_GIGABIT |

View file

@ -1,40 +0,0 @@
--- a/arch/powerpc/boot/dts/fsl/mpc8548si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/mpc8548si-post.dtsi
@@ -131,7 +131,24 @@
/include/ "pq3-i2c-0.dtsi"
/include/ "pq3-i2c-1.dtsi"
-/include/ "pq3-duart-0.dtsi"
+
+ serial0: serial@4600 {
+ cell-index = <1>;
+ device_type = "serial";
+ compatible = "fsl,ns16550", "ns16550";
+ reg = <0x4600 0x100>;
+ clock-frequency = <0>;
+ interrupts = <42 2 0 0>;
+ };
+
+ serial1: serial@4500 {
+ cell-index = <0>;
+ device_type = "serial";
+ compatible = "fsl,ns16550", "ns16550";
+ reg = <0x4500 0x100>;
+ clock-frequency = <0>;
+ interrupts = <42 2 0 0>;
+ };
L2: l2-cache-controller@20000 {
compatible = "fsl,mpc8548-l2-cache-controller";
--- a/arch/powerpc/boot/dts/mpc8548cds_32b.dts
+++ b/arch/powerpc/boot/dts/mpc8548cds_32b.dts
@@ -75,6 +75,9 @@
ranges = <0x0 0x0 0x0 0xc0000000 0x0 0x20000000>;
};
};
+ chosen {
+ linux,stdout-path = "/soc8548@e0000000/serial@4600";
+ };
};
/*

View file

@ -1,23 +0,0 @@
--- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
@@ -247,15 +247,16 @@ static int mpc85xx_cds_8259_attach(void)
return -ENODEV;
}
+ i8259_init(cascade_node, 0);
+ of_node_put(cascade_node);
+
cascade_irq = irq_of_parse_and_map(cascade_node, 0);
if (cascade_irq == NO_IRQ) {
- printk(KERN_ERR "Failed to map cascade interrupt\n");
+ of_node_put(cascade_node);
+ printk(KERN_DEBUG "No interrupt for i8259 PIC\n");
return -ENXIO;
}
- i8259_init(cascade_node, 0);
- of_node_put(cascade_node);
-
/*
* Hook the interrupt to make sure desc->action is never NULL.
* This is required to ensure that the interrupt does not get

View file

@ -1,13 +0,0 @@
--- a/arch/powerpc/boot/dts/mpc8548cds.dtsi
+++ b/arch/powerpc/boot/dts/mpc8548cds.dtsi
@@ -289,8 +289,10 @@
#address-cells = <0>;
#interrupt-cells = <2>;
compatible = "chrp,iic";
+/*
interrupts = <0 1 0 0>;
interrupt-parent = <&mpic>;
+*/
};
rtc@70 {

View file

@ -17,15 +17,15 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
--- a/arch/powerpc/boot/Makefile --- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile
@@ -112,6 +112,7 @@ src-plat-$(CONFIG_PPC_POWERNV) += pserie @@ -114,6 +114,7 @@ src-plat-$(CONFIG_PPC_PSERIES) += pserie
src-plat-$(CONFIG_PPC_POWERNV) += pseries-head.S
src-plat-$(CONFIG_PPC_IBM_CELL_BLADE) += pseries-head.S src-plat-$(CONFIG_PPC_IBM_CELL_BLADE) += pseries-head.S
src-plat-$(CONFIG_PPC_CELLEB) += pseries-head.S
src-plat-$(CONFIG_PPC_CELL_QPACE) += pseries-head.S src-plat-$(CONFIG_PPC_CELL_QPACE) += pseries-head.S
+src-plat-$(CONFIG_TL_WDR4900_V1) += cuboot-tl-wdr4900-v1.c +src-plat-$(CONFIG_TL_WDR4900_V1) += cuboot-tl-wdr4900-v1.c
src-wlib := $(sort $(src-wlib-y)) src-wlib := $(sort $(src-wlib-y))
src-plat := $(sort $(src-plat-y)) src-plat := $(sort $(src-plat-y))
@@ -296,6 +297,7 @@ image-$(CONFIG_TQM8555) += cuImage.tqm @@ -297,6 +298,7 @@ image-$(CONFIG_TQM8555) += cuImage.tqm
image-$(CONFIG_TQM8560) += cuImage.tqm8560 image-$(CONFIG_TQM8560) += cuImage.tqm8560
image-$(CONFIG_SBC8548) += cuImage.sbc8548 image-$(CONFIG_SBC8548) += cuImage.sbc8548
image-$(CONFIG_KSI8560) += cuImage.ksi8560 image-$(CONFIG_KSI8560) += cuImage.ksi8560
@ -35,7 +35,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
image-$(CONFIG_STORCENTER) += cuImage.storcenter image-$(CONFIG_STORCENTER) += cuImage.storcenter
--- a/arch/powerpc/boot/wrapper --- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper +++ b/arch/powerpc/boot/wrapper
@@ -218,6 +218,10 @@ cuboot*) @@ -235,6 +235,10 @@ cuboot*)
*-mpc85*|*-tqm85*|*-sbc85*) *-mpc85*|*-tqm85*|*-sbc85*)
platformo=$object/cuboot-85xx.o platformo=$object/cuboot-85xx.o
;; ;;

View file

@ -31,6 +31,7 @@ Preallocate the buffer from the probe routine to avoid
this. this.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org> Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
--- ---
drivers/spi/spi-fsl-espi.c | 34 ++++++++++++++++------------------ drivers/spi/spi-fsl-espi.c | 34 ++++++++++++++++------------------
drivers/spi/spi-fsl-lib.h | 1 + drivers/spi/spi-fsl-lib.h | 1 +
@ -38,7 +39,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
--- a/drivers/spi/spi-fsl-espi.c --- a/drivers/spi/spi-fsl-espi.c
+++ b/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c
@@ -329,17 +329,13 @@ static void fsl_espi_do_trans(struct spi @@ -332,17 +332,13 @@ static void fsl_espi_do_trans(struct spi
static void fsl_espi_cmd_trans(struct spi_message *m, static void fsl_espi_cmd_trans(struct spi_message *m,
struct fsl_espi_transfer *trans, u8 *rx_buff) struct fsl_espi_transfer *trans, u8 *rx_buff)
{ {
@ -59,7 +60,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
list_for_each_entry(t, &m->transfers, transfer_list) { list_for_each_entry(t, &m->transfers, transfer_list) {
if (t->tx_buf) { if (t->tx_buf) {
memcpy(local_buf + i, t->tx_buf, t->len); memcpy(local_buf + i, t->tx_buf, t->len);
@@ -352,28 +348,23 @@ static void fsl_espi_cmd_trans(struct sp @@ -355,16 +351,17 @@ static void fsl_espi_cmd_trans(struct sp
fsl_espi_do_trans(m, espi_trans); fsl_espi_do_trans(m, espi_trans);
espi_trans->actual_length = espi_trans->len; espi_trans->actual_length = espi_trans->len;
@ -72,15 +73,16 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
+ struct spi_device *spi = m->spi; + struct spi_device *spi = m->spi;
+ struct mpc8xxx_spi *mspi = spi_master_get_devdata(spi->master); + struct mpc8xxx_spi *mspi = spi_master_get_devdata(spi->master);
struct fsl_espi_transfer *espi_trans = trans; struct fsl_espi_transfer *espi_trans = trans;
unsigned int n_tx = espi_trans->n_tx; unsigned int total_len = espi_trans->len;
unsigned int n_rx = espi_trans->n_rx;
struct spi_transfer *t; struct spi_transfer *t;
- u8 *local_buf; - u8 *local_buf;
+ u8 *local_buf = mspi->local_buf; + u8 *local_buf = mspi->local_buf;
u8 *rx_buf = rx_buff; u8 *rx_buf = rx_buff;
unsigned int trans_len; unsigned int trans_len;
unsigned int addr; unsigned int addr;
int i, pos, loop; @@ -373,12 +370,6 @@ static void fsl_espi_rw_trans(struct spi
unsigned int pos;
int i, loop;
- local_buf = kzalloc(SPCOM_TRANLEN_MAX, GFP_KERNEL); - local_buf = kzalloc(SPCOM_TRANLEN_MAX, GFP_KERNEL);
- if (!local_buf) { - if (!local_buf) {
@ -88,10 +90,10 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
- return; - return;
- } - }
- -
for (pos = 0, loop = 0; pos < n_rx; pos += trans_len, loop++) { for (pos = 0, loop = 0; pos < total_len; pos += trans_len, loop++) {
trans_len = n_rx - pos; trans_len = total_len - pos;
if (trans_len > SPCOM_TRANLEN_MAX - n_tx)
@@ -407,8 +398,6 @@ static void fsl_espi_rw_trans(struct spi @@ -424,8 +415,6 @@ static void fsl_espi_rw_trans(struct spi
else else
espi_trans->actual_length += espi_trans->len; espi_trans->actual_length += espi_trans->len;
} }
@ -99,47 +101,25 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
- kfree(local_buf); - kfree(local_buf);
} }
static void fsl_espi_do_one_msg(struct spi_message *m) static int fsl_espi_do_one_msg(struct spi_master *master,
@@ -585,6 +574,7 @@ static irqreturn_t fsl_espi_irq(s32 irq, @@ -673,6 +662,12 @@ static struct spi_master * fsl_espi_prob
static void fsl_espi_remove(struct mpc8xxx_spi *mspi)
{
iounmap(mspi->reg_base);
+ kfree(mspi->local_buf);
}
static struct spi_master * fsl_espi_probe(struct device *dev, mpc8xxx_spi = spi_master_get_devdata(master);
@@ -619,10 +609,16 @@ static struct spi_master * fsl_espi_prob
mpc8xxx_spi->spi_do_one_msg = fsl_espi_do_one_msg;
mpc8xxx_spi->spi_remove = fsl_espi_remove;
+ mpc8xxx_spi->local_buf = kzalloc(SPCOM_TRANLEN_MAX, GFP_KERNEL); + mpc8xxx_spi->local_buf = devm_kzalloc(dev, SPCOM_TRANLEN_MAX, GFP_KERNEL);
+ if (!mpc8xxx_spi->local_buf) { + if (!mpc8xxx_spi->local_buf) {
+ ret = -ENOMEM; + ret = -ENOMEM;
+ goto err_probe; + goto err_probe;
+ } + }
+ +
mpc8xxx_spi->reg_base = ioremap(mem->start, resource_size(mem)); mpc8xxx_spi->reg_base = devm_ioremap_resource(dev, mem);
if (!mpc8xxx_spi->reg_base) { if (IS_ERR(mpc8xxx_spi->reg_base)) {
ret = -ENOMEM; ret = PTR_ERR(mpc8xxx_spi->reg_base);
- goto err_probe;
+ goto free_buf;
}
reg_base = mpc8xxx_spi->reg_base;
@@ -689,6 +685,8 @@ unreg_master:
free_irq(mpc8xxx_spi->irq, mpc8xxx_spi);
free_irq:
iounmap(mpc8xxx_spi->reg_base);
+free_buf:
+ kfree(mpc8xxx_spi->local_buf);
err_probe:
spi_master_put(master);
err:
--- a/drivers/spi/spi-fsl-lib.h --- a/drivers/spi/spi-fsl-lib.h
+++ b/drivers/spi/spi-fsl-lib.h +++ b/drivers/spi/spi-fsl-lib.h
@@ -30,6 +30,7 @@ struct mpc8xxx_spi { @@ -30,6 +30,7 @@ struct mpc8xxx_spi {
void *rx; void *rx;
#ifdef CONFIG_SPI_FSL_ESPI #if IS_ENABLED(CONFIG_SPI_FSL_ESPI)
int len; int len;
+ u8 *local_buf; + u8 *local_buf;
#endif #endif