Skip to content

Commit 508f3d3

Browse files
chintingkuobroonie
authored andcommitted
spi: aspeed: Use phys_addr_t for bus addresses to support 64-bit platforms
Update bus address types from u32 to phys_addr_t to support systems with 64-bit memory address space. This change ensures compatibility with upcoming SoCs that extend the system bus beyond 32-bit, while maintaining support for existing platforms. Signed-off-by: Chin-Ting Kuo <chin-ting_kuo@aspeedtech.com> Link: https://patch.msgid.link/20251114101042.1520997-4-chin-ting_kuo@aspeedtech.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent be6671d commit 508f3d3

1 file changed

Lines changed: 17 additions & 15 deletions

File tree

drivers/spi/spi-aspeed-smc.c

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,10 @@ struct aspeed_spi_data {
8282
u32 hdiv_max;
8383
u32 min_window_size;
8484

85-
u32 (*segment_start)(struct aspeed_spi *aspi, u32 reg);
86-
u32 (*segment_end)(struct aspeed_spi *aspi, u32 reg);
87-
u32 (*segment_reg)(struct aspeed_spi *aspi, u32 start, u32 end);
85+
phys_addr_t (*segment_start)(struct aspeed_spi *aspi, u32 reg);
86+
phys_addr_t (*segment_end)(struct aspeed_spi *aspi, u32 reg);
87+
u32 (*segment_reg)(struct aspeed_spi *aspi, phys_addr_t start,
88+
phys_addr_t end);
8889
int (*adjust_window)(struct aspeed_spi *aspi);
8990
u32 (*get_clk_div)(struct aspeed_spi_chip *chip, u32 hz);
9091
int (*calibrate)(struct aspeed_spi_chip *chip, u32 hdiv,
@@ -97,7 +98,7 @@ struct aspeed_spi {
9798
const struct aspeed_spi_data *data;
9899

99100
void __iomem *regs;
100-
u32 ahb_base_phy;
101+
phys_addr_t ahb_base_phy;
101102
u32 ahb_window_size;
102103
u32 num_cs;
103104
struct device *dev;
@@ -484,9 +485,9 @@ static int aspeed_spi_chip_set_default_window(struct aspeed_spi *aspi)
484485
/* Assign the minimum window size to each CS */
485486
for (cs = 0; cs < aspi->num_cs; cs++) {
486487
aspi->chips[cs].ahb_window_size = aspi->data->min_window_size;
487-
dev_dbg(aspi->dev, "CE%d default window [ 0x%.8x - 0x%.8x ]",
488-
cs, aspi->ahb_base_phy + aspi->data->min_window_size * cs,
489-
aspi->ahb_base_phy + aspi->data->min_window_size * cs - 1);
488+
dev_dbg(aspi->dev, "CE%d default window [ 0x%.9llx - 0x%.9llx ]",
489+
cs, (u64)(aspi->ahb_base_phy + aspi->data->min_window_size * cs),
490+
(u64)(aspi->ahb_base_phy + aspi->data->min_window_size * cs - 1));
490491
}
491492

492493
/* Close unused CS */
@@ -930,17 +931,18 @@ static void aspeed_spi_remove(struct platform_device *pdev)
930931
* The address range is encoded with absolute addresses in the overall
931932
* mapping window.
932933
*/
933-
static u32 aspeed_spi_segment_start(struct aspeed_spi *aspi, u32 reg)
934+
static phys_addr_t aspeed_spi_segment_start(struct aspeed_spi *aspi, u32 reg)
934935
{
935936
return ((reg >> 16) & 0xFF) << 23;
936937
}
937938

938-
static u32 aspeed_spi_segment_end(struct aspeed_spi *aspi, u32 reg)
939+
static phys_addr_t aspeed_spi_segment_end(struct aspeed_spi *aspi, u32 reg)
939940
{
940941
return ((reg >> 24) & 0xFF) << 23;
941942
}
942943

943-
static u32 aspeed_spi_segment_reg(struct aspeed_spi *aspi, u32 start, u32 end)
944+
static u32 aspeed_spi_segment_reg(struct aspeed_spi *aspi,
945+
phys_addr_t start, phys_addr_t end)
944946
{
945947
return (((start >> 23) & 0xFF) << 16) | (((end >> 23) & 0xFF) << 24);
946948
}
@@ -952,16 +954,16 @@ static u32 aspeed_spi_segment_reg(struct aspeed_spi *aspi, u32 start, u32 end)
952954

953955
#define AST2600_SEG_ADDR_MASK 0x0ff00000
954956

955-
static u32 aspeed_spi_segment_ast2600_start(struct aspeed_spi *aspi,
956-
u32 reg)
957+
static phys_addr_t aspeed_spi_segment_ast2600_start(struct aspeed_spi *aspi,
958+
u32 reg)
957959
{
958960
u32 start_offset = (reg << 16) & AST2600_SEG_ADDR_MASK;
959961

960962
return aspi->ahb_base_phy + start_offset;
961963
}
962964

963-
static u32 aspeed_spi_segment_ast2600_end(struct aspeed_spi *aspi,
964-
u32 reg)
965+
static phys_addr_t aspeed_spi_segment_ast2600_end(struct aspeed_spi *aspi,
966+
u32 reg)
965967
{
966968
u32 end_offset = reg & AST2600_SEG_ADDR_MASK;
967969

@@ -973,7 +975,7 @@ static u32 aspeed_spi_segment_ast2600_end(struct aspeed_spi *aspi,
973975
}
974976

975977
static u32 aspeed_spi_segment_ast2600_reg(struct aspeed_spi *aspi,
976-
u32 start, u32 end)
978+
phys_addr_t start, phys_addr_t end)
977979
{
978980
/* disable zero size segments */
979981
if (start == end)

0 commit comments

Comments
 (0)