blob: dc2ada6fb9b4d9f64ce6cb3de7b23e96212bd664 [file] [log] [blame]
Tony Lindgrene639cd52014-11-20 12:11:25 -08001/*
2 * OMAP GPMC (General Purpose Memory Controller) defines
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 */
9
Roger Quadros58bc67f2015-07-10 15:23:28 +030010#include <linux/platform_data/gpmc-omap.h>
Tony Lindgrene639cd52014-11-20 12:11:25 -080011
12#define GPMC_CONFIG_WP 0x00000005
13
14#define GPMC_IRQ_FIFOEVENTENABLE 0x01
15#define GPMC_IRQ_COUNT_EVENT 0x02
16
Roger Quadrosf47fcad2015-08-05 13:58:01 +030017/**
18 * gpmc_nand_ops - Interface between NAND and GPMC
19 * @nand_write_buffer_empty: get the NAND write buffer empty status.
20 */
21struct gpmc_nand_ops {
22 bool (*nand_writebuffer_empty)(void);
23};
24
25struct gpmc_nand_regs;
26
27#if IS_ENABLED(CONFIG_OMAP_GPMC)
28struct gpmc_nand_ops *gpmc_omap_get_nand_ops(struct gpmc_nand_regs *regs,
29 int cs);
30#else
31static inline gpmc_nand_ops *gpmc_omap_get_nand_ops(struct gpmc_nand_regs *regs,
32 int cs)
33{
34 return NULL;
35}
36#endif /* CONFIG_OMAP_GPMC */
37
38/*--------------------------------*/
39
40/* deprecated APIs */
41#if IS_ENABLED(CONFIG_OMAP_GPMC)
42void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs);
43#else
44static inline void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs)
45{
46}
47#endif /* CONFIG_OMAP_GPMC */
48/*--------------------------------*/
49
Tony Lindgrene639cd52014-11-20 12:11:25 -080050extern int gpmc_calc_timings(struct gpmc_timings *gpmc_t,
51 struct gpmc_settings *gpmc_s,
52 struct gpmc_device_timings *dev_t);
53
Tony Lindgrene639cd52014-11-20 12:11:25 -080054struct device_node;
55
Tony Lindgrene639cd52014-11-20 12:11:25 -080056extern int gpmc_get_client_irq(unsigned irq_config);
57
58extern unsigned int gpmc_ticks_to_ns(unsigned int ticks);
59
60extern void gpmc_cs_write_reg(int cs, int idx, u32 val);
61extern int gpmc_calc_divider(unsigned int sync_clk);
Robert ABEL2e676902015-02-27 16:56:53 +010062extern int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t,
63 const struct gpmc_settings *s);
Tony Lindgrene639cd52014-11-20 12:11:25 -080064extern int gpmc_cs_program_settings(int cs, struct gpmc_settings *p);
65extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base);
66extern void gpmc_cs_free(int cs);
67extern int gpmc_configure(int cmd, int wval);
68extern void gpmc_read_settings_dt(struct device_node *np,
69 struct gpmc_settings *p);
70
71extern void omap3_gpmc_save_context(void);
72extern void omap3_gpmc_restore_context(void);
73
74struct gpmc_timings;
75struct omap_nand_platform_data;
76struct omap_onenand_platform_data;
77
78#if IS_ENABLED(CONFIG_MTD_NAND_OMAP2)
79extern int gpmc_nand_init(struct omap_nand_platform_data *d,
80 struct gpmc_timings *gpmc_t);
81#else
82static inline int gpmc_nand_init(struct omap_nand_platform_data *d,
83 struct gpmc_timings *gpmc_t)
84{
85 return 0;
86}
87#endif
88
89#if IS_ENABLED(CONFIG_MTD_ONENAND_OMAP2)
90extern void gpmc_onenand_init(struct omap_onenand_platform_data *d);
91#else
92#define board_onenand_data NULL
93static inline void gpmc_onenand_init(struct omap_onenand_platform_data *d)
94{
95}
96#endif