Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp893469imi; Thu, 21 Jul 2022 13:05:48 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tTkLG3F30DxEdZAwjNAS3ROAccnMyCuvvn1HAeX5/Cu8/Hs+tcQjgdHst0jQ5AMuOQj2TD X-Received: by 2002:a63:4f06:0:b0:41a:529b:b47b with SMTP id d6-20020a634f06000000b0041a529bb47bmr32582pgb.243.1658433948057; Thu, 21 Jul 2022 13:05:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658433948; cv=none; d=google.com; s=arc-20160816; b=bn50vf7hzd2Y+devArOmEgKiEwCjz7PV3T85mhHGnLasReuoRtb8w9G5iYxA6aq5vj X+IgeWauaZ+CXDE2hUOE1Ep+ngmm+pi3axDZGZO1GeIpydZUf+VdUKthhmiVQmsw+nOo VpIin80itsJwoz4zdJ8uB1wiG0S/xf8rxTd1V8KCjOcss80lqwie3W9y6sDY71y9lmvD A9UivQSUA4UfS+zyeZAwC27iMgkCbwb9IIQuvQNiWiShYg8IqOroSCJMRK0QWqotzX8R iB9KoCQbqIaRoMtMG5i/54klyqElwZ98CEno1uyaqqu2z9JLLEf05Ga3TSkAIIGm2Imo W0rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:message-id:date:subject:cc:from :dkim-signature; bh=KzbAYM4nGE4ezUX59c5W154+NTPrtANBLPEKpj2px0c=; b=sC4l7sgbShVh6T8agc/kct+PHQEUqI+0pdskjS+jbvWZPd3sCVsdWbPRYw5G9CBGau fu+hpWboPVASyNgFf3Qxrjz3FVwL68C24nlCgACa31BETgTsNsuK2ghNYEsYcUHrvvCs 9KvxnTHEOv4txcc/Tw8ieY1ZSmo2ErbxALq42zNHdrL6LgLo1sLdikGkpi2HiIQZN/xx AOn8UuwWb4Z8HaBBl4Z31HYe2WTdLbwD6CFw5H+t3YK7Ys+6AWfcNUaQ7uyJrhp7fpzW VnqRw1vAqovCh9YWdNiqDOeEWoWvgVRY0eRxpvAZ1/ugn31eVtqg75qp5S5OB7rMESnH OFFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b=DiFDsU8C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c18-20020a170902c2d200b0016a14be1802si3079426pla.295.2022.07.21.13.05.06; Thu, 21 Jul 2022 13:05:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b=DiFDsU8C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230367AbiGUTfo (ORCPT + 99 others); Thu, 21 Jul 2022 15:35:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233301AbiGUTfg (ORCPT ); Thu, 21 Jul 2022 15:35:36 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5AA93B951; Thu, 21 Jul 2022 12:35:30 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id mf4so4922752ejc.3; Thu, 21 Jul 2022 12:35:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id; bh=KzbAYM4nGE4ezUX59c5W154+NTPrtANBLPEKpj2px0c=; b=DiFDsU8CXUaFSApPMqlBrkFd3QUhyecksU6hRMdf1ltuCKYSnecZ4azYPFydoLR7hP lKKq90W1HXBGVU+tB0fPCJbJdtOsJVrsvGU33KiYXKGEw0Q9ag+DOZDQhS81O09SJKHA imtV2sfUl1B69A/o6raDSnRsOLa7eXhxEAH+QJjEURmqO9O8lsjUA9ctiGTwOOv7MqNh vu9sjta1Z4cior2BcZYMz+WJzL9qZ3HQPJjiPGi8yxYBew1ZN1Dqrhj+Iy96kUBwRxNB +R6dL39C0H6OG11rsDIAFPYZcrn4w08UXo7x45xNTfwemLI9jHR/RS2cYMFsWhlgXqWw uBTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=KzbAYM4nGE4ezUX59c5W154+NTPrtANBLPEKpj2px0c=; b=yoAUAEjAv7E2b46VVFEbl/hUgJjMa8K82OaRg88Z87iZpReEAPWiYfdeG5zU0QXETM JkXuegFI9BHFghNLXTUjYOBOtCQz0iGh8mJ3wm6mIXuvyR38OBcjEp8yGPOkylRJ7ZO3 eE7lRgKNEvdKBHV4pW80jxZ5ru1Ko15eYaXZtuJAXfShcScruHbEVXo3TV2Acl2w+5pP dNvrW1qndqC30VYgC/ii18AnV0KxHwEp4ku/CxpAWO3XP3xfhHnQQqNx60bn338nx9ZI 4qIW5+9rT8BoPVUFkCQx5mPZFRZHZUeaSVhj9RkbcFm5pst3YTrjeSXfC5dKlqR7zwUA 9Tww== X-Gm-Message-State: AJIora/JJfpAvuYn2Ah713AeZhBUChdt6nXC9R91sm1k5d5oTKAjJxqH xEgEOSHgCdT2Ue7t2KlL4aQ= X-Received: by 2002:a17:907:1361:b0:72b:3554:4f7 with SMTP id yo1-20020a170907136100b0072b355404f7mr115941ejb.420.1658432129142; Thu, 21 Jul 2022 12:35:29 -0700 (PDT) Received: from localhost.localdomain ([155.133.219.250]) by smtp.gmail.com with ESMTPSA id q6-20020a056402032600b0043574d27ddasm1430430edw.16.2022.07.21.12.35.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jul 2022 12:35:28 -0700 (PDT) From: Daniel Kestrel Cc: Bjorn Andersson , Mathieu Poirier , Rob Herring , Daniel Kestrel , linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 0/3] Add support for WASP SoC on AVM router boards Date: Thu, 21 Jul 2022 21:34:52 +0200 Message-Id: <20220721193455.2717-1-kestrelseventyfour@gmail.com> X-Mailer: git-send-email 2.17.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is a popular set of Lantiq xrx200 router boards by AVM in Germany (AVM Fritzbox 3390, 3490, 5490, 5491 and 7490) which have the strange implementation of having the wifi cards connected to a separate memory only ATH79 based SoC. It has no persistent storage and no access to any resource on the Lantiq host, but is connect to the Lantiq GSWIP switch on an additional fixed internal network port. This kernel module is to support booting the secondary SoC called Wireless Assistant Support Processor (WASP). After turning it on, a small network boot firmware is sent to the SoC by using mdio and when it is started, an initramfs linux image is sent to the SoC using raw ethernet frames. The whole procedure takes about 6 seconds, if there is no error. So far tested on 3490, 5490 and 7490 devices based on OpenWrt, 3390 takes about 20 seconds. Patch 1/3 adds the vendor name Patch 2/3 adds the dt-bindings Patch 3/3 adds the remoteproc driver To build and run, there is OpenWrt PR 5075. Please review. Changes in v3: - Replace generic avm,fritzboxx490-wasp with actual device names for device tree documentation and change the driver to accept them - Add maxItems to device tree documentation - Change example in the device tree documentation - Fix wait time to make the Wasp upload work for 3390 more reliable - Enable the SOC on driver load, use reset instead of disable/enable while driver is loaded and disable on unloading the driver - Change some messages printed to adhere to standards (e.g. remove !) Changes in v2: - Remove firmware names from dt-binding and add as kmod parameters - Rename other bindings with vender prefix and fix gpios suffix - Change descriptions in dt-binding - Replace/Remove asynch load of firmware with request_firmware_direct - Fix comments to use the errno define instead of the number - Implement wait loops with read_poll_timeout() macro - Wrap read_poll_timeout() macro in function saving 6k module size - Return -ETIMEDOUT for all errors returned by read_poll_timeout - Replace mdio writes/reads with mdiobus_write and mdiobus_read and add return codes and their handling - Remove mutex for mdiobus_lock and add return code checking for mdio ops - Replaced the mdio register array with directly specifying registers - As a result of the previous 3 changes remove the functions for mdio - Consolidate error messages for mdio writes into a single one saved 1k for module size - Replaced mdelay with usleep_range saved 0,7k module size - Remove unneeded include and - Wrap all blocks with {} and fix some indentation errors - Change const len in to size_t in avm_wasp_netboot_write_chunk - Make all methods static to fix kernel bot warning - Change read variable name in avm_wasp_load_initramfs_image - Change ssize_t variables to size_t in avm_wasp_load_initramfs_image - avm_wasp_netboot_write_chunk change for loop for 2 byte divisibility - Change uint32_t to u32 - Change int count = -1 to u32 with U32_MAX initialisation - Add check for firmware len divisable by 4 - Replace big endian bit shift operations with be32_to_cpu - Change loop to write 14 byte firmware chuncks like suggested - Change WASP_CHUNK_SIZE to ARRAY_SIZE(mac_data) for readability - Change int done to boolean - Change unsigned ints to u32 - Change int to size_t for send_len - Use int for numbytes because kernel_recvmsg returns error or number - Two sockets are not needed, so reduce to one socket usage - Remove struct timeval definition, replace with __kernel_old_timeval - __kernel_old_timeval is depracated, but arch mips is 32bit platform - Replace &avmwasp->pdev->dev with local dev - Check if wasp network interface is up and fail if not in start method - Remove setsockopt for SO_REUSEADDR and SO_BINDTODEVICE - Remove packet_counter - Move firmware and firmware_end out of RESP_DISCOVER to make sure that they are initialized if RESP_DISCOVER is not happening first - indend break; - Move second half of the send/receive paket while loop to RESP_OK and let RESP_DISCOVER fall through - Remove bringing up the wasp network interface - Check if wasp network interface is up in probe and defer if not - Remove the check for the root device and replace it with match data for WASP device identification - Move of_read and find of mdio bus to rproc_start but delete reference after using it in the rproc_start method - Replace dev_set_drvdata with platform_set_drvdata - Remove avm_wasp_rproc_boot_addr because its not needed and move setting the fw struct pointer to avm_wasp_rproc_load - Move avm_wasp.h definitions to kernel module Reported-by: kernel test robot Daniel Kestrel (3): dt-bindings: vendor-prefixes: Add AVM dt-bindings: remoteproc: Add AVM WASP remoteproc: Add AVM WASP driver .../bindings/remoteproc/avm,wasp-rproc.yaml | 61 + .../devicetree/bindings/vendor-prefixes.yaml | 2 + drivers/remoteproc/Kconfig | 10 + drivers/remoteproc/Makefile | 1 + drivers/remoteproc/avm_wasp.c | 1056 +++++++++++++++++ 5 files changed, 1130 insertions(+) create mode 100644 Documentation/devicetree/bindings/remoteproc/avm,wasp-rproc.yaml create mode 100644 drivers/remoteproc/avm_wasp.c -- 2.17.1