From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Arnd Bergmann <arnd@arndb.de>
Subject: [PATCH v1 1/1] MIPS: TXx9: Convert SPI platform data to software nodes
Date: Fri, 26 Nov 2021 12:23:39 +0200 [thread overview]
Message-ID: <20211126102339.28908-1-andriy.shevchenko@linux.intel.com> (raw)
In order to get rid of legacy platform data in AT25 driver,
convert its users to use software nodes.
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
arch/mips/include/asm/txx9/spi.h | 4 ++--
arch/mips/txx9/generic/spi_eeprom.c | 32 +++++++++++++++++------------
arch/mips/txx9/rbtx4938/setup.c | 6 +++---
3 files changed, 24 insertions(+), 18 deletions(-)
diff --git a/arch/mips/include/asm/txx9/spi.h b/arch/mips/include/asm/txx9/spi.h
index 0d727f354557..1ca87a516b81 100644
--- a/arch/mips/include/asm/txx9/spi.h
+++ b/arch/mips/include/asm/txx9/spi.h
@@ -16,11 +16,11 @@
#include <linux/errno.h>
#ifdef CONFIG_SPI
-int spi_eeprom_register(int busid, int chipid, int size);
+int spi_eeprom_register(int busid, int chipid);
int spi_eeprom_read(int busid, int chipid,
int address, unsigned char *buf, int len);
#else
-static inline int spi_eeprom_register(int busid, int chipid, int size)
+static inline int spi_eeprom_register(int busid, int chipid)
{
return -ENODEV;
}
diff --git a/arch/mips/txx9/generic/spi_eeprom.c b/arch/mips/txx9/generic/spi_eeprom.c
index d833dd2c9b55..cb4b4d47437e 100644
--- a/arch/mips/txx9/generic/spi_eeprom.c
+++ b/arch/mips/txx9/generic/spi_eeprom.c
@@ -9,18 +9,32 @@
*
* Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com)
*/
+#include <linux/device.h>
+#include <linux/export.h>
#include <linux/init.h>
+#include <linux/property.h>
#include <linux/slab.h>
-#include <linux/export.h>
-#include <linux/device.h>
+
#include <linux/spi/spi.h>
-#include <linux/spi/eeprom.h>
+
#include <asm/txx9/spi.h>
+#define AT250X0_SIZE 128
#define AT250X0_PAGE_SIZE 8
+static const struct property_entry spi_eeprom_properties[] = {
+ PROPERTY_ENTRY_U32("size", AT250X0_SIZE),
+ PROPERTY_ENTRY_U32("pagesize", AT250X0_PAGE_SIZE),
+ PROPERTY_ENTRY_U32("address-width", 8),
+ { }
+};
+
+static const struct software_node spi_eeprom_node = {
+ .properties = spi_eeprom_properties,
+};
+
/* register board information for at25 driver */
-int __init spi_eeprom_register(int busid, int chipid, int size)
+int __init spi_eeprom_register(int busid, int chipid)
{
struct spi_board_info info = {
.modalias = "at25",
@@ -28,16 +42,8 @@ int __init spi_eeprom_register(int busid, int chipid, int size)
.bus_num = busid,
.chip_select = chipid,
/* Mode 0: High-Active, Sample-Then-Shift */
+ .swnode = &spi_eeprom_node,
};
- struct spi_eeprom *eeprom;
- eeprom = kzalloc(sizeof(*eeprom), GFP_KERNEL);
- if (!eeprom)
- return -ENOMEM;
- strcpy(eeprom->name, "at250x0");
- eeprom->byte_len = size;
- eeprom->page_size = AT250X0_PAGE_SIZE;
- eeprom->flags = EE_ADDR1;
- info.platform_data = eeprom;
return spi_register_board_info(&info, 1);
}
diff --git a/arch/mips/txx9/rbtx4938/setup.c b/arch/mips/txx9/rbtx4938/setup.c
index e68eb2e7ce0c..136af1cace75 100644
--- a/arch/mips/txx9/rbtx4938/setup.c
+++ b/arch/mips/txx9/rbtx4938/setup.c
@@ -283,9 +283,9 @@ static int __init rbtx4938_spi_init(void)
.mode = SPI_MODE_1 | SPI_CS_HIGH,
};
spi_register_board_info(&srtc_info, 1);
- spi_eeprom_register(SPI_BUSNO, SEEPROM1_CS, 128);
- spi_eeprom_register(SPI_BUSNO, 16 + SEEPROM2_CS, 128);
- spi_eeprom_register(SPI_BUSNO, 16 + SEEPROM3_CS, 128);
+ spi_eeprom_register(SPI_BUSNO, 0 + SEEPROM1_CS);
+ spi_eeprom_register(SPI_BUSNO, 16 + SEEPROM2_CS);
+ spi_eeprom_register(SPI_BUSNO, 16 + SEEPROM3_CS);
gpio_request(16 + SRTC_CS, "rtc-rs5c348");
gpio_direction_output(16 + SRTC_CS, 0);
gpio_request(SEEPROM1_CS, "seeprom1");
--
2.33.0
next reply other threads:[~2021-11-26 10:31 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-26 10:23 Andy Shevchenko [this message]
2021-11-26 10:58 ` [PATCH v1 1/1] MIPS: TXx9: Convert SPI platform data to software nodes Arnd Bergmann
2021-11-26 12:16 ` Geert Uytterhoeven
2021-11-26 14:41 ` Andy Shevchenko
2021-11-26 17:37 ` Thomas Bogendoerfer
2021-11-29 11:28 ` Andy Shevchenko
2021-11-29 12:02 ` Thomas Bogendoerfer
2021-11-29 12:20 ` Thomas Bogendoerfer
2021-11-29 12:30 ` Geert Uytterhoeven
2021-11-29 13:05 ` Thomas Bogendoerfer
2021-11-29 19:01 ` Geert Uytterhoeven
2022-01-18 19:59 ` Maciej W. Rozycki
2022-01-18 20:37 ` Geert Uytterhoeven
2021-12-08 17:38 ` Andy Shevchenko
2021-12-08 22:07 ` Thomas Bogendoerfer
2021-12-09 10:12 ` Andy Shevchenko
2021-12-09 10:51 ` Thomas Bogendoerfer
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=20211126102339.28908-1-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=arnd@arndb.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=tsbogend@alpha.franken.de \
/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.